Class MultipartRequest

java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
com.jalios.jcms.upload.MultipartRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest, org.apache.commons.fileupload.ProgressListener

public class MultipartRequest extends javax.servlet.http.HttpServletRequestWrapper implements org.apache.commons.fileupload.ProgressListener
HttpServletRequest Wrapper decoding multipart request and displaying MULTIPART_UPLOAD instead in file fields. The method getFileUploadStatus() may be called by AJAX request to follow upload status
Since:
jcms-5.7.0
Author:
Jean-Philippe Encausse
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from interface javax.servlet.http.HttpServletRequest

    BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
  • Constructor Summary

    Constructors
    Constructor
    Description
    MultipartRequest(javax.servlet.http.HttpServletRequest request, File directory, int sizeThreshold, long sizeMax, long countMax, boolean cacheMultipart)
    Wrap request for multipart handling.
  • Method Summary

    Modifier and Type
    Method
    Description
    javax.servlet.ServletInputStream
     
    javax.servlet.http.HttpServletRequest
     
     
     
     
     
    void
    setParameter(String key, String value)
     
    void
    setParameter(String key, String[] values)
     
    void
    update(long pBytesRead, long pContentLength, int pItems)
     

    Methods inherited from class javax.servlet.http.HttpServletRequestWrapper

    authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade

    Methods inherited from class javax.servlet.ServletRequestWrapper

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface javax.servlet.ServletRequest

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
  • Field Details

  • Constructor Details

    • MultipartRequest

      public MultipartRequest(javax.servlet.http.HttpServletRequest request, File directory, int sizeThreshold, long sizeMax, long countMax, boolean cacheMultipart) throws UnsupportedEncodingException, org.apache.commons.fileupload.FileUploadException
      Wrap request for multipart handling.
      Parameters:
      request - the HttpServletRequest to be handled as MultipartRequest
      directory - The data repository, which is the directory in which files will be created, should the item size exceed the threshold.
      sizeThreshold - The threshold, in bytes, below which items will be retained in memory and above which they will be stored as a file.
      sizeMax - The maximum allowed size of a single uploaded file.
      countMax - The maximum number of files allowed in a single request.
      cacheMultipart - true to use a CachedServletRequest/ CachedServletInputStream, false to directly use specified request
      Throws:
      UnsupportedEncodingException
      org.apache.commons.fileupload.FileUploadException
      Since:
      10.0.7 / JCMS-9840
  • Method Details

    • update

      public void update(long pBytesRead, long pContentLength, int pItems)
      Specified by:
      update in interface org.apache.commons.fileupload.ProgressListener
    • getMultipartServletRequest

      public javax.servlet.http.HttpServletRequest getMultipartServletRequest()
    • setParameter

      public void setParameter(String key, String value)
    • setParameter

      public void setParameter(String key, String[] values)
    • getInputStream

      public javax.servlet.ServletInputStream getInputStream() throws IOException
      Specified by:
      getInputStream in interface javax.servlet.ServletRequest
      Overrides:
      getInputStream in class javax.servlet.ServletRequestWrapper
      Throws:
      IOException
      See Also:
      • ServletRequest.getInputStream()
    • getParameter

      public String getParameter(String name)
      Specified by:
      getParameter in interface javax.servlet.ServletRequest
      Overrides:
      getParameter in class javax.servlet.ServletRequestWrapper
      See Also:
      • ServletRequest.getParameter(String)
    • getParameterMap

      public Map<String,String[]> getParameterMap()
      Specified by:
      getParameterMap in interface javax.servlet.ServletRequest
      Overrides:
      getParameterMap in class javax.servlet.ServletRequestWrapper
      See Also:
      • ServletRequest.getParameterMap()
    • getParameterNames

      public Enumeration<String> getParameterNames()
      Specified by:
      getParameterNames in interface javax.servlet.ServletRequest
      Overrides:
      getParameterNames in class javax.servlet.ServletRequestWrapper
      See Also:
      • ServletRequest.getParameterNames()
    • getParameterValues

      public String[] getParameterValues(String name)
      Specified by:
      getParameterValues in interface javax.servlet.ServletRequest
      Overrides:
      getParameterValues in class javax.servlet.ServletRequestWrapper
      See Also:
      • ServletRequest.getParameterValues(String)