Package org.apache.struts2.dispatcher.multipart

# Class JakartaStreamMultiPartRequest

java.lang.Object
org.apache.struts2.dispatcher.multipart.AbstractMultiPartRequest
org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest

All Implemented Interfaces:
  `MultiPartRequest`

public class JakartaStreamMultiPartRequest extends AbstractMultiPartRequest
Multi-part form data request adapter for Jakarta Commons FileUpload package that leverages the streaming API rather than the traditional non-streaming API.

For more details see WW-3025

Since:
  2.3.18

- ## Field Summary

  ### Fields inherited from class org.apache.struts2.dispatcher.multipart.AbstractMultiPartRequest

  `BUFFER_SIZE, bufferSize, defaultEncoding, errors, maxFiles, maxFileSize, maxSize, maxSizeOfFiles, maxStringLength, parameters, STRUTS_MESSAGES_UPLOAD_ERROR_PARAMETER_TOO_LONG_KEY, uploadedFiles`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JakartaStreamMultiPartRequest()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Long`
  `actualSizeOfUploadedFiles()`
  `protected org.apache.commons.fileupload2.jakarta.servlet6.JakartaServletDiskFileUpload`
  `createJakartaFileUpload(Charset charset, Path location)`
  Creates an instance of `JakartaServletDiskFileUpload` used by the parser to extract uploaded files
  `protected File`
  `createTemporaryFile(String fileName, Path location)`
  Creates a temporary file based on the given filename and location.
  `protected void`
  `createUploadedFile(org.apache.commons.fileupload2.core.FileItemInput fileItemInput, File file)`
  Create `UploadedFile` abstraction over uploaded file
  `protected void`
  `processFileItemAsFileField(org.apache.commons.fileupload2.core.FileItemInput fileItemInput, Path location)`
  Processes the FileItem as a file field.
  `protected void`
  `processFileItemAsFormField(org.apache.commons.fileupload2.core.FileItemInput fileItemInput)`
  Processes the FileItem as a normal form field.
  `protected void`
  `processUpload(jakarta.servlet.http.HttpServletRequest request, String saveDir)`
  Processes the upload.
  `protected void`
  `streamFileToDisk(org.apache.commons.fileupload2.core.FileItemInput fileItemInput, File file)`
  Streams the file upload stream to the specified file.

  ### Methods inherited from class org.apache.struts2.dispatcher.multipart.AbstractMultiPartRequest

  `buildErrorMessage, cleanUp, exceedsMaxStringLength, getCanonicalName, getContentType, getErrors, getFile, getFileNames, getFileParameterNames, getFilesystemName, getParameter, getParameterNames, getParameterValues, parse, prepareServletFileUpload, readCharsetEncoding, sanitizeNewlines, setBufferSize, setDefaultEncoding, setMaxFiles, setMaxFileSize, setMaxSize, setMaxSizeOfFiles, setMaxStringLength`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### JakartaStreamMultiPartRequest

    public JakartaStreamMultiPartRequest()

- ## Method Details

  - ### processUpload

    protected void processUpload(jakarta.servlet.http.HttpServletRequest request, String saveDir) throws IOException
    Processes the upload.
    Specified by:
      `processUpload` in class `AbstractMultiPartRequest`
    Parameters:
      `request` - the servlet request
      `saveDir` - location of the save dir
    Throws:
      `IOException`

  - ### createJakartaFileUpload

    protected org.apache.commons.fileupload2.jakarta.servlet6.JakartaServletDiskFileUpload createJakartaFileUpload(Charset charset, Path location)
    Description copied from class: `AbstractMultiPartRequest`
    Creates an instance of `JakartaServletDiskFileUpload` used by the parser to extract uploaded files
    Specified by:
      `createJakartaFileUpload` in class `AbstractMultiPartRequest`
    Parameters:
      `charset` - used charset from incoming request
      `location` - a temporary folder to store uploaded files (not always needed)

  - ### processFileItemAsFormField

    protected void processFileItemAsFormField(org.apache.commons.fileupload2.core.FileItemInput fileItemInput) throws IOException
    Processes the FileItem as a normal form field.
    Parameters:
      `fileItemInput` - a form field item input
    Throws:
      `IOException`

  - ### actualSizeOfUploadedFiles

    protected Long actualSizeOfUploadedFiles()
    Returns:
      actual size of already uploaded files

  - ### processFileItemAsFileField

    protected void processFileItemAsFileField(org.apache.commons.fileupload2.core.FileItemInput fileItemInput, Path location) throws IOException
    Processes the FileItem as a file field.
    Parameters:
      `fileItemInput` - file item representing upload file
      `location` - location
    Throws:
      `IOException`

  - ### createTemporaryFile

    protected File createTemporaryFile(String fileName, Path location)
    Creates a temporary file based on the given filename and location.
    Parameters:
      `fileName` - file name
      `location` - location
    Returns:
      a temporary file based on the given filename and location

  - ### streamFileToDisk

    protected void streamFileToDisk(org.apache.commons.fileupload2.core.FileItemInput fileItemInput, File file) throws IOException
    Streams the file upload stream to the specified file.
    Parameters:
      `fileItemInput` - file item input
      `file` - the file
    Throws:
      `IOException`

  - ### createUploadedFile

    protected void createUploadedFile(org.apache.commons.fileupload2.core.FileItemInput fileItemInput, File file)
    Create `UploadedFile` abstraction over uploaded file
    Parameters:
      `fileItemInput` - file item stream
      `file` - the file