I was able to resolve one or two problems. The commons fileupload FAQ gave a hint [1]. Thus, I looked for a solution that relies on a Filter and came across [2]. This Filter creates a HttpServletRequestWrapper (implements HttpServletRequest) that parses the request whenever dealing with a file upload using commons fileupload. This works very nice. I was supposed to see two FileItems [3] (which I never got up to this point) and this is now exactly what I get. Thus, the request is parsed properly and everything (including the image file) is available.

However, the filter continues with

aChain.doFilter(wrapper, aResponse);

and this eventually results in an exception (listing below just the cocoon part):

com.sun.jersey.api.container.ContainerException: javax.mail.MessagingException: Missing start boundary at com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider.processForm(MultipartFormDispatchProvider.java:91)
....
at org.apache.cocoon.rest.jaxrs.container.CocoonJAXRSServlet.service(CocoonJAXRSServlet.java:60)
....
at org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:481) at org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:455) at org.apache.cocoon.servletservice.spring.ServletFactoryBean$ServiceInterceptor.invoke(ServletFactoryBean.java:245)
...
com.tribc.servlet.FileUploadFilter.doFilter(FileUploadFilter.java:70) (This is the aChain.doFilter(wrapper, aResponse);
...

Therefore, the request now never reaches the ImageResource.

I cannot really understand the exception. The javax.mail.MessagingException is puzzling. I have to assume that in [2] something is not entirely correct, as the exception only occurs whenever the filter is employed. I do not see it. As said, the parsing appears to work just fine. Hopefully one of you has a clue.

Thanks,
André



[1] http://commons.apache.org/fileupload/faq.html#empty-parse
[2] http://www.javapractices.com/topic/TopicAction.do?Id=221
[3] http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileItem.html

--
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: [email protected]
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
StruBioCat                   | WWW: www.strubiocat.oulu.fi
Triacle Biocomputing         | WWW: www.triacle-bc.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to