开发者

Send Http Post Message using a stream in Java [duplicate]

开发者 https://www.devze.com 2023-04-06 08:42 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to use java.net.URLConnection to fire and handle HTTP requests?
This question already has answers here: Closed 11 years ago.

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消