|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.web.ServletWebRequest
public class ServletWebRequest
Adapter from HttpServletRequest
to
WebRequest
.
Constructor Summary | |
---|---|
ServletWebRequest(HttpServletRequest request,
HttpServletResponse response)
|
Method Summary | |
---|---|
void |
describeTo(DescriptionReceiver receiver)
Invoked to have the receiver describe itself (largely in terms of properties and values). |
void |
forward(String URL)
Redirects to the indicated URL. |
String |
getActivationPath()
Returns HttpServletRequest.getServletPath() . |
Object |
getAttribute(String name)
Returns the named object, or null if no attribute has been stored with the given name. |
List |
getAttributeNames()
Returns a list of all known attributes in ascending alphabetical order. |
String |
getContextPath()
Returns the portion of the request URI that indicates the context of the request. |
long |
getDateHeader(String name)
Returns the value of the specified request header as a long value that represents a
Date object. |
String |
getHeader(String name)
Returns the value of the specified request header. |
int |
getIntHeader(String name)
Returns the value of the specified request header as an int . |
Locale |
getLocale()
Returns the preferred locale to which content should be localized, as specified by the client or by the container. |
List |
getParameterNames()
Returns the names of all query parameters for this request. |
String |
getParameterValue(String parameterName)
Returns a parameter value. |
String[] |
getParameterValues(String parameterName)
Returns all parameter values for a particular parameter name. |
String |
getPathInfo()
Return any additional path info beyond the servlet path itself. |
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. |
String |
getRequestURI()
Returns the path portion of the request which triggered this request. |
String |
getScheme()
Returns the name of the scheme used to make this request. |
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 WebSession associated with this request, possibly creating it if
it does not already exist. |
Principal |
getUserPrincipal()
Returns a java.security.Principal object containing the name of the current authenticated user. |
boolean |
isSecure()
Taken from HttpServletRequest . |
boolean |
isUserInRole(String role)
* Returns a boolean indicating whether the authenticated user is included in the specified logical "role". |
void |
setAttribute(String name,
Object attribute)
Updates the attribute, replacing (or removing) its value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServletWebRequest(HttpServletRequest request, HttpServletResponse response)
Method Detail |
---|
public List getParameterNames()
WebRequest
getParameterNames
in interface WebRequest
public String getParameterValue(String parameterName)
WebRequest
getParameterValue
in interface WebRequest
parameterName
- name of parameter to obtain
WebRequest.getParameterValues(String)
public String[] getParameterValues(String parameterName)
WebRequest
The caller should not modify the returned value.
getParameterValues
in interface WebRequest
parameterName
- name of parameter to obtain
WebRequest.getParameterValue(String)
public String getContextPath()
WebRequest
getContextPath
in interface WebRequest
public WebSession getSession(boolean create)
WebRequest
WebSession
associated 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 WebRequest
create
- if true, the session will be created and returned if it does not already exist
public List getAttributeNames()
AttributeHolder
getAttributeNames
in interface AttributeHolder
public Object getAttribute(String name)
AttributeHolder
getAttribute
in interface AttributeHolder
public void setAttribute(String name, Object attribute)
AttributeHolder
WebSession
attribute in a clustered application).
setAttribute
in interface AttributeHolder
name
- the name of the attribute to updateattribute
- the new value for the attribute, or null to delete the attribute entirely.public String getScheme()
WebRequest
getScheme
in interface WebRequest
public String getServerName()
WebRequest
getServerName
in interface WebRequest
IRequestDecoder
public int getServerPort()
WebRequest
getServerPort
in interface WebRequest
public String getRequestURI()
WebRequest
Note: portlets do not know their request URI.
getRequestURI
in interface WebRequest
public void forward(String URL)
WebRequest
forward
in interface WebRequest
URL
- The url to forward the request to.public String getActivationPath()
HttpServletRequest.getServletPath()
.
getActivationPath
in interface WebRequest
public String getPathInfo()
WebRequest
getPathInfo
in interface WebRequest
public Locale getLocale()
WebRequest
getLocale
in interface WebRequest
public void describeTo(DescriptionReceiver receiver)
Describable
toString()
.
describeTo
in interface Describable
public String getHeader(String name)
WebRequest
getHeader
in interface WebRequest
name
- the name of the header to retrieve
public long getDateHeader(String name)
WebRequest
long
value that represents a
Date
object. Use this method with
headers that contain dates, such as
If-Modified-Since
.
The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.
If the request did not have a header of the
specified name, this method returns -1. If the header
can't be converted to a date, the method throws
an IllegalArgumentException
.
getDateHeader
in interface WebRequest
name
- a String
specifying the
name of the header
long
value representing the
date specified in the header expressed as the number
of milliseconds since January 1, 1970 GMT, or -1 if
the named header was not included with the reqestpublic int getIntHeader(String name)
WebRequest
int
. If the request does not have a header
of the specified name, this method returns -1. If the
header cannot be converted to an integer, this method
throws a NumberFormatException
.
The header name is case insensitive.
getIntHeader
in interface WebRequest
name
- a String
specifying the name
of a request header
public String getRemoteUser()
WebRequest
getRemoteUser
in interface WebRequest
public Principal getUserPrincipal()
WebRequest
getUserPrincipal
in interface WebRequest
public boolean isUserInRole(String role)
WebRequest
isUserInRole
in interface WebRequest
role
- a String specifying the name of the role
public boolean isSecure()
WebRequest
HttpServletRequest
. Indicates if this request is coming in on
a SSL/secure connection.
isSecure
in interface WebRequest
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |