|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.slim3.struts.test.MockHttpServletRequest
public class MockHttpServletRequest
A mock implementation for HttpServletRequest
.
Field Summary | |
---|---|
protected Map<String,Object> |
attributeMap
The map for the attributes. |
protected String |
authType
Authority type. |
protected String |
characterEncoding
The character encoding. |
protected int |
contentLength
The content length. |
protected String |
contentType
The content type. |
protected List<Cookie> |
cookieList
The list for Cookie . |
protected Map<String,List<String>> |
headerMap
The map for the request header. |
protected ServletInputStream |
inputStream
The input stream. |
protected String |
localAddr
The local address. |
protected List<Locale> |
localeList
The list for the locales. |
protected String |
localName
The local name. |
protected int |
localPort
The local port. |
protected String |
method
The method. |
protected Map<String,String[]> |
parameterMap
The map for the parameters. |
protected String |
pathInfo
The path information. |
protected String |
pathTranslated
The translated path. |
protected String |
protocol
The protocol. |
protected String |
queryString
The query string. |
protected BufferedReader |
reader
The buffered reader. |
protected String |
remoteAddr
The remote address. |
protected String |
remoteHost
The remote host. |
protected int |
remotePort
The remote port. |
protected String |
requestedSessionId
The requested session identifier. |
protected boolean |
requestedSessionIdFromCookie
Whether the requested session identifier comes from cookie. |
protected String |
scheme
The request scheme. |
protected boolean |
secure
The secure flag. |
protected String |
serverName
The server name. |
protected int |
serverPort
The server port. |
protected ServletContext |
servletContext
The servlet context. |
protected String |
servletPath
The servlet path. |
protected MockHttpSession |
session
The session. |
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
---|---|
MockHttpServletRequest(ServletContext servletContext,
String servletPath)
Constructor. |
Method Summary | |
---|---|
void |
addCookie(Cookie cookie)
Adds the cookie. |
void |
addDateHeader(String name,
long value)
Adds the date header. |
void |
addHeader(String name,
String value)
Adds the header. |
void |
addIntHeader(String name,
int value)
Adds the int header. |
void |
addLocale(Locale locale)
Adds the locale. |
void |
addParameter(String name,
String value)
Adds the request parameter. |
void |
addParameter(String name,
String[] values)
Adds the request parameter. |
Object |
getAttribute(String name)
|
Enumeration<String> |
getAttributeNames()
|
String |
getAuthType()
|
String |
getCharacterEncoding()
|
int |
getContentLength()
|
String |
getContentType()
|
String |
getContextPath()
|
Cookie[] |
getCookies()
|
long |
getDateHeader(String name)
|
String |
getHeader(String name)
|
protected List<String> |
getHeaderList(String name)
Return the list for header. |
Enumeration<String> |
getHeaderNames()
|
Enumeration<String> |
getHeaders(String name)
|
ServletInputStream |
getInputStream()
|
int |
getIntHeader(String name)
|
String |
getLocalAddr()
|
Locale |
getLocale()
|
Enumeration<Locale> |
getLocales()
|
String |
getLocalName()
|
int |
getLocalPort()
|
String |
getMethod()
|
String |
getParameter(String name)
|
Map<String,String[]> |
getParameterMap()
|
Enumeration<String> |
getParameterNames()
|
String[] |
getParameterValues(String name)
|
String |
getPathInfo()
|
String |
getPathTranslated()
|
String |
getProtocol()
|
String |
getQueryString()
|
BufferedReader |
getReader()
|
String |
getRealPath(String path)
|
String |
getRemoteAddr()
|
String |
getRemoteHost()
|
int |
getRemotePort()
|
String |
getRemoteUser()
|
RequestDispatcher |
getRequestDispatcher(String path)
|
String |
getRequestedSessionId()
|
String |
getRequestURI()
|
StringBuffer |
getRequestURL()
|
String |
getScheme()
|
String |
getServerName()
|
int |
getServerPort()
|
String |
getServletPath()
|
HttpSession |
getSession()
|
HttpSession |
getSession(boolean create)
|
Principal |
getUserPrincipal()
|
boolean |
isRequestedSessionIdFromCookie()
|
boolean |
isRequestedSessionIdFromUrl()
|
boolean |
isRequestedSessionIdFromURL()
|
boolean |
isRequestedSessionIdValid()
|
boolean |
isSecure()
|
boolean |
isUserInRole(String arg0)
|
void |
removeAttribute(String name)
|
void |
removeParameter(String name)
Removes the request parameter. |
void |
setAttribute(String name,
Object value)
|
void |
setAuthType(String authType)
Sets the authority type. |
void |
setCharacterEncoding(String characterEncoding)
|
void |
setContentLength(int contentLength)
Sets the content length. |
void |
setContentType(String contentType)
Sets the content type. |
void |
setDateHeader(String name,
long value)
Sets the date header. |
void |
setHeader(String name,
String value)
Sets the header. |
void |
setInputStream(ServletInputStream inputStream)
Sets the input stream. |
void |
setIntHeader(String name,
int value)
Sets the int header. |
void |
setLocalAddr(String localAddr)
Sets the local address. |
void |
setLocalName(String localName)
Sets the local name. |
void |
setLocalPort(int localPort)
Sets the local port. |
void |
setMethod(String method)
Sets the method. |
void |
setParameter(String name,
String value)
Sets the request parameter. |
void |
setParameter(String name,
String[] values)
Sets the request parameter. |
void |
setPathInfo(String pathInfo)
Sets the path information. |
void |
setPathTranslated(String pathTranslated)
Sets the translated path. |
void |
setProtocol(String protocol)
Sets the protocol. |
void |
setQueryString(String queryString)
Sets the query string. |
void |
setReader(BufferedReader reader)
Sets the buffered reader. |
void |
setRemoteAddr(String remoteAddr)
Sets the remote address. |
void |
setRemoteHost(String remoteHost)
Sets the remote host. |
void |
setRemotePort(int remotePort)
Sets the remote port. |
void |
setRequestedSessionId(String requestedSessionId)
Sets the requested session identifier. |
void |
setScheme(String scheme)
Sets the scheme. |
void |
setSecure(boolean secure)
Sets the secure flag. |
void |
setServerName(String serverName)
Sets the server name. |
void |
setServerPort(int serverPort)
Sets the server port. |
void |
setServletPath(String servletPath)
Sets the servlet path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ServletContext servletContext
protected String servletPath
protected String authType
protected List<Cookie> cookieList
Cookie
.
protected Map<String,List<String>> headerMap
protected String method
protected String pathInfo
protected String pathTranslated
protected String queryString
protected MockHttpSession session
protected String scheme
protected int serverPort
protected String protocol
protected String serverName
protected Map<String,Object> attributeMap
protected String characterEncoding
protected int contentLength
protected String contentType
protected Map<String,String[]> parameterMap
protected String requestedSessionId
protected boolean requestedSessionIdFromCookie
protected ServletInputStream inputStream
protected BufferedReader reader
protected String remoteAddr
protected String remoteHost
protected int remotePort
protected String localAddr
protected String localName
protected int localPort
protected List<Locale> localeList
protected boolean secure
Constructor Detail |
---|
public MockHttpServletRequest(ServletContext servletContext, String servletPath) throws NullPointerException
servletContext
- the servlet contextservletPath
- the servlet path
NullPointerException
- if the servletContext parameter is null or if the servletPath
parameter is nullMethod Detail |
---|
public String getAuthType()
getAuthType
in interface HttpServletRequest
public void setAuthType(String authType)
authType
- the authority typepublic Cookie[] getCookies()
getCookies
in interface HttpServletRequest
public void addCookie(Cookie cookie)
cookie
- the cookiepublic String getHeader(String name)
getHeader
in interface HttpServletRequest
public long getDateHeader(String name)
getDateHeader
in interface HttpServletRequest
public int getIntHeader(String name)
getIntHeader
in interface HttpServletRequest
public Enumeration<String> getHeaders(String name)
getHeaders
in interface HttpServletRequest
public Enumeration<String> getHeaderNames()
getHeaderNames
in interface HttpServletRequest
public void setHeader(String name, String value)
name
- the namevalue
- the valuepublic void setDateHeader(String name, long value)
name
- the namevalue
- the valuepublic void setIntHeader(String name, int value)
name
- the namevalue
- the valuepublic void addHeader(String name, String value)
name
- the namevalue
- the valuepublic void addDateHeader(String name, long value)
name
- the namevalue
- the valuepublic void addIntHeader(String name, int value)
name
- the namevalue
- the valueprotected List<String> getHeaderList(String name)
name
- the name
public String getMethod()
getMethod
in interface HttpServletRequest
public void setMethod(String method)
method
- the methodpublic String getPathInfo()
getPathInfo
in interface HttpServletRequest
public void setPathInfo(String pathInfo)
pathInfo
- the path informationpublic String getPathTranslated()
getPathTranslated
in interface HttpServletRequest
public void setPathTranslated(String pathTranslated)
pathTranslated
- the translated pathpublic String getContextPath()
getContextPath
in interface HttpServletRequest
public String getQueryString()
getQueryString
in interface HttpServletRequest
public void setQueryString(String queryString)
queryString
- the query stringpublic String getRemoteUser()
getRemoteUser
in interface HttpServletRequest
public boolean isUserInRole(String arg0)
isUserInRole
in interface HttpServletRequest
public Principal getUserPrincipal()
getUserPrincipal
in interface HttpServletRequest
public String getRequestedSessionId()
getRequestedSessionId
in interface HttpServletRequest
public void setRequestedSessionId(String requestedSessionId)
requestedSessionId
- the requested session identifierpublic String getRequestURI()
getRequestURI
in interface HttpServletRequest
public StringBuffer getRequestURL()
getRequestURL
in interface HttpServletRequest
public String getServletPath()
getServletPath
in interface HttpServletRequest
public void setServletPath(String servletPath)
servletPath
- the servlet pathpublic HttpSession getSession(boolean create)
getSession
in interface HttpServletRequest
public HttpSession getSession()
getSession
in interface HttpServletRequest
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface HttpServletRequest
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface HttpServletRequest
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface HttpServletRequest
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface HttpServletRequest
public Object getAttribute(String name)
getAttribute
in interface ServletRequest
public Enumeration<String> getAttributeNames()
getAttributeNames
in interface ServletRequest
public void setAttribute(String name, Object value)
setAttribute
in interface ServletRequest
public void removeAttribute(String name)
removeAttribute
in interface ServletRequest
public String getCharacterEncoding()
getCharacterEncoding
in interface ServletRequest
public void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException
setCharacterEncoding
in interface ServletRequest
UnsupportedEncodingException
public int getContentLength()
getContentLength
in interface ServletRequest
public void setContentLength(int contentLength)
contentLength
- the content lengthpublic String getContentType()
getContentType
in interface ServletRequest
public void setContentType(String contentType)
contentType
- public ServletInputStream getInputStream() throws IOException
getInputStream
in interface ServletRequest
IOException
public void setInputStream(ServletInputStream inputStream)
inputStream
- the input streampublic String getParameter(String name)
getParameter
in interface ServletRequest
public Enumeration<String> getParameterNames()
getParameterNames
in interface ServletRequest
public String[] getParameterValues(String name)
getParameterValues
in interface ServletRequest
public Map<String,String[]> getParameterMap()
getParameterMap
in interface ServletRequest
public void addParameter(String name, String value)
name
- the namevalue
- the valuepublic void addParameter(String name, String[] values)
name
- the namevalues
- the valuepublic void setParameter(String name, String value)
name
- the namevalue
- the valuepublic void setParameter(String name, String[] values)
name
- the namevalues
- the valuepublic void removeParameter(String name)
name
- the namepublic String getProtocol()
getProtocol
in interface ServletRequest
public void setProtocol(String protocol)
protocol
- the protocolpublic String getScheme()
getScheme
in interface ServletRequest
public void setScheme(String scheme)
scheme
- the schemepublic String getServerName()
getServerName
in interface ServletRequest
public void setServerName(String serverName)
serverName
- the server namepublic int getServerPort()
getServerPort
in interface ServletRequest
public void setServerPort(int serverPort)
serverPort
- the server portpublic BufferedReader getReader() throws IOException
getReader
in interface ServletRequest
IOException
public void setReader(BufferedReader reader)
reader
- the buffered readerpublic String getRemoteAddr()
getRemoteAddr
in interface ServletRequest
public void setRemoteAddr(String remoteAddr)
remoteAddr
- the remote addresspublic String getRemoteHost()
getRemoteHost
in interface ServletRequest
public void setRemoteHost(String remoteHost)
remoteHost
- the remote hostpublic String getLocalAddr()
getLocalAddr
in interface ServletRequest
public void setLocalAddr(String localAddr)
localAddr
- the local addresspublic String getLocalName()
getLocalName
in interface ServletRequest
public void setLocalName(String localName)
localName
- the local namepublic int getLocalPort()
getLocalPort
in interface ServletRequest
public void setLocalPort(int localPort)
localPort
- the local portpublic int getRemotePort()
getRemotePort
in interface ServletRequest
public void setRemotePort(int remotePort)
remotePort
- the remote portpublic Locale getLocale()
getLocale
in interface ServletRequest
public void addLocale(Locale locale)
locale
- the localepublic Enumeration<Locale> getLocales()
getLocales
in interface ServletRequest
public boolean isSecure()
isSecure
in interface ServletRequest
public void setSecure(boolean secure)
secure
- the secure flagpublic RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface ServletRequest
public String getRealPath(String path)
getRealPath
in interface ServletRequest
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |