Class MockHttpServletRequest
- java.lang.Object
-
- com.jalios.servlet.http.MockHttpServletRequest
-
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest
,javax.servlet.ServletRequest
public class MockHttpServletRequest extends java.lang.Object implements javax.servlet.http.HttpServletRequest
Mock implementation of theHttpServletRequest
interface.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_PROTOCOL
The default protocol: 'http'.static java.lang.String
DEFAULT_REMOTE_ADDR
The default remote address: '127.0.0.1'.static java.lang.String
DEFAULT_REMOTE_HOST
The default remote host: 'localhost'.static java.lang.String
DEFAULT_SERVER_ADDR
The default server address: '127.0.0.1'.static java.lang.String
DEFAULT_SERVER_NAME
The default server name: 'localhost'.static int
DEFAULT_SERVER_PORT
The default server port: '80'.
-
Constructor Summary
Constructors Constructor Description MockHttpServletRequest()
Create a newMockHttpServletRequest
with a defaultMockServletContext
.MockHttpServletRequest(java.lang.String method, java.lang.String requestURI)
Create a newMockHttpServletRequest
with a defaultMockServletContext
.MockHttpServletRequest(javax.servlet.ServletContext servletContext)
Create a newMockHttpServletRequest
with the suppliedServletContext
.MockHttpServletRequest(javax.servlet.ServletContext servletContext, java.lang.String method, java.lang.String requestURI)
Create a newMockHttpServletRequest
with the suppliedServletContext
,method
, andrequestURI
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addHeader(java.lang.String name, java.lang.Object value)
Add a header entry for the given name.void
addParameter(java.lang.String name, java.lang.String value)
Add a single value for the specified HTTP parameter.void
addParameter(java.lang.String name, java.lang.String[] values)
Add an array of values for the specified HTTP parameter.void
addParameters(java.util.Map<?,?> params)
Adds all provided parameters without replacing any existing values.void
addPart(javax.servlet.http.Part part)
void
addPreferredLocale(java.util.Locale locale)
Add a new preferred locale, before any existing locales.void
addUserRole(java.lang.String role)
boolean
authenticate(javax.servlet.http.HttpServletResponse response)
java.lang.String
changeSessionId()
The implementation of this (Servlet 3.1+) method callsMockHttpSession.changeSessionId()
if the session is a mock session.protected void
checkActive()
Check whether this request is still active (that is, not completed yet), throwing an IllegalStateException if not active anymore.void
clearAttributes()
Clear all of this request's attributes.void
close()
Mark this request as completed, keeping its state.javax.servlet.AsyncContext
getAsyncContext()
java.lang.Object
getAttribute(java.lang.String name)
java.util.Enumeration<java.lang.String>
getAttributeNames()
java.lang.String
getAuthType()
java.lang.String
getCharacterEncoding()
int
getContentLength()
long
getContentLengthLong()
java.lang.String
getContentType()
java.lang.String
getContextPath()
javax.servlet.http.Cookie[]
getCookies()
long
getDateHeader(java.lang.String name)
Return the long timestamp for the date header with the givenname
.javax.servlet.DispatcherType
getDispatcherType()
java.lang.String
getHeader(java.lang.String name)
java.util.Enumeration<java.lang.String>
getHeaderNames()
java.util.Enumeration<java.lang.String>
getHeaders(java.lang.String name)
javax.servlet.ServletInputStream
getInputStream()
int
getIntHeader(java.lang.String name)
java.lang.String
getLocalAddr()
java.util.Locale
getLocale()
Return the first preferred locale configured in this mock request.java.util.Enumeration<java.util.Locale>
getLocales()
Return an enumeration of the preferred locales configured in this mock request.java.lang.String
getLocalName()
int
getLocalPort()
java.lang.String
getMethod()
java.lang.String
getParameter(java.lang.String name)
java.util.Map<java.lang.String,java.lang.String[]>
getParameterMap()
java.util.Enumeration<java.lang.String>
getParameterNames()
java.lang.String[]
getParameterValues(java.lang.String name)
javax.servlet.http.Part
getPart(java.lang.String name)
java.util.Collection<javax.servlet.http.Part>
getParts()
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)
Deprecated.java.lang.String
getRemoteAddr()
java.lang.String
getRemoteHost()
int
getRemotePort()
java.lang.String
getRemoteUser()
javax.servlet.RequestDispatcher
getRequestDispatcher(java.lang.String path)
java.lang.String
getRequestedSessionId()
java.lang.String
getRequestURI()
java.lang.StringBuffer
getRequestURL()
java.lang.String
getScheme()
java.lang.String
getServerName()
int
getServerPort()
javax.servlet.ServletContext
getServletContext()
Return the ServletContext that this request is associated with.java.lang.String
getServletPath()
javax.servlet.http.HttpSession
getSession()
javax.servlet.http.HttpSession
getSession(boolean create)
java.security.Principal
getUserPrincipal()
void
invalidate()
Invalidate this request, clearing its state.boolean
isActive()
Return whether this request is still active (that is, not completed yet).boolean
isAsyncStarted()
boolean
isAsyncSupported()
boolean
isRequestedSessionIdFromCookie()
boolean
isRequestedSessionIdFromUrl()
Deprecated.boolean
isRequestedSessionIdFromURL()
boolean
isRequestedSessionIdValid()
boolean
isSecure()
boolean
isUserInRole(java.lang.String role)
void
login(java.lang.String username, java.lang.String password)
void
logout()
void
removeAllParameters()
Removes all existing parameters.void
removeAttribute(java.lang.String name)
void
removeParameter(java.lang.String name)
Remove already registered values for the specified HTTP parameter, if any.void
setAsyncContext(MockAsyncContext asyncContext)
void
setAsyncStarted(boolean asyncStarted)
void
setAsyncSupported(boolean asyncSupported)
void
setAttribute(java.lang.String name, java.lang.Object value)
void
setAuthType(java.lang.String authType)
void
setCharacterEncoding(java.lang.String characterEncoding)
void
setContent(byte[] content)
void
setContentType(java.lang.String contentType)
void
setContextPath(java.lang.String contextPath)
void
setCookies(javax.servlet.http.Cookie... cookies)
void
setDispatcherType(javax.servlet.DispatcherType dispatcherType)
void
setLocalAddr(java.lang.String localAddr)
void
setLocalName(java.lang.String localName)
void
setLocalPort(int localPort)
void
setMethod(java.lang.String method)
void
setParameter(java.lang.String name, java.lang.String value)
Set a single value for the specified HTTP parameter.void
setParameter(java.lang.String name, java.lang.String[] values)
Set an array of values for the specified HTTP parameter.void
setParameters(java.util.Map params)
Sets all provided parameters replacing any existing values for the provided parameter names.void
setPathInfo(java.lang.String pathInfo)
void
setPreferredLocales(java.util.List<java.util.Locale> locales)
Set the list of preferred locales, in descending order, effectively replacing any existing locales.void
setProtocol(java.lang.String protocol)
void
setQueryString(java.lang.String queryString)
void
setRemoteAddr(java.lang.String remoteAddr)
void
setRemoteHost(java.lang.String remoteHost)
void
setRemotePort(int remotePort)
void
setRemoteUser(java.lang.String remoteUser)
void
setRequestedSessionId(java.lang.String requestedSessionId)
void
setRequestedSessionIdFromCookie(boolean requestedSessionIdFromCookie)
void
setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
void
setRequestedSessionIdValid(boolean requestedSessionIdValid)
void
setRequestURI(java.lang.String requestURI)
void
setScheme(java.lang.String scheme)
void
setSecure(boolean secure)
Set the booleansecure
flag indicating whether the mock request was made using a secure channel, such as HTTPS.void
setServerName(java.lang.String serverName)
void
setServerPort(int serverPort)
void
setServletPath(java.lang.String servletPath)
void
setSession(javax.servlet.http.HttpSession session)
void
setUserPrincipal(java.security.Principal userPrincipal)
javax.servlet.AsyncContext
startAsync()
javax.servlet.AsyncContext
startAsync(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
<T extends javax.servlet.http.HttpUpgradeHandler>
Tupgrade(java.lang.Class<T> arg0)
-
-
-
Field Detail
-
DEFAULT_PROTOCOL
public static final java.lang.String DEFAULT_PROTOCOL
The default protocol: 'http'.- See Also:
- Constant Field Values
-
DEFAULT_SERVER_ADDR
public static final java.lang.String DEFAULT_SERVER_ADDR
The default server address: '127.0.0.1'.- See Also:
- Constant Field Values
-
DEFAULT_SERVER_NAME
public static final java.lang.String DEFAULT_SERVER_NAME
The default server name: 'localhost'.- See Also:
- Constant Field Values
-
DEFAULT_SERVER_PORT
public static final int DEFAULT_SERVER_PORT
The default server port: '80'.- See Also:
- Constant Field Values
-
DEFAULT_REMOTE_ADDR
public static final java.lang.String DEFAULT_REMOTE_ADDR
The default remote address: '127.0.0.1'.- See Also:
- Constant Field Values
-
DEFAULT_REMOTE_HOST
public static final java.lang.String DEFAULT_REMOTE_HOST
The default remote host: 'localhost'.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MockHttpServletRequest
public MockHttpServletRequest()
Create a newMockHttpServletRequest
with a defaultMockServletContext
.
-
MockHttpServletRequest
public MockHttpServletRequest(java.lang.String method, java.lang.String requestURI)
Create a newMockHttpServletRequest
with a defaultMockServletContext
.- Parameters:
method
- the request method (may benull
)requestURI
- the request URI (may benull
)- See Also:
setMethod(java.lang.String)
,setRequestURI(java.lang.String)
,MockHttpServletRequest(ServletContext, String, String)
-
MockHttpServletRequest
public MockHttpServletRequest(javax.servlet.ServletContext servletContext)
Create a newMockHttpServletRequest
with the suppliedServletContext
.- Parameters:
servletContext
- the ServletContext that the request runs in (may benull
to use a defaultMockServletContext
)- See Also:
MockHttpServletRequest(ServletContext, String, String)
-
MockHttpServletRequest
public MockHttpServletRequest(javax.servlet.ServletContext servletContext, java.lang.String method, java.lang.String requestURI)
Create a newMockHttpServletRequest
with the suppliedServletContext
,method
, andrequestURI
.The preferred locale will be set to
Locale.ENGLISH
.- Parameters:
servletContext
- the ServletContext that the request runs in (may benull
to use a defaultMockServletContext
)method
- the request method (may benull
)requestURI
- the request URI (may benull
)- See Also:
setMethod(java.lang.String)
,setRequestURI(java.lang.String)
,setPreferredLocales(java.util.List<java.util.Locale>)
,MockServletContext
-
-
Method Detail
-
getServletContext
public javax.servlet.ServletContext getServletContext()
Return the ServletContext that this request is associated with. (Not available in the standard HttpServletRequest interface for some reason.)- Specified by:
getServletContext
in interfacejavax.servlet.ServletRequest
- Returns:
- ServletContext
-
isActive
public boolean isActive()
Return whether this request is still active (that is, not completed yet).- Returns:
- boolean
-
close
public void close()
Mark this request as completed, keeping its state.
-
invalidate
public void invalidate()
Invalidate this request, clearing its state.
-
checkActive
protected void checkActive() throws java.lang.IllegalStateException
Check whether this request is still active (that is, not completed yet), throwing an IllegalStateException if not active anymore.- Throws:
java.lang.IllegalStateException
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
- Specified by:
getAttribute
in interfacejavax.servlet.ServletRequest
-
getAttributeNames
public java.util.Enumeration<java.lang.String> getAttributeNames()
- Specified by:
getAttributeNames
in interfacejavax.servlet.ServletRequest
-
getCharacterEncoding
public java.lang.String getCharacterEncoding()
- Specified by:
getCharacterEncoding
in interfacejavax.servlet.ServletRequest
-
setCharacterEncoding
public void setCharacterEncoding(java.lang.String characterEncoding)
- Specified by:
setCharacterEncoding
in interfacejavax.servlet.ServletRequest
-
setContent
public void setContent(byte[] content)
-
getContentLength
public int getContentLength()
- Specified by:
getContentLength
in interfacejavax.servlet.ServletRequest
-
getContentLengthLong
public long getContentLengthLong()
- Specified by:
getContentLengthLong
in interfacejavax.servlet.ServletRequest
-
setContentType
public void setContentType(java.lang.String contentType)
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentType
in interfacejavax.servlet.ServletRequest
-
getInputStream
public javax.servlet.ServletInputStream getInputStream()
- Specified by:
getInputStream
in interfacejavax.servlet.ServletRequest
-
setParameter
public void setParameter(java.lang.String name, java.lang.String value)
Set a single value for the specified HTTP parameter.If there are already one or more values registered for the given parameter name, they will be replaced.
- Parameters:
name
- namevalue
- value
-
setParameter
public void setParameter(java.lang.String name, java.lang.String[] values)
Set an array of values for the specified HTTP parameter.If there are already one or more values registered for the given parameter name, they will be replaced.
- Parameters:
name
- namevalues
- values
-
setParameters
public void setParameters(java.util.Map params)
Sets all provided parameters replacing any existing values for the provided parameter names. To add without replacing existing values, useaddParameters(java.util.Map)
.- Parameters:
params
- map of params
-
addParameter
public void addParameter(java.lang.String name, java.lang.String value)
Add a single value for the specified HTTP parameter.If there are already one or more values registered for the given parameter name, the given value will be added to the end of the list.
- Parameters:
name
- namevalue
- value
-
addParameter
public void addParameter(java.lang.String name, java.lang.String[] values)
Add an array of values for the specified HTTP parameter.If there are already one or more values registered for the given parameter name, the given values will be added to the end of the list.
- Parameters:
name
- namevalues
- value
-
addParameters
public void addParameters(java.util.Map<?,?> params)
Adds all provided parameters without replacing any existing values. To replace existing values, usesetParameters(java.util.Map)
.- Parameters:
params
- map of params
-
removeParameter
public void removeParameter(java.lang.String name)
Remove already registered values for the specified HTTP parameter, if any.- Parameters:
name
- name
-
removeAllParameters
public void removeAllParameters()
Removes all existing parameters.
-
getParameter
public java.lang.String getParameter(java.lang.String name)
- Specified by:
getParameter
in interfacejavax.servlet.ServletRequest
-
getParameterNames
public java.util.Enumeration<java.lang.String> getParameterNames()
- Specified by:
getParameterNames
in interfacejavax.servlet.ServletRequest
-
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
- Specified by:
getParameterValues
in interfacejavax.servlet.ServletRequest
-
getParameterMap
public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
- Specified by:
getParameterMap
in interfacejavax.servlet.ServletRequest
-
setProtocol
public void setProtocol(java.lang.String protocol)
-
getProtocol
public java.lang.String getProtocol()
- Specified by:
getProtocol
in interfacejavax.servlet.ServletRequest
-
setScheme
public void setScheme(java.lang.String scheme)
-
getScheme
public java.lang.String getScheme()
- Specified by:
getScheme
in interfacejavax.servlet.ServletRequest
-
setServerName
public void setServerName(java.lang.String serverName)
-
getServerName
public java.lang.String getServerName()
- Specified by:
getServerName
in interfacejavax.servlet.ServletRequest
-
setServerPort
public void setServerPort(int serverPort)
-
getServerPort
public int getServerPort()
- Specified by:
getServerPort
in interfacejavax.servlet.ServletRequest
-
getReader
public java.io.BufferedReader getReader() throws java.io.UnsupportedEncodingException
- Specified by:
getReader
in interfacejavax.servlet.ServletRequest
- Throws:
java.io.UnsupportedEncodingException
-
setRemoteAddr
public void setRemoteAddr(java.lang.String remoteAddr)
-
getRemoteAddr
public java.lang.String getRemoteAddr()
- Specified by:
getRemoteAddr
in interfacejavax.servlet.ServletRequest
-
setRemoteHost
public void setRemoteHost(java.lang.String remoteHost)
-
getRemoteHost
public java.lang.String getRemoteHost()
- Specified by:
getRemoteHost
in interfacejavax.servlet.ServletRequest
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
- Specified by:
setAttribute
in interfacejavax.servlet.ServletRequest
-
removeAttribute
public void removeAttribute(java.lang.String name)
- Specified by:
removeAttribute
in interfacejavax.servlet.ServletRequest
-
clearAttributes
public void clearAttributes()
Clear all of this request's attributes.
-
addPreferredLocale
public void addPreferredLocale(java.util.Locale locale)
Add a new preferred locale, before any existing locales.- Parameters:
locale
- locale- See Also:
setPreferredLocales(java.util.List<java.util.Locale>)
-
setPreferredLocales
public void setPreferredLocales(java.util.List<java.util.Locale> locales)
Set the list of preferred locales, in descending order, effectively replacing any existing locales.- Since:
- 3.2
- See Also:
addPreferredLocale(java.util.Locale)
-
getLocale
public java.util.Locale getLocale()
Return the first preferred locale configured in this mock request.If no locales have been explicitly configured, the default, preferred
Locale
for the server mocked by this request isLocale.ENGLISH
.In contrast to the Servlet specification, this mock implementation does not take into consideration any locales specified via the
Accept-Language
header.- Specified by:
getLocale
in interfacejavax.servlet.ServletRequest
- See Also:
ServletRequest.getLocale()
,addPreferredLocale(Locale)
,setPreferredLocales(List)
-
getLocales
public java.util.Enumeration<java.util.Locale> getLocales()
Return an enumeration of the preferred locales configured in this mock request.If no locales have been explicitly configured, the default, preferred
Locale
for the server mocked by this request isLocale.ENGLISH
.In contrast to the Servlet specification, this mock implementation does not take into consideration any locales specified via the
Accept-Language
header.- Specified by:
getLocales
in interfacejavax.servlet.ServletRequest
- See Also:
ServletRequest.getLocales()
,addPreferredLocale(Locale)
,setPreferredLocales(List)
-
setSecure
public void setSecure(boolean secure)
Set the booleansecure
flag indicating whether the mock request was made using a secure channel, such as HTTPS.- See Also:
isSecure()
,getScheme()
,setScheme(String)
-
isSecure
public boolean isSecure()
- Specified by:
isSecure
in interfacejavax.servlet.ServletRequest
- See Also:
ServletRequest.isSecure()
-
getRequestDispatcher
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
- Specified by:
getRequestDispatcher
in interfacejavax.servlet.ServletRequest
-
getRealPath
@Deprecated public java.lang.String getRealPath(java.lang.String path)
Deprecated.- Specified by:
getRealPath
in interfacejavax.servlet.ServletRequest
-
setRemotePort
public void setRemotePort(int remotePort)
-
getRemotePort
public int getRemotePort()
- Specified by:
getRemotePort
in interfacejavax.servlet.ServletRequest
-
setLocalName
public void setLocalName(java.lang.String localName)
-
getLocalName
public java.lang.String getLocalName()
- Specified by:
getLocalName
in interfacejavax.servlet.ServletRequest
-
setLocalAddr
public void setLocalAddr(java.lang.String localAddr)
-
getLocalAddr
public java.lang.String getLocalAddr()
- Specified by:
getLocalAddr
in interfacejavax.servlet.ServletRequest
-
setLocalPort
public void setLocalPort(int localPort)
-
getLocalPort
public int getLocalPort()
- Specified by:
getLocalPort
in interfacejavax.servlet.ServletRequest
-
startAsync
public javax.servlet.AsyncContext startAsync()
- Specified by:
startAsync
in interfacejavax.servlet.ServletRequest
-
startAsync
public javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
- Specified by:
startAsync
in interfacejavax.servlet.ServletRequest
-
setAsyncStarted
public void setAsyncStarted(boolean asyncStarted)
-
isAsyncStarted
public boolean isAsyncStarted()
- Specified by:
isAsyncStarted
in interfacejavax.servlet.ServletRequest
-
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported)
-
isAsyncSupported
public boolean isAsyncSupported()
- Specified by:
isAsyncSupported
in interfacejavax.servlet.ServletRequest
-
setAsyncContext
public void setAsyncContext(MockAsyncContext asyncContext)
-
getAsyncContext
public javax.servlet.AsyncContext getAsyncContext()
- Specified by:
getAsyncContext
in interfacejavax.servlet.ServletRequest
-
setDispatcherType
public void setDispatcherType(javax.servlet.DispatcherType dispatcherType)
-
getDispatcherType
public javax.servlet.DispatcherType getDispatcherType()
- Specified by:
getDispatcherType
in interfacejavax.servlet.ServletRequest
-
setAuthType
public void setAuthType(java.lang.String authType)
-
getAuthType
public java.lang.String getAuthType()
- Specified by:
getAuthType
in interfacejavax.servlet.http.HttpServletRequest
-
setCookies
public void setCookies(javax.servlet.http.Cookie... cookies)
-
getCookies
public javax.servlet.http.Cookie[] getCookies()
- Specified by:
getCookies
in interfacejavax.servlet.http.HttpServletRequest
-
addHeader
public void addHeader(java.lang.String name, java.lang.Object value)
Add a header entry for the given name.While this method can take any
Object
as a parameter, it is recommended to use the following types:- String or any Object to be converted using
toString()
; seegetHeader(java.lang.String)
. - String, Number, or Date for date headers; see
getDateHeader(java.lang.String)
. - String or Number for integer headers; see
getIntHeader(java.lang.String)
. String[]
orCollection<String>
for multiple values; seegetHeaders(java.lang.String)
.
- Parameters:
name
- namevalue
- value- See Also:
getHeaderNames()
,getHeaders(java.lang.String)
,getHeader(java.lang.String)
,getDateHeader(java.lang.String)
- String or any Object to be converted using
-
getDateHeader
public long getDateHeader(java.lang.String name)
Return the long timestamp for the date header with the givenname
.If the internal value representation is a String, this method will try to parse it as a date using the supported date formats:
- "EEE, dd MMM yyyy HH:mm:ss zzz"
- "EEE, dd-MMM-yy HH:mm:ss zzz"
- "EEE MMM dd HH:mm:ss yyyy"
- Specified by:
getDateHeader
in interfacejavax.servlet.http.HttpServletRequest
- Parameters:
name
- the header name- See Also:
- Section 7.1.1.1 of RFC 7231
-
getHeader
public java.lang.String getHeader(java.lang.String name)
- Specified by:
getHeader
in interfacejavax.servlet.http.HttpServletRequest
-
getHeaders
public java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
- Specified by:
getHeaders
in interfacejavax.servlet.http.HttpServletRequest
-
getHeaderNames
public java.util.Enumeration<java.lang.String> getHeaderNames()
- Specified by:
getHeaderNames
in interfacejavax.servlet.http.HttpServletRequest
-
getIntHeader
public int getIntHeader(java.lang.String name)
- Specified by:
getIntHeader
in interfacejavax.servlet.http.HttpServletRequest
-
setMethod
public void setMethod(java.lang.String method)
-
getMethod
public java.lang.String getMethod()
- Specified by:
getMethod
in interfacejavax.servlet.http.HttpServletRequest
-
setPathInfo
public void setPathInfo(java.lang.String pathInfo)
-
getPathInfo
public java.lang.String getPathInfo()
- Specified by:
getPathInfo
in interfacejavax.servlet.http.HttpServletRequest
-
getPathTranslated
public java.lang.String getPathTranslated()
- Specified by:
getPathTranslated
in interfacejavax.servlet.http.HttpServletRequest
-
setContextPath
public void setContextPath(java.lang.String contextPath)
-
getContextPath
public java.lang.String getContextPath()
- Specified by:
getContextPath
in interfacejavax.servlet.http.HttpServletRequest
-
setQueryString
public void setQueryString(java.lang.String queryString)
-
getQueryString
public java.lang.String getQueryString()
- Specified by:
getQueryString
in interfacejavax.servlet.http.HttpServletRequest
-
setRemoteUser
public void setRemoteUser(java.lang.String remoteUser)
-
getRemoteUser
public java.lang.String getRemoteUser()
- Specified by:
getRemoteUser
in interfacejavax.servlet.http.HttpServletRequest
-
addUserRole
public void addUserRole(java.lang.String role)
-
isUserInRole
public boolean isUserInRole(java.lang.String role)
- Specified by:
isUserInRole
in interfacejavax.servlet.http.HttpServletRequest
-
setUserPrincipal
public void setUserPrincipal(java.security.Principal userPrincipal)
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
- Specified by:
getUserPrincipal
in interfacejavax.servlet.http.HttpServletRequest
-
setRequestedSessionId
public void setRequestedSessionId(java.lang.String requestedSessionId)
-
getRequestedSessionId
public java.lang.String getRequestedSessionId()
- Specified by:
getRequestedSessionId
in interfacejavax.servlet.http.HttpServletRequest
-
setRequestURI
public void setRequestURI(java.lang.String requestURI)
-
getRequestURI
public java.lang.String getRequestURI()
- Specified by:
getRequestURI
in interfacejavax.servlet.http.HttpServletRequest
-
getRequestURL
public java.lang.StringBuffer getRequestURL()
- Specified by:
getRequestURL
in interfacejavax.servlet.http.HttpServletRequest
-
setServletPath
public void setServletPath(java.lang.String servletPath)
-
getServletPath
public java.lang.String getServletPath()
- Specified by:
getServletPath
in interfacejavax.servlet.http.HttpServletRequest
-
setSession
public void setSession(javax.servlet.http.HttpSession session)
-
getSession
public javax.servlet.http.HttpSession getSession(boolean create)
- Specified by:
getSession
in interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession()
- Specified by:
getSession
in interfacejavax.servlet.http.HttpServletRequest
-
changeSessionId
public java.lang.String changeSessionId()
The implementation of this (Servlet 3.1+) method callsMockHttpSession.changeSessionId()
if the session is a mock session. Otherwise it simply returns the current session id.- Specified by:
changeSessionId
in interfacejavax.servlet.http.HttpServletRequest
- Since:
- 4.0.3
-
setRequestedSessionIdValid
public void setRequestedSessionIdValid(boolean requestedSessionIdValid)
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
- Specified by:
isRequestedSessionIdValid
in interfacejavax.servlet.http.HttpServletRequest
-
setRequestedSessionIdFromCookie
public void setRequestedSessionIdFromCookie(boolean requestedSessionIdFromCookie)
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
- Specified by:
isRequestedSessionIdFromCookie
in interfacejavax.servlet.http.HttpServletRequest
-
setRequestedSessionIdFromURL
public void setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
- Specified by:
isRequestedSessionIdFromURL
in interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromUrl
@Deprecated public boolean isRequestedSessionIdFromUrl()
Deprecated.- Specified by:
isRequestedSessionIdFromUrl
in interfacejavax.servlet.http.HttpServletRequest
-
authenticate
public boolean authenticate(javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
- Specified by:
authenticate
in interfacejavax.servlet.http.HttpServletRequest
- Throws:
java.io.IOException
javax.servlet.ServletException
-
login
public void login(java.lang.String username, java.lang.String password) throws javax.servlet.ServletException
- Specified by:
login
in interfacejavax.servlet.http.HttpServletRequest
- Throws:
javax.servlet.ServletException
-
logout
public void logout() throws javax.servlet.ServletException
- Specified by:
logout
in interfacejavax.servlet.http.HttpServletRequest
- Throws:
javax.servlet.ServletException
-
addPart
public void addPart(javax.servlet.http.Part part)
-
getPart
public javax.servlet.http.Part getPart(java.lang.String name) throws java.io.IOException, java.lang.IllegalStateException, javax.servlet.ServletException
- Specified by:
getPart
in interfacejavax.servlet.http.HttpServletRequest
- Throws:
java.io.IOException
java.lang.IllegalStateException
javax.servlet.ServletException
-
getParts
public java.util.Collection<javax.servlet.http.Part> getParts() throws java.io.IOException, java.lang.IllegalStateException, javax.servlet.ServletException
- Specified by:
getParts
in interfacejavax.servlet.http.HttpServletRequest
- Throws:
java.io.IOException
java.lang.IllegalStateException
javax.servlet.ServletException
-
upgrade
public <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(java.lang.Class<T> arg0) throws java.io.IOException, javax.servlet.ServletException
- Specified by:
upgrade
in interfacejavax.servlet.http.HttpServletRequest
- Throws:
java.io.IOException
javax.servlet.ServletException
-
-