[ http://mc4j.org/jira/browse/STS-235?page=comments#action_10403 ] 
            
Andreas Schulz commented on STS-235:
------------------------------------

Hi,

I tried to change the order but the result is the same. What I don't understand 
ist how one Filter can "consum" all request data. I took a look at the source 
code of Magnolias RequestWrapper:

public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
filterChain) throws IOException,
        ServletException {
        HttpServletRequest request = (HttpServletRequest) req;
        String type = null;
        String type1 = request.getHeader("Content-Type"); //$NON-NLS-1$
        String type2 = request.getContentType();
        if (type1 == null && type2 != null) {
            type = type2;
        }
        else if (type2 == null && type1 != null) {
            type = type1;
        }
        else if (type1 != null) {
            type = (type1.length() > type2.length() ? type1 : type2);
        }
        if ((type != null) && 
type.toLowerCase().startsWith("multipart/form-data")) { //$NON-NLS-1$
            parseParameters(request);
        }
        filterChain.doFilter(req, res);
    }

As you see, they copy the input parameter holding the ServletRequest and work 
with that copy. The request that is passed to the filterChain is the same they 
got. So I would think that nothing could be removed from the request and 
everything should work fine?

> multipart/form-data without file upload
> ---------------------------------------
>
>                 Key: STS-235
>                 URL: http://mc4j.org/jira/browse/STS-235
>             Project: Stripes
>          Issue Type: Bug
>    Affects Versions: Release 1.3.2
>            Reporter: Andreas Schulz
>         Assigned To: Tim Fennell
>
> If the StripesFilter receives a multipart/form-data request with no file 
> attached to it an IOException is thrown. But some applications like Magnolia 
> CMS use this enctype by default. So it crashes when using Stripes.
> Stacktrace:
> java.io.IOException: Corrupt form data: premature ending
>       at 
> com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:205)
>       at 
> com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
>       at 
> com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:173)
>       at 
> net.sourceforge.stripes.controller.StripesRequestWrapper.<init>(StripesRequestWrapper.java:109)
>       at 
> net.sourceforge.stripes.controller.StripesFilter.wrapRequest(StripesFilter.java:239)
>       at 
> net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:209)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>       at 
> info.magnolia.cms.filters.MagnoliaManagedFilter$CustomFilterChain.doFilter(MagnoliaManagedFilter.java:80)
>       at 
> info.magnolia.cms.filters.UnsetContextFilter.doFilter(UnsetContextFilter.java:44)
>       at 
> info.magnolia.cms.filters.MagnoliaManagedFilter$CustomFilterChain.doFilter(MagnoliaManagedFilter.java:84)
>       at 
> info.magnolia.cms.security.SecurityFilter.doFilter(SecurityFilter.java:96)
>       at 
> info.magnolia.cms.filters.MagnoliaManagedFilter$CustomFilterChain.doFilter(MagnoliaManagedFilter.java:84)
>       at 
> info.magnolia.cms.filters.MultipartRequestFilter.doFilter(MultipartRequestFilter.java:80)
>       at 
> info.magnolia.cms.filters.MagnoliaManagedFilter$CustomFilterChain.doFilter(MagnoliaManagedFilter.java:84)
>       at 
> info.magnolia.cms.filters.ContentTypeFilter.doFilter(ContentTypeFilter.java:66)
>       at 
> info.magnolia.cms.filters.MagnoliaManagedFilter$CustomFilterChain.doFilter(MagnoliaManagedFilter.java:84)
>       at 
> info.magnolia.cms.filters.MagnoliaManagedFilter.doFilter(MagnoliaManagedFilter.java:53)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>       at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>       at 
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>       at 
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>       at 
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>       at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>       at java.lang.Thread.run(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to