Class MultipartRequestWrapper

All Implemented Interfaces:
HttpServletRequest, ServletRequest

public class MultipartRequestWrapper extends HttpServletRequestWrapper

This class functions as a wrapper around HttpServletRequest to provide working getParameter methods for multipart requests.

  • Field Details

    • parameters

      protected Map<String,String[]> parameters

      The parameters for this multipart request

  • Constructor Details

  • Method Details

    • setParameter

      public void setParameter(String name, String value)

      Sets a parameter for this request. The parameter is actually separate from the request parameters, but calling on the getParameter() methods of this class will work as if they weren't.

    • getParameter

      public String getParameter(String name)

      Attempts to get a parameter for this request. It first looks in the underlying HttpServletRequest object for the parameter, and if that doesn't exist it looks for the parameters retrieved from the multipart request

      Specified by:
      getParameter in interface ServletRequest
      Overrides:
      getParameter in class ServletRequestWrapper
    • getParameterNames

      public Enumeration<String> getParameterNames()

      Returns the names of the parameters for this request. The enumeration consists of the normal request parameter names plus the parameters read from the multipart request

      Specified by:
      getParameterNames in interface ServletRequest
      Overrides:
      getParameterNames in class ServletRequestWrapper
    • getParameterValues

      public String[] getParameterValues(String name)

      Returns the values of a parameter in this request. It first looks in the underlying HttpServletRequest object for the parameter, and if that doesn't exist it looks for the parameter retrieved from the multipart request.

      Specified by:
      getParameterValues in interface ServletRequest
      Overrides:
      getParameterValues in class ServletRequestWrapper
    • getParameterMap

      public Map<String,String[]> getParameterMap()

      Combines the parameters stored here with those in the underlying request. If paramater values in the underlying request take precedence over those stored here.

      Specified by:
      getParameterMap in interface ServletRequest
      Overrides:
      getParameterMap in class ServletRequestWrapper