tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan <>
Subject getPart()/getParts() invocation in the filter ?
Date Thu, 13 May 2010 02:00:10 GMT
    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
     request is annotated using the @MultipartConfig as defined in Section
     "@MultipartConfig" on page 8-64, the HttpServletRequest can make
     the various parts of the multipart request via the following methods
    ■ public Collection<Part> getParts()
    ■ public Part getPart(String name).
     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
     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 !

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message