Class MultipartRequest

All Implemented Interfaces:
HttpServletRequest, ServletRequest

public abstract class MultipartRequest extends HttpServletRequestWrapper
A wrapper of HttpServletRequest with additional methods to handle files and adding and removing parameters. Note that the createInstnace method must be called before any method of the original SerlvetRequest is called.
  • Constructor Details

  • Method Details

    • createInstance

      public static MultipartRequest createInstance(HttpServletRequest req)
      Create the MultipartRequest from the ServletRequest.
      Parameters:
      req - the original request
    • createInstanceFormURL

      public static MultipartRequest createInstanceFormURL(String url)
    • getFileNames

      public abstract Enumeration<String> getFileNames()
      Return the name of the parameters containing files as values.
    • getFile

      public abstract File getFile(String name)
      Return the locally stored temporary file associated with the parameter name given as argument.
      Parameters:
      name - the name of the parameter
    • getFileAndDigest

      public abstract Pair<File,byte[]> getFileAndDigest(String name)
      Return the locally stored temporary file associated with the parameter name given as argument and also the digest of that file.
      Parameters:
      name - the name of the parameter
    • getFiles

      public abstract List<File> getFiles(String name)
      Returns a list of locally stored temporary files associated with the parameter name given as argument.
      Parameters:
      name - the name of the parameter
    • getFilesAndDigests

      public abstract List<Pair<File,byte[]>> getFilesAndDigests(String name)
      Returns a list of locally stored temporary file associated with the parameter name given as argument and also their digest of that file.
      Parameters:
      name - the name of the parameter
    • getRemoteFileName

      public abstract String getRemoteFileName(String name)
      Return the remote file name of the file associated with the parameter name given as argument.
      Parameters:
      name - the name of the parameter
    • getRemoteFileName

      public abstract String getRemoteFileName(String name, File temporaryFile)
      Return the remote file name of the locally stored temporary file
      Parameters:
      temporaryFile - the local file
    • addParameter

      public abstract void addParameter(String name, String value)
      Add a parameter to the parameter list. If the parameter is already in the list the
      Parameters:
      name - the name of the parameter
      value - the value of the parameter
    • removeParameter

      public abstract void removeParameter(String name)
      Removes a parameter from the parameter list.
      Parameters:
      name - the name of the parameter
    • setPathInfo

      public abstract void setPathInfo(String path)
      Sets the path info.
      Parameters:
      path - the new path info
    • setQueryString

      public abstract void setQueryString(String params, boolean removeParams)
      Sets the paramters from a query-string.
      Parameters:
      params - the params in HTTP-GET syntax: param1=value1&param2=value2
      removeParams - if true for each parameter of the query string already existing values are removed.
    • getCookie

      public abstract Cookie getCookie(String id)
      Get cookie from id (don't iterate the array)
    • getParamsAsLink

      public abstract String getParamsAsLink() throws UnsupportedEncodingException
      This method builds a parameter string suitable for a GET request out of the parameter map.
      Returns:
      a String of the form param1=value1&param2=value2
      Throws:
      UnsupportedEncodingException
    • setLocale

      public abstract void setLocale(Locale l)