|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mockrunner.mock.web.MockHttpServletRequest
public class MockHttpServletRequest
Mock implementation of HttpServletRequest.
| Field Summary |
|---|
| Fields inherited from interface javax.servlet.http.HttpServletRequest |
|---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
| Constructor Summary | |
|---|---|
MockHttpServletRequest()
|
|
| Method Summary | |
|---|---|
void |
addAttributeListener(javax.servlet.ServletRequestAttributeListener listener)
|
void |
addCookie(javax.servlet.http.Cookie cookie)
|
void |
addHeader(java.lang.String key,
java.lang.String value)
|
void |
addLocale(java.util.Locale locale)
|
void |
addLocales(java.util.List localeList)
|
void |
clearAttributes()
|
void |
clearHeaders()
|
void |
clearParameters()
Clears the parameters. |
void |
clearRequestDispatcherMap()
Clears the map of RequestDispatcher objects. |
java.lang.Object |
getAttribute(java.lang.String key)
|
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[] |
getCookies()
|
long |
getDateHeader(java.lang.String key)
|
java.lang.String |
getHeader(java.lang.String key)
|
java.util.Enumeration |
getHeaderNames()
|
java.util.Enumeration |
getHeaders(java.lang.String key)
|
javax.servlet.ServletInputStream |
getInputStream()
|
int |
getIntHeader(java.lang.String key)
|
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 key)
|
java.util.Map |
getParameterMap()
|
java.util.Enumeration |
getParameterNames()
|
java.lang.String[] |
getParameterValues(java.lang.String key)
|
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(java.lang.String path)
|
java.util.Map |
getRequestDispatcherMap()
Returns the map of RequestDispatcher objects. |
java.lang.String |
getRequestedSessionId()
|
java.lang.String |
getRequestURI()
|
java.lang.StringBuffer |
getRequestURL()
|
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 key)
|
void |
resetAll()
Resets the state of this object to the default values |
void |
setAttribute(java.lang.String key,
java.lang.Object value)
|
void |
setAuthType(java.lang.String authType)
|
void |
setBodyContent(byte[] data)
|
void |
setBodyContent(java.lang.String bodyContent)
|
void |
setCharacterEncoding(java.lang.String characterEncoding)
|
void |
setContentLength(int contentLength)
|
void |
setContentType(java.lang.String contentType)
|
void |
setContextPath(java.lang.String contextPath)
|
void |
setHeader(java.lang.String key,
java.lang.String value)
|
void |
setLocalAddr(java.lang.String localAddr)
|
void |
setLocalName(java.lang.String localName)
|
void |
setLocalPort(int localPort)
|
void |
setMethod(java.lang.String method)
|
void |
setPathInfo(java.lang.String pathInfo)
|
void |
setPathTranslated(java.lang.String pathTranslated)
|
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 |
setRequestDispatcher(java.lang.String path,
javax.servlet.RequestDispatcher dispatcher)
Sets a RequestDispatcher that will be returned when calling
getRequestDispatcher(java.lang.String) with the specified path. |
void |
setRequestedSessionIdFromCookie(boolean requestedSessionIdIsFromCookie)
|
void |
setRequestURI(java.lang.String requestUri)
|
void |
setRequestURL(java.lang.String requestUrl)
|
void |
setScheme(java.lang.String scheme)
|
void |
setServerName(java.lang.String serverName)
|
void |
setServerPort(int serverPort)
|
void |
setServletPath(java.lang.String servletPath)
|
void |
setSession(javax.servlet.http.HttpSession session)
Sets the HttpSession. |
void |
setupAddParameter(java.lang.String key,
java.lang.String value)
Adds a request parameter. |
void |
setupAddParameter(java.lang.String key,
java.lang.String[] values)
Adds a request multivalue parameter. |
void |
setUserInRole(java.lang.String role,
boolean isInRole)
|
void |
setUserPrincipal(java.security.Principal principal)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockHttpServletRequest()
| Method Detail |
|---|
public void resetAll()
public void addAttributeListener(javax.servlet.ServletRequestAttributeListener listener)
public java.lang.String getParameter(java.lang.String key)
getParameter in interface javax.servlet.ServletRequestpublic void clearParameters()
public java.lang.String[] getParameterValues(java.lang.String key)
getParameterValues in interface javax.servlet.ServletRequest
public void setupAddParameter(java.lang.String key,
java.lang.String[] values)
key - the parameter keyvalues - the parameters values
public void setupAddParameter(java.lang.String key,
java.lang.String value)
key - the parameter keyvalue - the parameters valuepublic java.util.Enumeration getParameterNames()
getParameterNames in interface javax.servlet.ServletRequestpublic java.util.Map getParameterMap()
getParameterMap in interface javax.servlet.ServletRequestpublic void clearAttributes()
public java.lang.Object getAttribute(java.lang.String key)
getAttribute in interface javax.servlet.ServletRequestpublic java.util.Enumeration getAttributeNames()
getAttributeNames in interface javax.servlet.ServletRequestpublic void removeAttribute(java.lang.String key)
removeAttribute in interface javax.servlet.ServletRequest
public void setAttribute(java.lang.String key,
java.lang.Object value)
setAttribute in interface javax.servlet.ServletRequestpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession(boolean create)
getSession in interface javax.servlet.http.HttpServletRequestpublic void setSession(javax.servlet.http.HttpSession session)
HttpSession.
session - the HttpSessionpublic javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher in interface javax.servlet.ServletRequestpublic java.util.Map getRequestDispatcherMap()
RequestDispatcher objects. The specified path
maps to the corresponding RequestDispatcher object.
RequestDispatcher objectspublic void clearRequestDispatcherMap()
RequestDispatcher objects.
public void setRequestDispatcher(java.lang.String path,
javax.servlet.RequestDispatcher dispatcher)
RequestDispatcher that will be returned when calling
getRequestDispatcher(java.lang.String) with the specified path. If no RequestDispatcher
is set for the specified path, getRequestDispatcher(java.lang.String) automatically creates a
new one.
path - the path for the RequestDispatcherdispatcher - the RequestDispatcher objectpublic java.util.Locale getLocale()
getLocale in interface javax.servlet.ServletRequestpublic java.util.Enumeration getLocales()
getLocales in interface javax.servlet.ServletRequestpublic void addLocale(java.util.Locale locale)
public void addLocales(java.util.List localeList)
public java.lang.String getMethod()
getMethod in interface javax.servlet.http.HttpServletRequestpublic void setMethod(java.lang.String method)
public java.lang.String getAuthType()
getAuthType in interface javax.servlet.http.HttpServletRequestpublic void setAuthType(java.lang.String authType)
public long getDateHeader(java.lang.String key)
getDateHeader in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getHeader(java.lang.String key)
getHeader in interface javax.servlet.http.HttpServletRequestpublic java.util.Enumeration getHeaderNames()
getHeaderNames in interface javax.servlet.http.HttpServletRequestpublic java.util.Enumeration getHeaders(java.lang.String key)
getHeaders in interface javax.servlet.http.HttpServletRequestpublic int getIntHeader(java.lang.String key)
getIntHeader in interface javax.servlet.http.HttpServletRequest
public void addHeader(java.lang.String key,
java.lang.String value)
public void setHeader(java.lang.String key,
java.lang.String value)
public void clearHeaders()
public java.lang.String getContextPath()
getContextPath in interface javax.servlet.http.HttpServletRequestpublic void setContextPath(java.lang.String contextPath)
public java.lang.String getPathInfo()
getPathInfo in interface javax.servlet.http.HttpServletRequestpublic void setPathInfo(java.lang.String pathInfo)
public java.lang.String getPathTranslated()
getPathTranslated in interface javax.servlet.http.HttpServletRequestpublic void setPathTranslated(java.lang.String pathTranslated)
public java.lang.String getQueryString()
getQueryString in interface javax.servlet.http.HttpServletRequestpublic void setQueryString(java.lang.String queryString)
public java.lang.String getRequestURI()
getRequestURI in interface javax.servlet.http.HttpServletRequestpublic void setRequestURI(java.lang.String requestUri)
public java.lang.StringBuffer getRequestURL()
getRequestURL in interface javax.servlet.http.HttpServletRequestpublic void setRequestURL(java.lang.String requestUrl)
public java.lang.String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestpublic void setServletPath(java.lang.String servletPath)
public java.security.Principal getUserPrincipal()
getUserPrincipal in interface javax.servlet.http.HttpServletRequestpublic void setUserPrincipal(java.security.Principal principal)
public java.lang.String getRemoteUser()
getRemoteUser in interface javax.servlet.http.HttpServletRequestpublic void setRemoteUser(java.lang.String remoteUser)
public javax.servlet.http.Cookie[] getCookies()
getCookies in interface javax.servlet.http.HttpServletRequestpublic void addCookie(javax.servlet.http.Cookie cookie)
public java.lang.String getRequestedSessionId()
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequestpublic void setRequestedSessionIdFromCookie(boolean requestedSessionIdIsFromCookie)
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequestpublic boolean isUserInRole(java.lang.String role)
isUserInRole in interface javax.servlet.http.HttpServletRequest
public void setUserInRole(java.lang.String role,
boolean isInRole)
public java.lang.String getCharacterEncoding()
getCharacterEncoding in interface javax.servlet.ServletRequest
public void setCharacterEncoding(java.lang.String characterEncoding)
throws java.io.UnsupportedEncodingException
setCharacterEncoding in interface javax.servlet.ServletRequestjava.io.UnsupportedEncodingExceptionpublic int getContentLength()
getContentLength in interface javax.servlet.ServletRequestpublic void setContentLength(int contentLength)
public java.lang.String getContentType()
getContentType in interface javax.servlet.ServletRequestpublic void setContentType(java.lang.String contentType)
public java.lang.String getProtocol()
getProtocol in interface javax.servlet.ServletRequestpublic void setProtocol(java.lang.String protocol)
public java.lang.String getServerName()
getServerName in interface javax.servlet.ServletRequestpublic void setServerName(java.lang.String serverName)
public int getServerPort()
getServerPort in interface javax.servlet.ServletRequestpublic void setServerPort(int serverPort)
public java.lang.String getScheme()
getScheme in interface javax.servlet.ServletRequestpublic void setScheme(java.lang.String scheme)
public java.lang.String getRemoteAddr()
getRemoteAddr in interface javax.servlet.ServletRequestpublic void setRemoteAddr(java.lang.String remoteAddr)
public java.lang.String getRemoteHost()
getRemoteHost in interface javax.servlet.ServletRequestpublic void setRemoteHost(java.lang.String remoteHost)
public java.io.BufferedReader getReader()
throws java.io.IOException
getReader in interface javax.servlet.ServletRequestjava.io.IOException
public javax.servlet.ServletInputStream getInputStream()
throws java.io.IOException
getInputStream in interface javax.servlet.ServletRequestjava.io.IOExceptionpublic void setBodyContent(byte[] data)
public void setBodyContent(java.lang.String bodyContent)
public java.lang.String getRealPath(java.lang.String path)
getRealPath in interface javax.servlet.ServletRequestpublic boolean isSecure()
isSecure in interface javax.servlet.ServletRequestpublic java.lang.String getLocalAddr()
getLocalAddr in interface javax.servlet.ServletRequestpublic void setLocalAddr(java.lang.String localAddr)
public java.lang.String getLocalName()
getLocalName in interface javax.servlet.ServletRequestpublic void setLocalName(java.lang.String localName)
public int getLocalPort()
getLocalPort in interface javax.servlet.ServletRequestpublic void setLocalPort(int localPort)
public int getRemotePort()
getRemotePort in interface javax.servlet.ServletRequestpublic void setRemotePort(int remotePort)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||