Spring Framework
  1. Spring Framework
  2. SPR-6594

HiddenHttpMethodFilter does not support multipart requests

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 3.0 GA
    • Fix Version/s: 3.0.2
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      HiddenHttpMethodFilter currently does not work when handling multipart request, as it relies on request.getParameter(..) which does not return the actual parameter's value in multipart requests.

      As I can understand that one might want to keep the filter independent of Spring MVC, I'd suggest to introduce a subclass that might lookup a configured multipartResolver from the application context and use it to obtain the parameters. As we deal with a filter this would require the resolver being declared inside the ApplicationContext loaded by the ContextLoaderListener. This feels a little ugly as one probably should tend to avoid web things inside this ApplicationContext.

      As the only existing implementation is CommonsMultipartResolver and this implementation uses a static method of ServletFileUpload a reasonable way might also be just to check the availablity of Commons Fileupload in the classpath and using this method to determine the multipart nature of the request then.

        Issue Links

          Activity

          Hide
          Jakobi added a comment -

          My problem seems to be a binding issue..so it's not a problem of HiddenHttpMethodFilter and CommonsMultipartResolver.

          Thanks anyway...

          Show
          Jakobi added a comment - My problem seems to be a binding issue..so it's not a problem of HiddenHttpMethodFilter and CommonsMultipartResolver. Thanks anyway...
          Hide
          Vitaly Polonetsky added a comment -

          The HiddenHttpMethodFilter is still causing problems with binding:
          ServletRequestDataBinder.bind() checks whether the request is of MultipartRequest type (line 106) and it fails because the MultipartRequest is wrapped into DefaultMultipartHttpServletRequest.

          Show
          Vitaly Polonetsky added a comment - The HiddenHttpMethodFilter is still causing problems with binding: ServletRequestDataBinder.bind() checks whether the request is of MultipartRequest type (line 106) and it fails because the MultipartRequest is wrapped into DefaultMultipartHttpServletRequest.
          Hide
          Vitaly Polonetsky added a comment -

          ... small correction:
          the MultipartRequest is wrapped into HttpMethodRequestWrapper !

          Show
          Vitaly Polonetsky added a comment - ... small correction: the MultipartRequest is wrapped into HttpMethodRequestWrapper !
          Hide
          Vitaly Polonetsky added a comment -

          My comments are related to SPR-7795 (should link between the two jiras)

          Show
          Vitaly Polonetsky added a comment - My comments are related to SPR-7795 (should link between the two jiras)
          Hide
          Juergen Hoeller added a comment -

          Well spotted, the solution for this original issue in Spring 3.0.2 addressed the problem for WebRequestDataBinder (as used by @MVC data binding) only. We'll use SPR-7795 for tracking an equivalent solution for ServletRequestDataBinder.

          Juergen

          Show
          Juergen Hoeller added a comment - Well spotted, the solution for this original issue in Spring 3.0.2 addressed the problem for WebRequestDataBinder (as used by @MVC data binding) only. We'll use SPR-7795 for tracking an equivalent solution for ServletRequestDataBinder. Juergen

            People

            • Assignee:
              Juergen Hoeller
              Reporter:
              Oliver Gierke
              Last updater:
              Trevor Marshall
            • Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 14 weeks ago