File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Problem sending bytes. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem sending bytes." Watch "Problem sending bytes." New topic
Author

Problem sending bytes.

Luis Valle
Greenhorn

Joined: Jan 08, 2001
Posts: 13
Hi all!
I want to send an array of bytes with an HTTP servlet to a java client. I tried converting the array of bytes to a String and send with PrintWriter.println(String). The problem is that these bytes don�t come from text information, they are data from another source. I tried using ServletOutputStream, that is used to send binary data instead of text data, but I don�t know what MIME type I should specify. Could you help me?
Thank you,
Best Regards, Luis Angel.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

I dont know if this will help or not.
Since you didnt say you were sending it to an applet.
I sent an int from a servlet to an applet like this:

applet code


anyway the mime type would be one of these:

I am kind of new at this also so I could be wrong.
[This message has been edited by Randall Twede (edited February 22, 2001).]


SCJP
Visit my download page
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
If it is your Java client which accepts the data, you can use any mime type you like. The mime type is just a hint to th ebrowser how to display the data.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Luis Valle
Greenhorn

Joined: Jan 08, 2001
Posts: 13
Hi:
When I use the ContentType text/html in the servlet, in the client side, some of the received bytes (a lot of them) were changed always to the value "63": for example, original value=-159 received value=63. It seems that when I send the bytes it modify some characters. Because of this, I think I should specify another ContentType, shouldn�t I?
Thanks both of you!
Best Regards, Luis
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem sending bytes.