Hi,
While using the new features of getPart()/getParts() in the Servlet 3.0,
I found that those methods could not be invoked in filter.
After checking the spec, I found some words below :
--->
File upload
If a request is of type multipart/form-data and if the servlet handling
the
request is annotated using the @MultipartConfig as defined in Section
8.1.5,
"@MultipartConfig" on page 8-64, the HttpServletRequest can make
available
the various parts of the multipart request via the following methods
■ public Collection<Part> getParts()
■ public Part getPart(String name).
<---
--->
@MultipartConfig
This annotation, when specified on a Servlet, indicates that the
request it expects
is of type mime/multipart. The HttpServletRequest object of the
corresponding servlet MUST make available the mime attachments via the
getParts and getPart methods to iterate over the various mime
attachments.
<---
I am just wondering that :
a. Are those two methods available when the request is of
multipart/form-data type AND the servlet handlering it are configured with
MultipartConfig (annotation or configurations in web.xml) ? Why not make
those methods avaible once it detects the multipart/form-data type ?
b. Are those two methods only available in Servlet ? Seems that the
spec expects the users handle the uploading in Servlet ?
Thanks !
--
Ivan