Class MultipartStreamParser

java.lang.Object
jodd.http.upload.MultipartStreamParser

public class MultipartStreamParser extends Object
Generic, serlvets-free multipart request input stream parser.
  • Field Details

  • Constructor Details

    • MultipartStreamParser

      public MultipartStreamParser()
    • MultipartStreamParser

      public MultipartStreamParser(FileUploadFactory fileUploadFactory)
  • Method Details

    • setParsed

      protected void setParsed() throws IOException
      Sets the loaded flag that indicates that input stream is loaded and parsed. Throws an exception if stream already loaded.
      Throws:
      IOException
    • isParsed

      public boolean isParsed()
      Returns true if multi-part request is already loaded.
    • putFile

      protected void putFile(String name, FileUpload value)
    • putParameters

      protected void putParameters(String name, String[] values)
    • putParameter

      protected void putParameter(String name, String value)
    • parseRequestStream

      public void parseRequestStream(InputStream inputStream, String encoding) throws IOException
      Extracts uploaded files and parameters from the request data.
      Throws:
      IOException
    • getParameter

      public String getParameter(String paramName)
      Returns single value of a parameter. If parameter name is used for more then one parameter, only the first one will be returned.
      Returns:
      parameter value, or null if not found
    • getParameterNames

      public Set<String> getParameterNames()
      Returns the names of the parameters contained in this request.
    • getParameterValues

      public String[] getParameterValues(String paramName)
      Returns all values all of the values the given request parameter has.
    • getFile

      public FileUpload getFile(String paramName)
      Returns uploaded file.
      Parameters:
      paramName - parameter name of the uploaded file
      Returns:
      uploaded file or null if parameter name not found
    • getFiles

      public FileUpload[] getFiles(String paramName)
      Returns all uploaded files the given request parameter has.
    • getFileParameterNames

      public Set<String> getFileParameterNames()
      Returns parameter names of all uploaded files.