com.isomorphic.servlet
Class ISCHttpServletRequest
java.lang.Object
|
+--javax.servlet.ServletRequestWrapper
|
+--javax.servlet.http.HttpServletRequestWrapper
|
+--com.isomorphic.servlet.ISCHttpServletRequest
- All Implemented Interfaces:
- javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest
- public class ISCHttpServletRequest
- extends javax.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 |
ISCHttpServletRequest(javax.servlet.http.HttpServletRequest request)
ISCHttpServletRequest constructor. |
Method Summary |
javax.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. |
ISCFileItem |
getUploadedFile(java.lang.String fieldName)
Retrieves an UploadedFile object (which contains the contentType and binary stream for the
uploaded file) for a given field name. |
boolean |
isMultipart()
Returns true if the request's mimeType is multipart/form-data. |
ISCHttpServletRequest
public ISCHttpServletRequest(javax.servlet.http.HttpServletRequest request)
throws java.lang.Exception
ISCHttpServletRequest
constructor. Instantiating this class does not cause the
parsing of the request object - that is done lazily in getUploadedFile().
getHttpServletRequest
public javax.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(java.lang.String fieldName)
throws java.lang.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.