Package org.apache.tapestry5.services
Class DelegatingRequest
java.lang.Object
org.apache.tapestry5.services.DelegatingRequest
- All Implemented Interfaces:
Request
Class that wraps an Request, delegating all its methods.
- Since:
- 5.1.0.1
-
Field Summary
Fields inherited from interface org.apache.tapestry5.http.services.Request
REQUESTED_WITH_HEADER, X_FORWARDED_PROTO_HEADER -
Constructor Summary
ConstructorsConstructorDescriptionNo-arg constructor.DelegatingRequest(Request request) Constructor that receives a Request. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.Returns a sorted list of attribute names.Returns the context path.longgetDateHeader(String name) Returns the value of the specified request header as alongvalue that represents aDateobject.Returns the named header as a string, or null if not found.Returns the names of all headers in the request.Returns the locale of the client as determined from the request headers.intReturns the Internet Protocol (IP) port number of the interface on which the request was received.Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.getParameter(String name) Returns the query parameter value for the given name.Returns a list of query parameter names, in alphabetical order.String[]getParameters(String name) Returns the parameter values for the given name.getPath()Returns the path portion of the request, which starts with a "/" and contains everything up to the start of the query parameters.Returns the fully qualified name of the client or the last proxy that sent the request.Returns the host name of the server to which the request was sent.intReturns the port number to which the request was sent.getSession(boolean create) Gets theSession.booleanChecks whether the requested session ID is still valid.booleanisSecure()Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.booleanReturns true if the request specified a session, and that session has been invalidated.booleanisXHR()Returns true if the request originated on the client using XmlHttpRequest (the core of any Ajax behavior).voidsetAttribute(String name, Object value) Stores an attribute in this request.voidsetRequest(Request request) Sets the delegate request.
-
Constructor Details
-
DelegatingRequest
public DelegatingRequest()No-arg constructor. It should only be used for testing purposes. -
DelegatingRequest
Constructor that receives a Request.- Parameters:
request- aRequest. It cannot be null.
-
-
Method Details
-
setRequest
Sets the delegate request.- Parameters:
request- aRequest. It cannot be null.
-
getAttribute
Description copied from interface:RequestReturns the value of the named attribute as anObject, ornullif no attribute of the given name exists. Because this method is a wrapper aroundServletRequest.getAttribute(String), it is case sensitive (unlike most of Tapestry).- Specified by:
getAttributein interfaceRequest- Parameters:
name- aStringspecifying the name of the attribute- Returns:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
-
getAttributeNames
Description copied from interface:RequestReturns a sorted list of attribute names.- Specified by:
getAttributeNamesin interfaceRequest
-
getContextPath
Description copied from interface:RequestReturns the context path. This always starts with a "/" character and does not end with one, with the exception of servlets in the root context, which return the empty string.- Specified by:
getContextPathin interfaceRequest
-
getDateHeader
Description copied from interface:RequestReturns the value of the specified request header as alongvalue that represents aDateobject. Use this method with headers that contain dates, such asIf-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 anIllegalArgumentException.- Specified by:
getDateHeaderin interfaceRequest- Parameters:
name- aStringspecifying the name of the header- Returns:
- a
longvalue 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 reqest
-
getHeader
Description copied from interface:RequestReturns the named header as a string, or null if not found. -
getHeaderNames
Description copied from interface:RequestReturns the names of all headers in the request.- Specified by:
getHeaderNamesin interfaceRequest
-
getLocale
Description copied from interface:RequestReturns the locale of the client as determined from the request headers. -
getMethod
Description copied from interface:RequestReturns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. -
getParameter
Description copied from interface:RequestReturns the query parameter value for the given name. Returns null if no such parameter is in the request. For a multi-valued parameter, returns just the first value.- Specified by:
getParameterin interfaceRequest
-
getParameterNames
Description copied from interface:RequestReturns a list of query parameter names, in alphabetical order.- Specified by:
getParameterNamesin interfaceRequest
-
getParameters
Description copied from interface:RequestReturns the parameter values for the given name. Returns null if no such parameter is in the request.- Specified by:
getParametersin interfaceRequest
-
getPath
Description copied from interface:RequestReturns the path portion of the request, which starts with a "/" and contains everything up to the start of the query parameters. It doesn't include the context path. -
getServerName
Description copied from interface:RequestReturns the host name of the server to which the request was sent. It is the value of the part before ":" in theHostheader, if any, or the resolved server name, or the server IP address.- Specified by:
getServerNamein interfaceRequest- Returns:
- the name of the server
-
getSession
Description copied from interface:RequestGets theSession. 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.- Specified by:
getSessionin interfaceRequest- Parameters:
create- true to force the creation of the session- Returns:
- the session (or null if create is false the session has not been previously created)
-
isRequestedSessionIdValid
Description copied from interface:RequestChecks whether the requested session ID is still valid.- Specified by:
isRequestedSessionIdValidin interfaceRequest- Returns:
- true if the request included a session id that is still active, false if the included session id has expired
-
isSecure
Description copied from interface:RequestReturns a boolean indicating whether this request was made using a secure channel, such as HTTPS. -
isXHR
Description copied from interface:RequestReturns true if the request originated on the client using XmlHttpRequest (the core of any Ajax behavior). Ajax action requests may behave quite differently than ordinary, page-based requests. This implementation currently depends on the client side setting a header: X-Requested-With=XMLHttpRequest (this is what Prototype does). -
setAttribute
Description copied from interface:RequestStores an attribute in this request. Attributes are reset between requests (and remember that in Tapestry, there is usually two requests per operation: the action request that redirects to a render request).- Specified by:
setAttributein interfaceRequest- Parameters:
name- aStringspecifying the name of the attributevalue- theObjectto be stored, or null to remove the attribute
-
getLocalPort
Description copied from interface:RequestReturns the Internet Protocol (IP) port number of the interface on which the request was received.- Specified by:
getLocalPortin interfaceRequest- Returns:
- an integer specifying the port number
-
getServerPort
Description copied from interface:RequestReturns the port number to which the request was sent. It is the value of the part after ":" in theHostheader, if any, or the server port where the client connection was accepted on.- Specified by:
getServerPortin interfaceRequest- Returns:
- an integer specifying the port number
-
getRemoteHost
Description copied from interface:RequestReturns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address.- Specified by:
getRemoteHostin interfaceRequest- Returns:
- a
Stringcontaining the fully qualified name of the client
-
isSessionInvalidated
Description copied from interface:RequestReturns true if the request specified a session, and that session has been invalidated.- Specified by:
isSessionInvalidatedin interfaceRequest- Returns:
- true if session was invalidated during this request
-