Geronimo
  1. Geronimo
  2. GERONIMO-5291

Can not get multipart data sent from html form.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0-M1
    • Component/s: deployment
    • Security Level: public (Regular issues)
    • Labels:
      None
    • Environment:

      OS:win xp sp2
      Server:Geronimo 3.0 2010.05.06 build
      JDK:1.6

      Description

      I tried the file upload example.But it fails to output the content of the uploaded file.
      After debugging this example,I found that when using getPart() of HttpServletRequest ,then we expect to get multipart data sent from html form.
      Part p = ((HttpServletRequest) request).getPart("testFile");
      But actually the object p is null,the multipart data is not caught.

        Activity

        Hide
        Ivan added a comment -

        Personally, I do not see a special reason that multipart must be configured before using getPart/getParts. But the spec seems to require this ...

        Show
        Ivan added a comment - Personally, I do not see a special reason that multipart must be configured before using getPart/getParts. But the spec seems to require this ...
        Hide
        Ivan added a comment -

        I checked the spec for file uploading support in Servlet 3.0, please refer to the text 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.
        <---
        From my understanding, the two methods are expected to invoke in the Servlet, also, those two methods should be avaible when both the conditions are fullfilled :
        a. multipart/form-data
        b. MultipartConfig is configued
        Seems that Tomcat strictly actions accroding to the spec. I also check the Jetty's implementation, it seems that Jetty is more tolerant, it might make the getPart/getParts avaible when the mutlpart form data is detected.
        Please correct me if I misundstand anything !

        Show
        Ivan added a comment - I checked the spec for file uploading support in Servlet 3.0, please refer to the text 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. <--- From my understanding, the two methods are expected to invoke in the Servlet, also, those two methods should be avaible when both the conditions are fullfilled : a. multipart/form-data b. MultipartConfig is configued Seems that Tomcat strictly actions accroding to the spec. I also check the Jetty's implementation, it seems that Jetty is more tolerant, it might make the getPart/getParts avaible when the mutlpart form data is detected. Please correct me if I misundstand anything !

          People

          • Assignee:
            Ivan
            Reporter:
            Lu Jiang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development