multipart/form-data requests
I'm sending multipart/form-data request from the web client, however, it's inconvinient to get to the files if there is a more than one file. HttpServletRequest comes in but JFS code created BasicHttpEntity EnclosingRequest which has file data in the entity. Are there JFS utility methods to parse that data, i.e. split it in files similarly to org.apache.commons.fileuploader API?
Thanks!
Cheers,
Alex
Thanks!
Cheers,
Alex
4 answers
I'm unsure of the context where you want to parse multipart requests - is it in a fronting application?
You can just use org.apache.commons.fileupload, since it is part of the SDK.
The request is going to a REST service. com.ibm.team.jfs.app.servlet.AppContainerSerlet#service(...) method creates BasicHttpEntityEnclosingRequest from HttpServletRequest and puts files data into entity of the new request. How can I easily get the files out of the entity? I'd use ServletFileUploader but the request at my layer is BasicHttpEntityEnclosingRequest. Are there any utility methods to do this?
Thanks!
Cheers,
Alex
Found the answer here: http://www.oreillynet.com/onjava/blog/2006/06/parsing_formdata_multiparts.html
Thought there should be a more convenient way doing this with BasicHttpEntityEnclosingRequest like it's done for HttpServletRequest with the fileuploader library you mentioned. Perhaps something some api in jfs?
MultipartStream has deprecated constructors :-/
Cheers,
Alex
Thought there should be a more convenient way doing this with BasicHttpEntityEnclosingRequest like it's done for HttpServletRequest with the fileuploader library you mentioned. Perhaps something some api in jfs?
MultipartStream has deprecated constructors :-/
Cheers,
Alex