public class TestableRequestImpl extends Object implements TestableRequest
| Constructor and Description |
|---|
TestableRequestImpl(String contextPath) |
| Modifier and Type | Method and Description |
|---|---|
TestableRequest |
clear()
Clears the internal parameters map.
|
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 null.
|
List<String> |
getHeaderNames()
Returns an empty list.
|
Locale |
getLocale()
Returns the locale of the client as determined from the request headers.
|
int |
getLocalPort()
Always returns 80.
|
String |
getMethod()
Always returns POST, to keep the Form component happy.
|
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()
Always returns "localhost".
|
String |
getServerName()
Returns "localhost" which is sufficient for testing purposes.
|
int |
getServerPort()
Always returns 80.
|
Session |
getSession(boolean create)
Gets the
Session. |
boolean |
isRequestedSessionIdValid()
Always returns true.
|
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()
Always returns false.
|
TestableRequest |
loadParameter(String parameterName,
String parameterValue)
Loads a single parameter/value pair.
|
TestableRequest |
overrideParameter(String parameterName,
String parameterValue)
Overrides a parameter to the specific value, regardless of how the parameter was previously set.
|
void |
setAttribute(String name,
Object value)
Stores an attribute in this request.
|
void |
setEncoding(String requestEncoding) |
TestableRequest |
setLocale(Locale locale)
Sets the locale requested by "the browser".
|
TestableRequest |
setPath(String path)
Sets the path; the path should begin with a "/" character and contain everything from there to the start of query
parameters (if any).
|
@Inject public TestableRequestImpl(@Symbol(value="tapestry.context-path") String contextPath)
public TestableRequest clear()
TestableRequestclear in interface TestableRequestpublic TestableRequest setPath(String path)
TestableRequestsetPath in interface TestableRequestpublic TestableRequest setLocale(Locale locale)
TestableRequestsetLocale in interface TestableRequestpublic TestableRequest loadParameter(String parameterName, String parameterValue)
TestableRequestloadParameter in interface TestableRequestpublic TestableRequest overrideParameter(String parameterName, String parameterValue)
TestableRequestoverrideParameter in interface TestableRequestpublic 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 List<String> getHeaderNames()
getHeaderNames in interface Requestpublic Locale getLocale()
Requestpublic List<String> getParameterNames()
RequestgetParameterNames in interface Requestpublic String[] getParameters(String name)
RequestgetParameters in interface Requestpublic String getPath()
Requestpublic String getContextPath()
RequestgetContextPath in interface Requestpublic String getParameter(String name)
RequestgetParameter 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 void setEncoding(String requestEncoding)
public boolean isXHR()
public boolean isSecure()
Requestpublic boolean isRequestedSessionIdValid()
isRequestedSessionIdValid 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 getServerName()
getServerName in interface Requestpublic int getLocalPort()
getLocalPort in interface Requestpublic int getServerPort()
getServerPort in interface Requestpublic String getRemoteHost()
getRemoteHost in interface RequestString containing the fully
qualified name of the clientpublic boolean isSessionInvalidated()
RequestisSessionInvalidated in interface Request5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.