|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.sling.commons.testing.sling.MockSlingHttpServletRequest
public class MockSlingHttpServletRequest
Mock request object. This does not do anything useful, it just returns the
constructor parameter secure
in the isSecure
method.
Field Summary | |
---|---|
static java.lang.String |
RESOURCE_TYPE
|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
---|---|
MockSlingHttpServletRequest(java.lang.String resourcePath,
java.lang.String selectors,
java.lang.String extension,
java.lang.String suffix,
java.lang.String queryString)
|
Method Summary | |
---|---|
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration<?> |
getAttributeNames()
|
java.lang.String |
getAuthType()
|
java.lang.String |
getCharacterEncoding()
|
int |
getContentLength()
|
java.lang.String |
getContentType()
|
java.lang.String |
getContextPath()
|
javax.servlet.http.Cookie |
getCookie(java.lang.String name)
Returns the named cookie from the HTTP request or null if
no such cookie exists in the request. |
javax.servlet.http.Cookie[] |
getCookies()
|
long |
getDateHeader(java.lang.String name)
|
java.lang.String |
getHeader(java.lang.String name)
|
java.util.Enumeration<?> |
getHeaderNames()
|
java.util.Enumeration<?> |
getHeaders(java.lang.String name)
|
javax.servlet.ServletInputStream |
getInputStream()
|
int |
getIntHeader(java.lang.String name)
|
java.lang.String |
getLocalAddr()
|
java.util.Locale |
getLocale()
|
java.util.Enumeration<?> |
getLocales()
|
java.lang.String |
getLocalName()
|
int |
getLocalPort()
|
java.lang.String |
getMethod()
|
java.lang.String |
getParameter(java.lang.String name)
|
java.util.Map<?,?> |
getParameterMap()
|
java.util.Enumeration<?> |
getParameterNames()
|
java.lang.String[] |
getParameterValues(java.lang.String name)
|
java.lang.String |
getPathInfo()
|
java.lang.String |
getPathTranslated()
|
java.lang.String |
getProtocol()
|
java.lang.String |
getQueryString()
|
java.io.BufferedReader |
getReader()
|
java.lang.String |
getRealPath(java.lang.String path)
|
java.lang.String |
getRemoteAddr()
|
java.lang.String |
getRemoteHost()
|
int |
getRemotePort()
|
java.lang.String |
getRemoteUser()
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(Resource resource)
Same as SlingHttpServletRequest.getRequestDispatcher(Resource,RequestDispatcherOptions)
but using empty options. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(Resource resource,
RequestDispatcherOptions options)
Returns a RequestDispatcher object that acts as a wrapper
for the resource located at the given resource. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path,
RequestDispatcherOptions options)
Returns a RequestDispatcher object that acts as a wrapper
for the resource located at the given path. |
java.lang.String |
getRequestedSessionId()
|
RequestParameter |
getRequestParameter(java.lang.String name)
Returns the value of a request parameter as a RequestParameter ,
or null if the parameter does not exist. |
RequestParameterMap |
getRequestParameterMap()
Returns a Map of the parameters of this request. |
RequestParameter[] |
getRequestParameters(java.lang.String name)
Returns an array of RequestParameter objects containing all of
the values the given request parameter has, or null if the
parameter does not exist. |
RequestPathInfo |
getRequestPathInfo()
Returns the RequestPathInfo pertaining to this request. |
RequestProgressTracker |
getRequestProgressTracker()
Returns the RequestProgressTracker of this request. |
java.lang.String |
getRequestURI()
|
java.lang.StringBuffer |
getRequestURL()
|
Resource |
getResource()
Returns the Resource object on whose behalf the servlet acts. |
java.util.ResourceBundle |
getResourceBundle(java.util.Locale locale)
Returns the resource bundle for the given locale. |
java.util.ResourceBundle |
getResourceBundle(java.lang.String baseName,
java.util.Locale locale)
Returns the resource bundle of the given base name for the given locale. |
ResourceResolver |
getResourceResolver()
Returns the ResourceResolver which resolved the
resource of this request. |
java.lang.String |
getResponseContentType()
Returns the framework preferred content type for the response. |
java.util.Enumeration<java.lang.String> |
getResponseContentTypes()
Gets a list of content types which the framework accepts for the response. |
java.lang.String |
getScheme()
|
java.lang.String |
getServerName()
|
int |
getServerPort()
|
java.lang.String |
getServletPath()
|
javax.servlet.http.HttpSession |
getSession()
|
javax.servlet.http.HttpSession |
getSession(boolean create)
|
java.security.Principal |
getUserPrincipal()
|
boolean |
isRequestedSessionIdFromCookie()
|
boolean |
isRequestedSessionIdFromUrl()
|
boolean |
isRequestedSessionIdFromURL()
|
boolean |
isRequestedSessionIdValid()
|
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
|
void |
removeAttribute(java.lang.String name)
|
void |
setAttribute(java.lang.String name,
java.lang.Object o)
|
void |
setCharacterEncoding(java.lang.String env)
|
void |
setMethod(java.lang.String method)
|
void |
setResource(Resource resource)
|
void |
setResourceResolver(MockResourceResolver resolver)
|
void |
setSecure(boolean secure)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String RESOURCE_TYPE
Constructor Detail |
---|
public MockSlingHttpServletRequest(java.lang.String resourcePath, java.lang.String selectors, java.lang.String extension, java.lang.String suffix, java.lang.String queryString)
Method Detail |
---|
public void setResourceResolver(MockResourceResolver resolver)
public void setResource(Resource resource)
public void setSecure(boolean secure)
public void setMethod(java.lang.String method)
public javax.servlet.http.Cookie getCookie(java.lang.String name)
SlingHttpServletRequest
null
if
no such cookie exists in the request.
getCookie
in interface SlingHttpServletRequest
name
- The name of the cookie to return.
null
if no such cookie exists.public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path, RequestDispatcherOptions options)
SlingHttpServletRequest
RequestDispatcher
object that acts as a wrapper
for the resource located at the given path. A
RequestDispatcher
object can be used to include the
resource in a response.
Returns null
if a RequestDispatcher
cannot
be returned for any reason.
getRequestDispatcher
in interface SlingHttpServletRequest
path
- a String
specifying the pathname to the
resource. If it is relative, it must be relative against the
current servlet.options
- influence the rendering of the included Resource
RequestDispatcher
object that acts as a wrapper
for the resource
or null
if an
error occurs preparing the dispatcher.public javax.servlet.RequestDispatcher getRequestDispatcher(Resource resource, RequestDispatcherOptions options)
SlingHttpServletRequest
RequestDispatcher
object that acts as a wrapper
for the resource located at the given resource. A
RequestDispatcher
object can be used to include the
resource in a response.
Returns null
if a RequestDispatcher
cannot
be returned for any reason.
getRequestDispatcher
in interface SlingHttpServletRequest
resource
- The Resource
instance whose response content may
be included by the returned dispatcher.options
- influence the rendering of the included Resource
RequestDispatcher
object that acts as a wrapper
for the resource
or null
if an
error occurs preparing the dispatcher.public javax.servlet.RequestDispatcher getRequestDispatcher(Resource resource)
SlingHttpServletRequest
SlingHttpServletRequest.getRequestDispatcher(Resource,RequestDispatcherOptions)
but using empty options.
getRequestDispatcher
in interface SlingHttpServletRequest
public RequestParameter getRequestParameter(java.lang.String name)
SlingHttpServletRequest
RequestParameter
,
or null
if the parameter does not exist.
This method should only be used if the parameter has only one value. If
the parameter might have more than one value, use
SlingHttpServletRequest.getRequestParameters(String)
.
If this method is used with a multivalued parameter, the value returned
is equal to the first value in the array returned by
getRequestParameters
.
This method is a shortcut for
getRequestParameterMap().getValue(String)
.
getRequestParameter
in interface SlingHttpServletRequest
name
- a String
specifying the name of the parameter
RequestParameter
representing the single value of the
parameterSlingHttpServletRequest.getRequestParameters(String)
,
RequestParameterMap.getValue(String)
public RequestParameterMap getRequestParameterMap()
SlingHttpServletRequest
Map
of the parameters of this request.
The values in the returned Map
are from type
RequestParameter
array (RequestParameter[]
).
If no parameters exist this method returns an empty Map
.
getRequestParameterMap
in interface SlingHttpServletRequest
Map
containing parameter names as
keys and parameter values as map values, or an empty
Map
if no parameters exist. The keys in the
parameter map are of type String. The values in the parameter map
are of type RequestParameter
array (RequestParameter[]
).public RequestParameter[] getRequestParameters(java.lang.String name)
SlingHttpServletRequest
RequestParameter
objects containing all of
the values the given request parameter has, or null
if the
parameter does not exist.
If the parameter has a single value, the array has a length of 1.
This method is a shortcut for
getRequestParameterMap().getValues(String)
.
getRequestParameters
in interface SlingHttpServletRequest
name
- a String
containing the name of the parameter
the value of which is requested
RequestParameter
objects containing the
parameter values.SlingHttpServletRequest.getRequestParameter(String)
,
RequestParameterMap.getValues(String)
public RequestPathInfo getRequestPathInfo()
SlingHttpServletRequest
RequestPathInfo
pertaining to this request.
getRequestPathInfo
in interface SlingHttpServletRequest
public RequestProgressTracker getRequestProgressTracker()
SlingHttpServletRequest
RequestProgressTracker
of this request.
getRequestProgressTracker
in interface SlingHttpServletRequest
public Resource getResource()
SlingHttpServletRequest
Resource
object on whose behalf the servlet acts.
getResource
in interface SlingHttpServletRequest
Resource
object of this request.public java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
SlingHttpServletRequest
getResourceBundle
in interface SlingHttpServletRequest
locale
- the locale for which to retrieve the resource bundle. If
this is null
, the locale returned by
ServletRequest.getLocale()
is used to select the resource bundle.
public java.util.ResourceBundle getResourceBundle(java.lang.String baseName, java.util.Locale locale)
SlingHttpServletRequest
getResourceBundle
in interface SlingHttpServletRequest
baseName
- The base name of the resource bundle to returned. If this
parameter is null
, the same resource bundle
must be returned as if the SlingHttpServletRequest.getResourceBundle(Locale)
method is called.locale
- the locale for which to retrieve the resource bundle. If
this is null
, the locale returned by
ServletRequest.getLocale()
is used to select the resource bundle.
public ResourceResolver getResourceResolver()
SlingHttpServletRequest
ResourceResolver
which resolved the
resource
of this request.
getResourceResolver
in interface SlingHttpServletRequest
public java.lang.String getResponseContentType()
SlingHttpServletRequest
For included resources this method will returned the same string as
returned by the ServletResponse.getContentType()
without
the character set.
getResponseContentType
in interface SlingHttpServletRequest
public java.util.Enumeration<java.lang.String> getResponseContentTypes()
SlingHttpServletRequest
For included resources this method will returned an enumeration
containing a single entry which is the same string as returned by the
ServletResponse.getContentType()
without the character
set.
getResponseContentTypes
in interface SlingHttpServletRequest
public java.lang.String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
public long getDateHeader(java.lang.String name)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getHeader(java.lang.String name)
getHeader
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration<?> getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration<?> getHeaders(java.lang.String name)
getHeaders
in interface javax.servlet.http.HttpServletRequest
public int getIntHeader(java.lang.String name)
getIntHeader
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
public java.lang.StringBuffer getRequestURL()
getRequestURL
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.HttpSession getSession()
getSession
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.HttpSession getSession(boolean create)
getSession
in interface javax.servlet.http.HttpServletRequest
public java.security.Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
public boolean isUserInRole(java.lang.String role)
isUserInRole
in interface javax.servlet.http.HttpServletRequest
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.servlet.ServletRequest
public java.util.Enumeration<?> getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletRequest
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public javax.servlet.ServletInputStream getInputStream()
getInputStream
in interface javax.servlet.ServletRequest
public java.lang.String getLocalAddr()
getLocalAddr
in interface javax.servlet.ServletRequest
public java.lang.String getLocalName()
getLocalName
in interface javax.servlet.ServletRequest
public int getLocalPort()
getLocalPort
in interface javax.servlet.ServletRequest
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
public java.util.Enumeration<?> getLocales()
getLocales
in interface javax.servlet.ServletRequest
public java.lang.String getParameter(java.lang.String name)
getParameter
in interface javax.servlet.ServletRequest
public java.util.Map<?,?> getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
public java.util.Enumeration<?> getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues
in interface javax.servlet.ServletRequest
public java.lang.String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
public java.io.BufferedReader getReader()
getReader
in interface javax.servlet.ServletRequest
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public int getRemotePort()
getRemotePort
in interface javax.servlet.ServletRequest
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface javax.servlet.ServletRequest
public java.lang.String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public java.lang.String getServerName()
getServerName
in interface javax.servlet.ServletRequest
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletRequest
public void setAttribute(java.lang.String name, java.lang.Object o)
setAttribute
in interface javax.servlet.ServletRequest
public void setCharacterEncoding(java.lang.String env)
setCharacterEncoding
in interface javax.servlet.ServletRequest
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |