Package com.isomorphic.servlet
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
ConstructorsConstructorDescriptionISCHttpServletRequest
(jakarta.servlet.http.HttpServletRequest request) ISCHttpServletRequest
constructor. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.servlet.http.HttpServletRequest
This method returns the actual container-provided HttpServletRequest object as it was passed to the entry point servlet for this request.getUploadedFile
(String fieldName) 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
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
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
-