public class ServletWebRequest extends java.lang.Object implements WebRequest
HttpServletRequest to
WebRequest.| Constructor and Description |
|---|
ServletWebRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
| Modifier and Type | Method and Description |
|---|---|
void |
describeTo(DescriptionReceiver receiver)
Invoked to have the receiver describe itself (largely in terms of properties and values).
|
void |
forward(java.lang.String URL)
Redirects to the indicated URL.
|
java.lang.String |
getActivationPath()
Returns
HttpServletRequest.getServletPath(). |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the named object, or null if no attribute has been stored with the given name.
|
java.util.List |
getAttributeNames()
Returns a list of all known attributes in ascending alphabetical order.
|
java.lang.String |
getContextPath()
Returns the portion of the request URI that indicates the context of the request.
|
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specified request header.
|
java.util.Locale |
getLocale()
Returns the preferred locale to which content should be localized, as specified by the client
or by the container.
|
java.util.List |
getParameterNames()
Returns the names of all query parameters for this request.
|
java.lang.String |
getParameterValue(java.lang.String parameterName)
Returns a parameter value.
|
java.lang.String[] |
getParameterValues(java.lang.String parameterName)
Returns all parameter values for a particular parameter name.
|
java.lang.String |
getPathInfo()
Return any additional path info beyond the servlet path itself.
|
java.lang.String |
getRemoteUser()
Returns the login of the user making this request, if the user has been authenticated, or
null if the user has not been authenticated.
|
java.lang.String |
getRequestURI()
Returns the path portion of the request which triggered this request.
|
java.lang.String |
getScheme()
Returns the name of the scheme used to make this request.
|
java.lang.String |
getServerName()
Returns the host name of the server that received the request.
|
int |
getServerPort()
Returns the port number on which this request was received.
|
WebSession |
getSession(boolean create)
Returns the current
WebSessionassociated with this request, possibly creating it if
it does not already exist. |
java.security.Principal |
getUserPrincipal()
Returns a java.security.Principal object containing the name of the current authenticated
user.
|
boolean |
isUserInRole(java.lang.String role)
* Returns a boolean indicating whether the authenticated user is included in the specified
logical "role".
|
void |
setAttribute(java.lang.String name,
java.lang.Object attribute)
Updates the attribute, replacing (or removing) its value.
|
public ServletWebRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
public java.util.List getParameterNames()
WebRequestgetParameterNames in interface WebRequestpublic java.lang.String getParameterValue(java.lang.String parameterName)
WebRequestgetParameterValue in interface WebRequestparameterName - name of parameter to obtainWebRequest.getParameterValues(String)public java.lang.String[] getParameterValues(java.lang.String parameterName)
WebRequestThe caller should not modify the returned value.
getParameterValues in interface WebRequestparameterName - name of parameter to obtainWebRequest.getParameterValue(String)public java.lang.String getContextPath()
WebRequestgetContextPath in interface WebRequestpublic WebSession getSession(boolean create)
WebRequestWebSessionassociated with this request, possibly creating it if
it does not already exist. If create is false and the request has no valid session, this
method returns null. To make sure the session is properly maintained, you must call this
method before the response is committed.getSession in interface WebRequestcreate - if true, the session will be created and returned if it does not already existpublic java.util.List getAttributeNames()
AttributeHoldergetAttributeNames in interface AttributeHolderpublic java.lang.Object getAttribute(java.lang.String name)
AttributeHoldergetAttribute in interface AttributeHolderpublic void setAttribute(java.lang.String name, java.lang.Object attribute)
AttributeHolderWebSession
attribute in a clustered application).setAttribute in interface AttributeHoldername - the name of the attribute to updateattribute - the new value for the attribute, or null to delete the attribute entirely.public java.lang.String getScheme()
WebRequestgetScheme in interface WebRequestpublic java.lang.String getServerName()
WebRequestgetServerName in interface WebRequestIRequestDecoderpublic int getServerPort()
WebRequestgetServerPort in interface WebRequestpublic java.lang.String getRequestURI()
WebRequestNote: portlets do not know their request URI.
getRequestURI in interface WebRequestpublic void forward(java.lang.String URL)
WebRequestforward in interface WebRequestpublic java.lang.String getActivationPath()
HttpServletRequest.getServletPath().getActivationPath in interface WebRequestpublic java.lang.String getPathInfo()
WebRequestgetPathInfo in interface WebRequestpublic java.util.Locale getLocale()
WebRequestgetLocale in interface WebRequestpublic void describeTo(DescriptionReceiver receiver)
DescribabletoString().describeTo in interface Describablepublic java.lang.String getHeader(java.lang.String name)
WebRequestgetHeader in interface WebRequestname - the name of the header to retrievepublic java.lang.String getRemoteUser()
WebRequestgetRemoteUser in interface WebRequestpublic java.security.Principal getUserPrincipal()
WebRequestgetUserPrincipal in interface WebRequestpublic boolean isUserInRole(java.lang.String role)
WebRequestisUserInRole in interface WebRequestrole - a String specifying the name of the role