简体   繁体   中英

Java socket with http multipart formdata POST method

I'm using java and I'm looking for solution to get respond from website. The problem is i need to create a handshake with server for about 30 sec and then send header and body to finish request.This also a multipart/formdata POST method. can anyone suggest me where to find tutorial or some example of code? Thank you.

You can surely work lower-level (TCP-level) blocking-style as in http://examples.javacodegeeks.com/core-java/net/socket/send-http-post-request-with-socket/

I'm confident there should be a way to do that in Netty, you could try having a look at How to send a request with POST parameters in Netty? .

I couldn't find other Java libraries that would allow you to wait before sending headers, but many (including JDK's URLConnection) will allow you to pre-configure headers and then stream the body.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM