Class ISCHttpServletRequest

java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
com.isomorphic.servlet.ISCHttpServletRequest
All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest

public class ISCHttpServletRequest extends jakarta.servlet.http.HttpServletRequestWrapper
This is a thin wrapper on the standard HttpServletRequest servlet API class. This wrapper adds file upload handling to the standard servlet API. Except for the file upload handling APIs, all methods are proxied through to the current instance of HttpServletRequest.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ISCHttpServletRequest(jakarta.servlet.http.HttpServletRequest request)
    ISCHttpServletRequest constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.servlet.http.HttpServletRequest
    This method returns the actual container-provided HttpServletRequest object as it was passed to the entry point servlet for this request.
    Retrieves an UploadedFile object (which contains the contentType and binary stream for the uploaded file) for a given field name.
    boolean
    Returns true if the request's mimeType is multipart/form-data.
  • Constructor Details

    • ISCHttpServletRequest

      public ISCHttpServletRequest(jakarta.servlet.http.HttpServletRequest request) throws Exception
      ISCHttpServletRequest constructor. Instantiating this class does not cause the parsing of the request object - that is done lazily in getUploadedFile().
      Throws:
      Exception
  • Method Details

    • getHttpServletRequest

      public jakarta.servlet.http.HttpServletRequest getHttpServletRequest()
      This method returns the actual container-provided HttpServletRequest object as it was passed to the entry point servlet for this request. ISCHttpServletRequest proxies all method calls (except the file upload logic) to the instance returned by this method.
      Returns:
      the HttpServletRequest instance passed to the entry point servlet for this request.
    • isMultipart

      public boolean isMultipart()
      Returns true if the request's mimeType is multipart/form-data. Calling this method does not cause the request object to be parsed.
      Returns:
      true if the contentType of this request is multipart/form-data, false otherwise
    • getUploadedFile

      public ISCFileItem getUploadedFile(String fieldName) throws Exception
      Retrieves an UploadedFile object (which contains the contentType and binary stream for the uploaded file) for a given field name. The field name is the same as the name of the form field that provided the upload file selector.

      Note: calling this method forces the parsing of the request. Once this method is called, you will not be able to call getInputStream() or getReader() on the HttpServletRequest object. Doing so will result in an IllegalStateException as per the servlet spec.

      Returns:
      the UploadedFile for the named field or null if the request is not multipart or no file was provided for the given fieldName.
      Throws:
      Exception