Is there a java utility for creating answers with multiple parts?

I am creating a web service that returns a multi-part response. I know the format for creating a multi-part response; and I will create my own tools if I don’t find existing tools.

Maybe I just need help with my google-foo. All I find is downloading POST or multiuser messages.

Nothing to create multipart answers.
+6
java multipart response
source share
2 answers

You can use oreilly servlets http://www.servlets.com/cos/

For example, in javadoc: http://www.servlets.com/cos/javadoc/com/oreilly/servlet/MultipartResponse.html

import com.oreilly.servlet.MultipartResponse //javax.servlet.http.HttpServletResponse res MultipartResponse multi = new MultipartResponse(res); multi.startResponse("text/plain"); out.println("On your mark"); multi.endResponse(); try { Thread.sleep(1000); } catch (InterruptedException e) { } multi.startResponse("text/plain"); out.println("Get set"); multi.endResponse(); try { Thread.sleep(1000); } catch (InterruptedException e) { } multi.startResponse("image/gif"); ServletUtils.returnFile(req.getRealPath("/images/go.gif"), out); multi.finish(); 
+6
source

Have you tried the Apache HttpClient project? I have not looked at him since he escaped from the Apache Commons material, but I know that he has done a lot with multi-part answers.

This is for consumption - not sure if there is something for production, but this may be the place to start.

http://hc.apache.org/httpclient-3.x/methods/multipartpost.html

-one
source

All Articles