public class RequestImpl extends Object implements Request
Request that wraps around an
HttpServletRequest. This is not threadsafe, nor should it need to be (each Request is
handled by its own Thread).| Constructor and Description |
|---|
RequestImpl(HttpServletRequest request,
String applicationCharset,
TapestrySessionFactory sessionFactory) |
| Modifier and Type | Method and Description |
|---|---|
Object |
getAttribute(String name)
Returns the value of the named attribute as an
Object, or null if no attribute of the
given name exists. |
List<String> |
getAttributeNames()
Returns a sorted list of attribute names.
|
String |
getContextPath()
Returns the context path.
|
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 named header as a string, or null if not found.
|
List<String> |
getHeaderNames()
Returns the names of all headers in the request.
|
Locale |
getLocale()
Returns the locale of the client as determined from the request headers.
|
int |
getLocalPort()
Returns the Internet Protocol (IP) port number of the interface
on which the request was received.
|
String |
getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
|
String |
getParameter(String name)
Returns the query parameter value for the given name.
|
List<String> |
getParameterNames()
Returns a list of query parameter names, in alphabetical order.
|
String[] |
getParameters(String name)
Returns the parameter values for the given name.
|
String |
getPath()
Returns the path portion of the request, which starts with a "/" and contains everything up to the start of the
query parameters.
|
String |
getRemoteHost()
Returns the fully qualified name of the client
or the last proxy that sent the request.
|
String |
getServerName()
Returns the host name of the server to which the request was sent.
|
int |
getServerPort()
Returns the port number to which the request was sent.
|
Session |
getSession(boolean create)
Gets the
Session. |
boolean |
isRequestedSessionIdValid()
Checks whether the requested session ID is still valid.
|
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
|
boolean |
isSessionInvalidated()
Returns true if the request specified a session, and that session has been invalidated.
|
boolean |
isXHR()
Returns true if the request originated on the client using XmlHttpRequest (the core of any Ajax behavior).
|
void |
setAttribute(String name,
Object value)
Stores an attribute in this request.
|
public RequestImpl(HttpServletRequest request, String applicationCharset, TapestrySessionFactory sessionFactory)
public List<String> getParameterNames()
RequestgetParameterNames in interface Requestpublic List<String> getHeaderNames()
RequestgetHeaderNames in interface Requestpublic String getParameter(String name)
RequestgetParameter in interface Requestpublic String[] getParameters(String name)
RequestgetParameters in interface Requestpublic String getHeader(String name)
Requestpublic String getPath()
Requestpublic String getContextPath()
RequestgetContextPath in interface Requestpublic boolean isSessionInvalidated()
RequestisSessionInvalidated in interface Requestpublic Session getSession(boolean create)
RequestSession. If create is false and the session has not be created previously, returns null. Also,
if the session is invalidated and create is false, returns null. Invoking this method with true, when the session exists but has
been invalidated, will force the creation of a new session.getSession in interface Requestcreate - true to force the creation of the sessionpublic Locale getLocale()
Requestpublic long getDateHeader(String name)
Requestlong 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 Requestname - a String specifying the name of the headerlong 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 boolean isXHR()
Requestpublic boolean isSecure()
Requestpublic boolean isRequestedSessionIdValid()
RequestisRequestedSessionIdValid in interface Requestpublic Object getAttribute(String name)
RequestObject, or null if no attribute of the
given name exists. Because this method is a wrapper around
ServletRequest.getAttribute(String),
it is case sensitive (unlike most of Tapestry).getAttribute in interface Requestname - a String specifying the name of the attributeObject containing the value of the attribute, or null if the attribute does
not existpublic List<String> getAttributeNames()
RequestgetAttributeNames in interface Requestpublic void setAttribute(String name, Object value)
RequestsetAttribute in interface Requestname - a String specifying the name of the attributevalue - the Object to be stored, or null to remove the attributepublic String getMethod()
Requestpublic String getServerName()
RequestHost header, if any, or the resolved server name, or the server IP address.getServerName in interface Requestpublic int getLocalPort()
RequestgetLocalPort in interface Requestpublic int getServerPort()
RequestHost header, if any, or the server port where the
client connection
was accepted on.getServerPort in interface Requestpublic String getRemoteHost()
RequestgetRemoteHost in interface RequestString containing the fully
qualified name of the client5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.