public class DummyRequest extends Object implements HttpRequest, javax.servlet.http.HttpServletRequest
Modifier and Type | Field and Description |
---|---|
protected boolean |
checkRestrictedResources
Whether or not access to resources in WEB-INF or META-INF needs to be
checked.
|
protected javax.servlet.FilterChain |
filterChain |
protected String |
pathInfo |
protected String |
queryString |
protected String |
servletPath |
protected Wrapper |
wrapper |
Constructor and Description |
---|
DummyRequest() |
Modifier and Type | Method and Description |
---|---|
void |
addAsyncListener(javax.servlet.AsyncListener listener) |
void |
addAsyncListener(javax.servlet.AsyncListener listener,
javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse) |
void |
addCookie(javax.servlet.http.Cookie cookie)
Add a Cookie to the set of Cookies associated with this Request.
|
void |
addHeader(String name,
String value)
Add a Header to the set of Headers associated with this Request.
|
void |
addLocale(Locale locale)
Add a Locale to the set of preferred Locales for this Request.
|
void |
addParameter(String name,
String[] values)
Add a parameter name and corresponding set of values to this Request.
|
boolean |
authenticate(javax.servlet.http.HttpServletResponse response) |
String |
changeSessionId()
Change the ID of the session that this request is associated with.
|
void |
clearCookies()
Clear the collection of Cookies associated with this Request.
|
void |
clearHeaders()
Clear the collection of Headers associated with this Request.
|
void |
clearLocales()
Clear the collection of Locales associated with this Request.
|
void |
clearParameters()
Clear the collection of parameters associated with this Request.
|
javax.servlet.ServletInputStream |
createInputStream()
Create and return a ServletInputStream to read the content
associated with this Request.
|
void |
disableAsyncSupport()
Disables async support on this request.
|
void |
finishRequest()
Perform whatever actions are required to flush and close the input
stream or reader, in a single operation.
|
String |
generateSessionId()
This object does not implement a session ID generator.
|
javax.servlet.AsyncContext |
getAsyncContext() |
long |
getAsyncTimeout() |
Object |
getAttribute(String name) |
Enumeration<String> |
getAttributeNames() |
String |
getAuthorization()
Return the authorization credentials sent with this request.
|
String |
getAuthType() |
String |
getCharacterEncoding() |
boolean |
getCheckRestrictedResources()
Return whether or not access to resources under WEB-INF or META-INF
needs to be checked.
|
Connector |
getConnector()
Return the Connector through which this Request was received.
|
int |
getContentLength() |
long |
getContentLengthLong() |
String |
getContentType() |
Context |
getContext()
Return the Context within which this Request is being processed.
|
String |
getContextPath() |
javax.servlet.http.Cookie[] |
getCookies() |
long |
getDateHeader(String name) |
String |
getDecodedRequestURI()
Get the decoded request URI.
|
javax.servlet.DispatcherType |
getDispatcherType() |
javax.servlet.FilterChain |
getFilterChain()
Get filter chain associated with the request.
|
String |
getHeader(String name) |
Enumeration<String> |
getHeaderNames() |
Enumeration<String> |
getHeaders(String name) |
Host |
getHost()
Return the Host within which this Request is being processed.
|
String |
getInfo()
Return descriptive information about this Request implementation and
the corresponding version number, in the format
<description>/<version> . |
javax.servlet.ServletInputStream |
getInputStream() |
int |
getIntHeader(String name) |
String |
getJrouteId()
Gets the jroute id of this request, which may have been
sent as a separate
JROUTE cookie or appended to the
session identifier encoded in the URI (if cookies have been disabled). |
String |
getLocalAddr() |
Locale |
getLocale() |
Enumeration<Locale> |
getLocales() |
String |
getLocalName() |
int |
getLocalPort() |
String |
getMethod() |
Object |
getNote(String name)
Return the object bound with the specified name to the internal notes
for this request, or
null if no such binding exists. |
Iterator<String> |
getNoteNames()
Return an Iterator containing the String names of all notes bindings
that exist for this request.
|
String |
getParameter(String name) |
Map<String,String[]> |
getParameterMap() |
Enumeration<String> |
getParameterNames() |
String[] |
getParameterValues(String name) |
javax.servlet.http.Part |
getPart(String name) |
Collection<javax.servlet.http.Part> |
getParts() |
String |
getPathInfo() |
String |
getPathTranslated() |
String |
getProtocol() |
String |
getQueryString() |
BufferedReader |
getReader() |
String |
getRealPath(String path) |
String |
getRemoteAddr() |
String |
getRemoteHost() |
int |
getRemotePort() |
String |
getRemoteUser() |
javax.servlet.ServletRequest |
getRequest()
Return the
ServletRequest for which this object
is the facade. |
javax.servlet.ServletRequest |
getRequest(boolean maskDefaultContextMapping)
Return the
ServletRequest for which this object
is the facade. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(String path) |
String |
getRequestedSessionId() |
org.glassfish.grizzly.http.util.DataChunk |
getRequestPathMB()
Get the request path.
|
String |
getRequestURI() |
StringBuffer |
getRequestURL() |
Response |
getResponse()
Return the Response with which this Request is associated.
|
String |
getScheme() |
String |
getServerName() |
int |
getServerPort() |
javax.servlet.ServletContext |
getServletContext()
Gets the servlet context to which this servlet request was last
dispatched.
|
String |
getServletPath() |
javax.servlet.http.HttpSession |
getSession() |
javax.servlet.http.HttpSession |
getSession(boolean create) |
Session |
getSessionInternal(boolean create)
Gets the session associated with this Request, creating one
if necessary and requested.
|
Socket |
getSocket()
Return the Socket (if any) through which this Request was received.
|
InputStream |
getStream()
Return the input stream associated with this Request.
|
Principal |
getUserPrincipal() |
Wrapper |
getWrapper()
Return the Wrapper within which this Request is being processed.
|
boolean |
isAsyncStarted() |
boolean |
isAsyncSupported() |
boolean |
isRequestedSessionIdFromCookie() |
boolean |
isRequestedSessionIdFromUrl() |
boolean |
isRequestedSessionIdFromURL() |
boolean |
isRequestedSessionIdValid() |
boolean |
isSecure() |
boolean |
isSetAsyncTimeoutCalled() |
boolean |
isUserInRole(String role) |
Session |
lockSession() |
void |
login(String username,
String password) |
void |
logout() |
void |
recycle()
Release all object references, and initialize instance variables, in
preparation for reuse of this object.
|
void |
removeAttribute(String name) |
void |
removeNote(String name)
Remove any object bound to the specified name in the internal notes
for this request.
|
void |
replayPayload(byte[] payloadByteArray) |
void |
setAsyncTimeout(long timeout) |
void |
setAttribute(String name,
Object value) |
void |
setAuthType(String authType)
Set the authentication type used for this request, if any; otherwise
set the type to
null . |
void |
setCharacterEncoding(String enc) |
void |
setCheckRestrictedResources(boolean check)
Set whether or not access to resources under WEB-INF or META-INF
needs to be checked.
|
void |
setConnector(Connector connector)
Set the Connector through which this Request was received.
|
void |
setContentLength(int length)
Set the content length associated with this Request.
|
void |
setContentType(String type)
Set the content type (and optionally the character encoding)
associated with this Request.
|
void |
setContext(Context context)
Set the Context within which this Request is being processed.
|
void |
setFilterChain(javax.servlet.FilterChain filterChain)
Set filter chain associated with the request.
|
void |
setHost(Host host)
Set the Host within which this Request is being processed.
|
void |
setMethod(String method)
Set the HTTP request method used for this Request.
|
void |
setNote(String name,
Object value)
Bind an object to a specified name in the internal notes associated
with this request, replacing any existing binding for this name.
|
void |
setPathInfo(String path)
Set the path information for this Request.
|
void |
setProtocol(String protocol)
Set the protocol name and version associated with this Request.
|
void |
setQueryString(String query)
Set the query string for this Request.
|
void |
setRemoteAddr(String remoteAddr)
Set the remote IP address associated with this Request.
|
void |
setRemoteHost(String remoteHost) |
void |
setRequestedSessionCookie(boolean flag)
Set a flag indicating whether or not the requested session ID for this
request came in through a cookie.
|
void |
setRequestedSessionCookiePath(String cookiePath)
Sets the requested session cookie path, see IT 7426
|
void |
setRequestedSessionId(String id)
Set the requested session ID for this request.
|
void |
setRequestedSessionURL(boolean flag)
Set a flag indicating whether or not the requested session ID for this
request came in through a URL.
|
void |
setRequestURI(String uri)
Set the unparsed request URI for this Request.
|
void |
setResponse(Response response)
Set the Response with which this Request is associated.
|
void |
setSecure(boolean secure)
Set the value to be returned by
isSecure()
for this Request. |
void |
setServerName(String name)
Set the name of the server (virtual host) to process this request.
|
void |
setServerPort(int port)
Set the port number of the server to process this request.
|
void |
setServletPath(String path)
Set the servlet path for this Request.
|
void |
setSocket(Socket socket)
Set the Socket (if any) through which this Request was received.
|
void |
setStream(InputStream input)
Set the input stream associated with this Request.
|
void |
setUserPrincipal(Principal principal)
Set the Principal who has been authenticated for this Request.
|
void |
setWrapper(Wrapper wrapper)
Set the Wrapper within which this Request is being processed.
|
javax.servlet.AsyncContext |
startAsync() |
javax.servlet.AsyncContext |
startAsync(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse) |
void |
unlockSession() |
<T extends javax.servlet.http.HttpUpgradeHandler> |
upgrade(Class<T> handlerClass) |
protected String queryString
protected String pathInfo
protected String servletPath
protected Wrapper wrapper
protected javax.servlet.FilterChain filterChain
protected boolean checkRestrictedResources
public String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.ServletRequest getRequest()
Request
ServletRequest
for which this object
is the facade.getRequest
in interface Request
public javax.servlet.ServletRequest getRequest(boolean maskDefaultContextMapping)
Request
ServletRequest
for which this object
is the facade.getRequest
in interface Request
maskDefaultContextMapping
- true if the fact that a request
received at the root context was mapped to a default-web-module will
be masked, false otherwisepublic String getDecodedRequestURI()
HttpRequest
getDecodedRequestURI
in interface HttpRequest
public javax.servlet.FilterChain getFilterChain()
Request
getFilterChain
in interface Request
public void setFilterChain(javax.servlet.FilterChain filterChain)
Request
setFilterChain
in interface Request
filterChain
- new filter chainpublic String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
public void setQueryString(String query)
HttpRequest
setQueryString
in interface HttpRequest
query
- The query stringpublic String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
public void setPathInfo(String path)
HttpRequest
setPathInfo
in interface HttpRequest
path
- The path informationpublic org.glassfish.grizzly.http.util.DataChunk getRequestPathMB()
HttpRequest
getRequestPathMB
in interface HttpRequest
public String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public void setServletPath(String path)
HttpRequest
setServletPath
in interface HttpRequest
path
- The servlet pathpublic Wrapper getWrapper()
Request
getWrapper
in interface Request
public void setWrapper(Wrapper wrapper)
Request
setWrapper
in interface Request
wrapper
- The newly associated Wrapperpublic void setMethod(String method)
HttpRequest
setMethod
in interface HttpRequest
method
- The request methodpublic String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public String getAuthorization()
Request
getAuthorization
in interface Request
public Connector getConnector()
Request
getConnector
in interface Request
public void setConnector(Connector connector)
Request
setConnector
in interface Request
connector
- The new connectorpublic Context getContext()
Request
getContext
in interface Request
public void setContext(Context context)
Request
getContextPath()
,
and thus enables parsing of the request URI.setContext
in interface Request
context
- The newly associated Contextpublic Host getHost()
Request
public void setHost(Host host)
Request
public String getInfo()
Request
<description>/<version>
.public Response getResponse()
Request
getResponse
in interface Request
public void setResponse(Response response)
Request
setResponse
in interface Request
response
- The new associated responsepublic Socket getSocket()
Request
public void setSocket(Socket socket)
Request
public InputStream getStream()
Request
public void setStream(InputStream input)
Request
public void addLocale(Locale locale)
HttpRequest
addLocale
in interface HttpRequest
locale
- The new preferred Localepublic javax.servlet.ServletInputStream createInputStream() throws IOException
Request
createInputStream
in interface Request
IOException
- if an input/output error occurspublic void finishRequest() throws IOException
Request
finishRequest
in interface Request
IOException
- if an input/output error occurspublic Object getNote(String name)
Request
null
if no such binding exists.public Iterator<String> getNoteNames()
Request
getNoteNames
in interface Request
public void removeNote(String name)
Request
removeNote
in interface Request
name
- Name of the note to be removedpublic void setContentType(String type)
Request
text/html; charset=ISO-8859-4
.setContentType
in interface Request
type
- The new content typepublic void setNote(String name, Object value)
Request
public void setProtocol(String protocol)
Request
setProtocol
in interface Request
protocol
- Protocol name and versionpublic void setRemoteAddr(String remoteAddr)
Request
getRemoteHost()
if that method is called.setRemoteAddr
in interface Request
remoteAddr
- The remote IP addresspublic void setRemoteHost(String remoteHost)
public void setServerName(String name)
Request
setServerName
in interface Request
name
- The server namepublic void setServerPort(int port)
Request
setServerPort
in interface Request
port
- The server portpublic Object getAttribute(String name)
getAttribute
in interface javax.servlet.ServletRequest
public Enumeration<String> getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletRequest
public String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public long getContentLengthLong()
getContentLengthLong
in interface javax.servlet.ServletRequest
public void setContentLength(int length)
Request
setContentLength
in interface Request
length
- The new content lengthpublic String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public javax.servlet.ServletInputStream getInputStream() throws IOException
getInputStream
in interface javax.servlet.ServletRequest
IOException
public Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
public Enumeration<Locale> getLocales()
getLocales
in interface javax.servlet.ServletRequest
public String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
public BufferedReader getReader() throws IOException
getReader
in interface javax.servlet.ServletRequest
IOException
public String getRealPath(String path)
getRealPath
in interface javax.servlet.ServletRequest
public String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public 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(String name)
removeAttribute
in interface javax.servlet.ServletRequest
public void setAttribute(String name, Object value)
setAttribute
in interface javax.servlet.ServletRequest
public void setCharacterEncoding(String enc) throws UnsupportedEncodingException
setCharacterEncoding
in interface javax.servlet.ServletRequest
UnsupportedEncodingException
public void addCookie(javax.servlet.http.Cookie cookie)
HttpRequest
addCookie
in interface HttpRequest
cookie
- The new cookiepublic void addHeader(String name, String value)
HttpRequest
addHeader
in interface HttpRequest
name
- The new header namevalue
- The new header valuepublic void addParameter(String name, String[] values)
HttpRequest
addParameter
in interface HttpRequest
name
- Name of this request parametervalues
- Corresponding values for this request parameterpublic void clearCookies()
HttpRequest
clearCookies
in interface HttpRequest
public void clearHeaders()
HttpRequest
clearHeaders
in interface HttpRequest
public void clearLocales()
HttpRequest
clearLocales
in interface HttpRequest
public void clearParameters()
HttpRequest
clearParameters
in interface HttpRequest
public void replayPayload(byte[] payloadByteArray)
replayPayload
in interface HttpRequest
public void recycle()
Request
public void setAuthType(String authType)
HttpRequest
null
. Typical values are "BASIC",
"DIGEST", or "SSL".setAuthType
in interface HttpRequest
authType
- The authentication type usedpublic void setRequestedSessionCookie(boolean flag)
HttpRequest
setRequestedSessionCookie
in interface HttpRequest
flag
- The new flagpublic void setRequestedSessionId(String id)
HttpRequest
setRequestedSessionId
in interface HttpRequest
id
- The new session idpublic void setRequestedSessionURL(boolean flag)
HttpRequest
setRequestedSessionURL
in interface HttpRequest
flag
- The new flagpublic void setRequestURI(String uri)
HttpRequest
setRequestURI
in interface HttpRequest
uri
- The request URIpublic void setSecure(boolean secure)
Request
isSecure()
for this Request.public void setUserPrincipal(Principal principal)
HttpRequest
getRemoteUser()
method.setUserPrincipal
in interface HttpRequest
principal
- The user Principalpublic String getParameter(String name)
getParameter
in interface javax.servlet.ServletRequest
public Map<String,String[]> getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
public Enumeration<String> getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public String[] getParameterValues(String name)
getParameterValues
in interface javax.servlet.ServletRequest
public javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface javax.servlet.ServletRequest
public String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
public long getDateHeader(String name)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
public String getHeader(String name)
getHeader
in interface javax.servlet.http.HttpServletRequest
public Enumeration<String> getHeaders(String name)
getHeaders
in interface javax.servlet.http.HttpServletRequest
public Enumeration<String> getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
public int getIntHeader(String name)
getIntHeader
in interface javax.servlet.http.HttpServletRequest
public String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
public String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
public String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
public String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
public StringBuffer getRequestURL()
getRequestURL
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 Session getSessionInternal(boolean create)
Request
getSessionInternal
in interface Request
create
- true if a new session is to be created if one does not
already exist, false otherwisepublic String changeSessionId()
Request
changeSessionId
in interface javax.servlet.http.HttpServletRequest
changeSessionId
in interface Request
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 void setRequestedSessionCookiePath(String cookiePath)
Request
setRequestedSessionCookiePath
in interface Request
public boolean isUserInRole(String role)
isUserInRole
in interface javax.servlet.http.HttpServletRequest
public Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public String getLocalAddr()
getLocalAddr
in interface javax.servlet.ServletRequest
public String getLocalName()
getLocalName
in interface javax.servlet.ServletRequest
public int getLocalPort()
getLocalPort
in interface javax.servlet.ServletRequest
public int getRemotePort()
getRemotePort
in interface javax.servlet.ServletRequest
public javax.servlet.DispatcherType getDispatcherType()
getDispatcherType
in interface javax.servlet.ServletRequest
public javax.servlet.AsyncContext startAsync() throws IllegalStateException
startAsync
in interface javax.servlet.ServletRequest
IllegalStateException
public javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws IllegalStateException
startAsync
in interface javax.servlet.ServletRequest
IllegalStateException
public boolean isAsyncStarted()
isAsyncStarted
in interface javax.servlet.ServletRequest
public boolean isAsyncSupported()
isAsyncSupported
in interface javax.servlet.ServletRequest
public void setAsyncTimeout(long timeout)
public long getAsyncTimeout()
public javax.servlet.AsyncContext getAsyncContext()
getAsyncContext
in interface javax.servlet.ServletRequest
public void addAsyncListener(javax.servlet.AsyncListener listener)
public void addAsyncListener(javax.servlet.AsyncListener listener, javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)
public boolean isSetAsyncTimeoutCalled()
public void disableAsyncSupport()
Request
disableAsyncSupport
in interface Request
public Collection<javax.servlet.http.Part> getParts()
getParts
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.Part getPart(String name)
getPart
in interface javax.servlet.http.HttpServletRequest
public boolean authenticate(javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
authenticate
in interface javax.servlet.http.HttpServletRequest
IOException
javax.servlet.ServletException
public void login(String username, String password) throws javax.servlet.ServletException
login
in interface javax.servlet.http.HttpServletRequest
javax.servlet.ServletException
public void logout() throws javax.servlet.ServletException
logout
in interface javax.servlet.http.HttpServletRequest
javax.servlet.ServletException
public <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass)
upgrade
in interface javax.servlet.http.HttpServletRequest
public void setCheckRestrictedResources(boolean check)
setCheckRestrictedResources
in interface Request
check
- whether access needs to be checkedpublic boolean getCheckRestrictedResources()
getCheckRestrictedResources
in interface Request
public String getJrouteId()
JROUTE
cookie or appended to the
session identifier encoded in the URI (if cookies have been disabled).getJrouteId
in interface Request
public String generateSessionId()
generateSessionId
in interface Request
null
public javax.servlet.ServletContext getServletContext()
getServletContext
in interface javax.servlet.ServletRequest
public Session lockSession()
lockSession
in interface Request
public void unlockSession()
unlockSession
in interface Request
Copyright © 2020. All rights reserved.