-
1. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
pablo53 May 24, 2011 12:36 PM (in response to pablo53)Sorry for the mistake in the title: request is not null, of course - it is request.getParts() which throws NullPointerException.
-
2. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
jaikiran May 24, 2011 2:06 PM (in response to pablo53)Post the entire exception stacktrace and also the code in MultipartFormDataRequest.
-
3. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
pablo53 May 25, 2011 5:12 AM (in response to jaikiran)Some research in Internet shed leight to the issue. JSF implementation servlets (Mojarra 2.0.x) are not decorated with @MultipartConfig annotation. Although GlassFish v3 cope with it assumig some default config, JBoss's jbossweb component - do not. JbossWeb-3.0.0.Beta8 patches the problem by hiding the exception - but this does not resolve the the core problem.
I have dug into the source code of JBossWeb and I have done the following change:
In "org.apache.catalina.connector.Request" class - method "protected void parseMultipart()":
I have changed
if (config == null) {
return;
}
to
if (config == null) {
config = new Multipart();
config.setLocation(null);
config.setFileSizeThreshold(Integer.MAX_VALUE);
config.setMaxFileSize(Long.MAX_VALUE);
config.setMaxRequestSize(Long.MAX_VALUE);
}
Having the above compiled ("jbossweb.jar") and dropped into the jboss, my appliaction started to work correctly.
The old version caused property parts to remain null, hence the following method:
public Part getPart(String name) throws IOException, ServletException {
if (parts == null) {
parseMultipart();
}
return parts.get(name);
}
after returning from parseMultipart() used to throw a NullPointException.
BTW: Beta8 patch did the "parts" to become en ampty map in this situation. This, of course, did not resolve the problem of getting out the parameters send by client browser in multipart/form-data format.
Regards,
P.S. Please be aware of the issue. GlassFish v3 and Tomcat 7.0.7 have already resolved this. IMHO some changes to the servlet specification should be introduced - v. 3.0 apparently lacks of something...
-
4. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
jaikiran May 25, 2011 5:35 AM (in response to pablo53)Moved to JBossWeb forum.
-
5. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
rmaucher May 25, 2011 7:40 AM (in response to pablo53)No multipart parsing will be done unless the associated Servlet has a multipart config, as per the specification.
-
6. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
pablo53 May 25, 2011 9:20 AM (in response to rmaucher)Yes, I understand the strict compliance with the specification.
Nevertheless, Glassfish's and Tomcat's developers found the specification somehow incomlete and put their own workaround for the issue. I think, JBoss AS users would really appreciate if You did a similar improvement. Apache Tomcat 7.0.7+, for instance, has a parameter to activate its workaround, so out-of-specs behavior is not default. GlassFish v.3 seems to workaround it by default.
Moreover, the specifiaction does not concern the filters in the area of multiparts. These are processed out of the target servlet, so no @MultipartConfig can be assigned a the moment.
Regards,
-
7. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
rmaucher May 25, 2011 11:42 AM (in response to pablo53)Yes, you already mentioned that earlier.
Update: The patch for JBWEB-187 is now committed in the web branch that is included in AS 6.
-
8. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
pablo53 May 26, 2011 4:20 AM (in response to rmaucher)JBWEB-187 fix the NPE problem. It still does not resolve the problem of retrieving data from parts (it return an empty map insetad of null map, which caused the NPE).
Regards,
-
9. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
erouan May 29, 2012 9:03 AM (in response to pablo53)Hello,
I have the same problem, but it works perfectly with Glassfish. I can well recover the Parts with the method getParts.
I wanted to know if you find a solution for JBoss?
Best regards,
Antoine ROUAZE
-
10. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
jfclere May 30, 2012 7:22 AM (in response to erouan)Add a @MultipartConfig in your servlet.
-
11. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
erouan May 31, 2012 2:59 PM (in response to jfclere)But without a Servlet is possible?
-
12. Re: Null is passed into doFilter() as the request parameter when the form's enctype="multipart/formdata"
jfclere Jun 5, 2012 3:45 AM (in response to erouan)You need a Sevlet probably what you are doing in the filter should be in a servlet.