3

Possible Duplicate:
How to use java.net.URLConnection to fire and handle HTTP requests?

I have to send an http post message to a server. This message must have an header and a body and to send it i must use a Stream.

Both the header and the body must be an array of Byte.

How can I do this?

Thank you

Community
  • 1
  • 1
Marcon
  • 39
  • 1
  • 2
  • 2
    See this [thread](http://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests). In particular, the section titled "**Streaming Mode**". – mrkhrts Sep 20 '11 at 15:06

1 Answers1

1

From the server you can get header information separately from HttpServletRequest.getHeaders(). Data should be read in the form of parts (multipart/form-data) using input stream that can be opened from Request object. Hope this help.

Ref: http://www.servlets.com/cos/javadoc/com/oreilly/servlet/MultipartRequest.html http://www.jguru.com/faq/view.jsp?EID=1045507

VMAtm
  • 26,645
  • 17
  • 75
  • 107
Nageswara Rao
  • 868
  • 1
  • 10
  • 31