|
||||||||||
| 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 null| Method Detail |
|---|
public String getAuthType()
getAuthType in interface HttpServletRequestpublic void setAuthType(String authType)
authType - the authority typepublic Cookie[] getCookies()
getCookies in interface HttpServletRequestpublic void addCookie(Cookie cookie)
cookie - the cookiepublic String getHeader(String name)
getHeader in interface HttpServletRequestpublic long getDateHeader(String name)
getDateHeader in interface HttpServletRequestpublic int getIntHeader(String name)
getIntHeader in interface HttpServletRequestpublic Enumeration<String> getHeaders(String name)
getHeaders in interface HttpServletRequestpublic Enumeration<String> getHeaderNames()
getHeaderNames in interface HttpServletRequest
public void setHeader(String name,
String value)
name - the namevalue - the value
public void setDateHeader(String name,
long value)
name - the namevalue - the value
public void setIntHeader(String name,
int value)
name - the namevalue - the value
public void addHeader(String name,
String value)
name - the namevalue - the value
public void addDateHeader(String name,
long value)
name - the namevalue - the value
public 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 HttpServletRequestpublic void setMethod(String method)
method - the methodpublic String getPathInfo()
getPathInfo in interface HttpServletRequestpublic void setPathInfo(String pathInfo)
pathInfo - the path informationpublic String getPathTranslated()
getPathTranslated in interface HttpServletRequestpublic void setPathTranslated(String pathTranslated)
pathTranslated - the translated pathpublic String getContextPath()
getContextPath in interface HttpServletRequestpublic String getQueryString()
getQueryString in interface HttpServletRequestpublic void setQueryString(String queryString)
queryString - the query stringpublic String getRemoteUser()
getRemoteUser in interface HttpServletRequestpublic boolean isUserInRole(String arg0)
isUserInRole in interface HttpServletRequestpublic Principal getUserPrincipal()
getUserPrincipal in interface HttpServletRequestpublic String getRequestedSessionId()
getRequestedSessionId in interface HttpServletRequestpublic void setRequestedSessionId(String requestedSessionId)
requestedSessionId - the requested session identifierpublic String getRequestURI()
getRequestURI in interface HttpServletRequestpublic StringBuffer getRequestURL()
getRequestURL in interface HttpServletRequestpublic String getServletPath()
getServletPath in interface HttpServletRequestpublic void setServletPath(String servletPath)
servletPath - the servlet pathpublic HttpSession getSession(boolean create)
getSession in interface HttpServletRequestpublic HttpSession getSession()
getSession in interface HttpServletRequestpublic boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in interface HttpServletRequestpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in interface HttpServletRequestpublic boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in interface HttpServletRequestpublic boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in interface HttpServletRequestpublic Object getAttribute(String name)
getAttribute in interface ServletRequestpublic Enumeration<String> getAttributeNames()
getAttributeNames in interface ServletRequest
public void setAttribute(String name,
Object value)
setAttribute in interface ServletRequestpublic void removeAttribute(String name)
removeAttribute in interface ServletRequestpublic String getCharacterEncoding()
getCharacterEncoding in interface ServletRequest
public void setCharacterEncoding(String characterEncoding)
throws UnsupportedEncodingException
setCharacterEncoding in interface ServletRequestUnsupportedEncodingExceptionpublic int getContentLength()
getContentLength in interface ServletRequestpublic void setContentLength(int contentLength)
contentLength - the content lengthpublic String getContentType()
getContentType in interface ServletRequestpublic void setContentType(String contentType)
contentType -
public ServletInputStream getInputStream()
throws IOException
getInputStream in interface ServletRequestIOExceptionpublic void setInputStream(ServletInputStream inputStream)
inputStream - the input streampublic String getParameter(String name)
getParameter in interface ServletRequestpublic Enumeration<String> getParameterNames()
getParameterNames in interface ServletRequestpublic String[] getParameterValues(String name)
getParameterValues in interface ServletRequestpublic Map<String,String[]> getParameterMap()
getParameterMap in interface ServletRequest
public void addParameter(String name,
String value)
name - the namevalue - the value
public void addParameter(String name,
String[] values)
name - the namevalues - the value
public void setParameter(String name,
String value)
name - the namevalue - the value
public void setParameter(String name,
String[] values)
name - the namevalues - the valuepublic void removeParameter(String name)
name - the namepublic String getProtocol()
getProtocol in interface ServletRequestpublic void setProtocol(String protocol)
protocol - the protocolpublic String getScheme()
getScheme in interface ServletRequestpublic void setScheme(String scheme)
scheme - the schemepublic String getServerName()
getServerName in interface ServletRequestpublic void setServerName(String serverName)
serverName - the server namepublic int getServerPort()
getServerPort in interface ServletRequestpublic void setServerPort(int serverPort)
serverPort - the server port
public BufferedReader getReader()
throws IOException
getReader in interface ServletRequestIOExceptionpublic void setReader(BufferedReader reader)
reader - the buffered readerpublic String getRemoteAddr()
getRemoteAddr in interface ServletRequestpublic void setRemoteAddr(String remoteAddr)
remoteAddr - the remote addresspublic String getRemoteHost()
getRemoteHost in interface ServletRequestpublic void setRemoteHost(String remoteHost)
remoteHost - the remote hostpublic String getLocalAddr()
getLocalAddr in interface ServletRequestpublic void setLocalAddr(String localAddr)
localAddr - the local addresspublic String getLocalName()
getLocalName in interface ServletRequestpublic void setLocalName(String localName)
localName - the local namepublic int getLocalPort()
getLocalPort in interface ServletRequestpublic void setLocalPort(int localPort)
localPort - the local portpublic int getRemotePort()
getRemotePort in interface ServletRequestpublic void setRemotePort(int remotePort)
remotePort - the remote portpublic Locale getLocale()
getLocale in interface ServletRequestpublic void addLocale(Locale locale)
locale - the localepublic Enumeration<Locale> getLocales()
getLocales in interface ServletRequestpublic boolean isSecure()
isSecure in interface ServletRequestpublic void setSecure(boolean secure)
secure - the secure flagpublic RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface ServletRequestpublic String getRealPath(String path)
getRealPath in interface ServletRequest
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||