• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem sending bytes.

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Luis Valle
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic