开发者

Using org.apache.commons.fileupload inside GenericPortlet.serveResource()

I'd appreciate your insights on this!

I'm writing an application based on portlet2.0 and JSP. One of the JSPs includes a form which allows users to upload files. I'm using dojo.io.iframe.send() to upload the file, and address it to the url:< portlet:resourceURL/>, that is - to the GenericPortlet.serveResource(ResourceRequest request, ResourceResponse response) method.

As this is a multipart request, I can't access the input field parameter through request.getParameter(), and therefore using the org.apache.commons.fileupload package.

However, the PortletFileUpload.parseRequest() gets only an ActionRequest and not a ResourceRequest.

My work-around includes getting the HttpServletRequest object 开发者_如何学Pythonout of the ResourceRequest, and then using the ServletFileUpload.parseRequest().

What do you think of this solution? Do you have any other suggestions for a proper work-around?

Thank you very much for your thoughts.


Well, answering to myself...

Coming to think of it, the dojo.io.iframe submits the form and doesn't really perform an AJAX call, so basically it is more correct to use the _<_ portlet:actionURL/> than the _<_ portlet:resourceURL/> - which naturally solves the whole issue.

Thanks anyway

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜