Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

http - Multipart requests/responses java

I have a task to implement sending of http multipart request and interpreting http multipart response. I decided to start from the response as I just have to receive a response and parse it. I have not that much experience with java and even less with HTTP and that is why I read some articles and other stuff on the topic but I have still some open questions:

  1. As far as I understood the content type multipart is used for file upload, sending email attachments, etc. The most posts that I found in google were actully for file upload using multipart/form-data. In what other cases is this content-type used?
  2. I decided to start with the HTTP multipart response, but I realised I have no idea what I have to do in order to receive a response with such a content type. How shall my request look like, what shall I request with this request? I just want to write a simple program in java, which sends an HTTP request to a server and the response that is received is with content-type multipart.

It would be nice if someone can clarify these things to me because I think I have misunderstood something.

Thank you in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I would recommend turning to Apache Commons:

  • FileUpload handles the server-side, and parses multi-part posts.
  • HttpClient for the client-side, for constructing those posts.

But before you do any of that, I think you need to talk with whoever has set you on this task, to be sure that you understand exactly what he/she wants. Because multi-part for mail processing is close but not quite the same as multipart for file uploads.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...