public class MockHttpServletRequest extends Object implements javax.servlet.http.HttpServletRequest
| Constructor and Description |
|---|
MockHttpServletRequest() |
MockHttpServletRequest(BufferedReader bufferedReader) |
MockHttpServletRequest(javax.servlet.http.HttpSession httpSession)
Use this constructor if you want to mock out the session returned from the request
|
MockHttpServletRequest(javax.servlet.ServletInputStream servletInputStream) |
public MockHttpServletRequest()
public MockHttpServletRequest(javax.servlet.ServletInputStream servletInputStream)
public MockHttpServletRequest(BufferedReader bufferedReader)
public MockHttpServletRequest(javax.servlet.http.HttpSession httpSession)
httpSession - the session. Hint: use MockHttpSessionpublic String getAuthType()
getAuthType in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.Cookie[] getCookies()
getCookies in interface javax.servlet.http.HttpServletRequestpublic MockHttpServletRequest setCookies(javax.servlet.http.Cookie[] cookies)
public MockHttpServletRequest setCookies(Map<String,String> cookies)
public MockHttpServletRequest addCookie(javax.servlet.http.Cookie cookie)
public MockHttpServletRequest addCookie(String name, String value)
public javax.servlet.http.Cookie[] toCookies(Map<String,String> cookieMap)
cookieMap - a map of cookiespublic long getDateHeader(String string)
getDateHeader in interface javax.servlet.http.HttpServletRequestpublic String getHeader(String key)
getHeader in interface javax.servlet.http.HttpServletRequestpublic Enumeration getHeaders(String string)
public Enumeration getHeaderNames()
getHeaderNames in interface javax.servlet.http.HttpServletRequestpublic int getIntHeader(String string)
getIntHeader in interface javax.servlet.http.HttpServletRequestpublic String getMethod()
getMethod in interface javax.servlet.http.HttpServletRequestpublic void setMethod(String method)
public String getPathInfo()
getPathInfo in interface javax.servlet.http.HttpServletRequestpublic String getPathTranslated()
getPathTranslated in interface javax.servlet.http.HttpServletRequestpublic String getContextPath()
public MockHttpServletRequest setContextPath(String contextPath)
public String getQueryString()
getQueryString in interface javax.servlet.http.HttpServletRequestpublic String getRemoteUser()
getRemoteUser in interface javax.servlet.http.HttpServletRequestpublic boolean isUserInRole(String string)
public Principal getUserPrincipal()
public String getRequestedSessionId()
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestpublic String getRequestURI()
getRequestURI in interface javax.servlet.http.HttpServletRequestpublic StringBuffer getRequestURL()
public String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestpublic void setServletPath(String servletPath)
public javax.servlet.http.HttpSession getSession(boolean b)
getSession in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestpublic String changeSessionId()
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid 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 Object getAttribute(String key)
getAttribute in interface javax.servlet.ServletRequestpublic Enumeration getAttributeNames()
getAttributeNames in interface javax.servlet.ServletRequestpublic String getCharacterEncoding()
getCharacterEncoding in interface javax.servlet.ServletRequestpublic void setCharacterEncoding(String encoding) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic int getContentLength()
getContentLength in interface javax.servlet.ServletRequestpublic long getContentLengthLong()
public String getContentType()
getContentType in interface javax.servlet.ServletRequestpublic void setContentType(String contentType)
public javax.servlet.ServletInputStream getInputStream()
throws IOException
getInputStream in interface javax.servlet.ServletRequestIOExceptionpublic String getParameter(String name)
getParameter in interface javax.servlet.ServletRequestpublic Enumeration getParameterNames()
getParameterNames in interface javax.servlet.ServletRequestpublic String[] getParameterValues(String name)
getParameterValues in interface javax.servlet.ServletRequestpublic Map getParameterMap()
public String getProtocol()
getProtocol in interface javax.servlet.ServletRequestpublic String getScheme()
getScheme in interface javax.servlet.ServletRequestpublic String getServerName()
getServerName in interface javax.servlet.ServletRequestpublic int getServerPort()
getServerPort in interface javax.servlet.ServletRequestpublic BufferedReader getReader() throws IOException
getReader in interface javax.servlet.ServletRequestIOExceptionpublic String getRemoteAddr()
getRemoteAddr in interface javax.servlet.ServletRequestpublic void setRemoteAddr(String remoteAddr)
public String getRemoteHost()
getRemoteHost in interface javax.servlet.ServletRequestpublic void setAttribute(String key, Object value)
setAttribute in interface javax.servlet.ServletRequestpublic void removeAttribute(String string)
public Locale getLocale()
public Enumeration<Locale> getLocales()
public void setLocale(Locale locale)
public boolean isSecure()
public javax.servlet.RequestDispatcher getRequestDispatcher(String string)
public String getRealPath(String string)
getRealPath in interface javax.servlet.ServletRequestpublic int getRemotePort()
public String getLocalName()
public String getLocalAddr()
public int getLocalPort()
public void setRequestURL(String requestURL)
public void setProtocol(String protocol)
public boolean authenticate(javax.servlet.http.HttpServletResponse response)
throws IOException,
javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic void login(String username, String password) throws javax.servlet.ServletException
javax.servlet.ServletExceptionpublic void logout()
throws javax.servlet.ServletException
javax.servlet.ServletExceptionpublic Collection<javax.servlet.http.Part> getParts() throws IOException, javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic javax.servlet.http.Part getPart(String name) throws IOException, javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic javax.servlet.ServletContext getServletContext()
public void setServletContext(javax.servlet.ServletContext servletContext)
public javax.servlet.AsyncContext startAsync()
throws IllegalStateException
IllegalStateExceptionpublic javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse)
throws IllegalStateException
IllegalStateExceptionpublic boolean isAsyncStarted()
public boolean isAsyncSupported()
public javax.servlet.AsyncContext getAsyncContext()
public javax.servlet.DispatcherType getDispatcherType()
Copyright © 2002-2021 Atlassian. All Rights Reserved.