public class MockHttpServletRequest extends Object implements javax.servlet.http.HttpServletRequest
HttpServletRequest
.Constructor and Description |
---|
MockHttpServletRequest() |
public void resetAll()
public void addAttributeListener(javax.servlet.ServletRequestAttributeListener listener)
public String getParameter(String key)
getParameter
in interface javax.servlet.ServletRequest
public void clearParameters()
public String[] getParameterValues(String key)
getParameterValues
in interface javax.servlet.ServletRequest
public void setupAddParameter(String key, String[] values)
key
- the parameter keyvalues
- the parameters valuespublic void setupAddParameter(String key, String value)
key
- the parameter keyvalue
- the parameters valuepublic Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public Map getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
public void clearAttributes()
public Object getAttribute(String key)
getAttribute
in interface javax.servlet.ServletRequest
public Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletRequest
public void removeAttribute(String key)
removeAttribute
in interface javax.servlet.ServletRequest
public void setAttribute(String key, Object value)
setAttribute
in interface javax.servlet.ServletRequest
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 void setSession(javax.servlet.http.HttpSession session)
HttpSession
.session
- the HttpSession
public javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface javax.servlet.ServletRequest
public Map getRequestDispatcherMap()
RequestDispatcher
objects. The specified path
maps to the corresponding RequestDispatcher
object.RequestDispatcher
objectspublic void clearRequestDispatcherMap()
RequestDispatcher
objects.public void setRequestDispatcher(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 RequestDispatcher
dispatcher
- the RequestDispatcher
objectpublic Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
public Enumeration getLocales()
getLocales
in interface javax.servlet.ServletRequest
public void addLocale(Locale locale)
public void addLocales(List localeList)
public String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public void setMethod(String method)
public String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public void setAuthType(String authType)
public long getDateHeader(String key)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
public String getHeader(String key)
getHeader
in interface javax.servlet.http.HttpServletRequest
public Enumeration getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
public Enumeration getHeaders(String key)
getHeaders
in interface javax.servlet.http.HttpServletRequest
public int getIntHeader(String key)
getIntHeader
in interface javax.servlet.http.HttpServletRequest
public void clearHeaders()
public String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
public void setContextPath(String contextPath)
public String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
public void setPathInfo(String pathInfo)
public String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
public void setPathTranslated(String pathTranslated)
public String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
public void setQueryString(String queryString)
public String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
public void setRequestURI(String requestUri)
public StringBuffer getRequestURL()
getRequestURL
in interface javax.servlet.http.HttpServletRequest
public void setRequestURL(String requestUrl)
public String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public void setServletPath(String servletPath)
public Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public void setUserPrincipal(Principal principal)
public String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
public void setRemoteUser(String remoteUser)
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
public void addCookie(javax.servlet.http.Cookie cookie)
public String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
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 void setRequestedSessionIdFromCookie(boolean requestedSessionIdIsFromCookie)
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
public boolean isUserInRole(String role)
isUserInRole
in interface javax.servlet.http.HttpServletRequest
public void setUserInRole(String role, boolean isInRole)
public String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException
setCharacterEncoding
in interface javax.servlet.ServletRequest
UnsupportedEncodingException
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public void setContentLength(int contentLength)
public String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public void setContentType(String contentType)
public String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
public void setProtocol(String protocol)
public String getServerName()
getServerName
in interface javax.servlet.ServletRequest
public void setServerName(String serverName)
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public void setServerPort(int serverPort)
public String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public void setScheme(String scheme)
public String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public void setRemoteAddr(String remoteAddr)
public String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public void setRemoteHost(String remoteHost)
public BufferedReader getReader() throws IOException
getReader
in interface javax.servlet.ServletRequest
IOException
public javax.servlet.ServletInputStream getInputStream() throws IOException
getInputStream
in interface javax.servlet.ServletRequest
IOException
public void setBodyContent(byte[] data)
public void setBodyContent(String bodyContent)
public String getRealPath(String path)
getRealPath
in interface javax.servlet.ServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public String getLocalAddr()
getLocalAddr
in interface javax.servlet.ServletRequest
public void setLocalAddr(String localAddr)
public String getLocalName()
getLocalName
in interface javax.servlet.ServletRequest
public void setLocalName(String localName)
public int getLocalPort()
getLocalPort
in interface javax.servlet.ServletRequest
public void setLocalPort(int localPort)
public int getRemotePort()
getRemotePort
in interface javax.servlet.ServletRequest
public void setRemotePort(int remotePort)
public boolean isAsyncSupported()
public void setAsyncSupported(boolean isAsyncSupported)
Copyright © 2003–2013. All rights reserved.