Class MockHttpServletRequest
java.lang.Object
org.exoplatform.services.test.mock.MockHttpServletRequest
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest
The Class MockHttpServletRequest.
- Version:
- $Id: $
- Author:
- Max Shaposhnik
-
Field Summary
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Constructor Summary
ConstructorsConstructorDescriptionMockHttpServletRequest(String url, InputStream data, int length, String method, Map<String, List<String>> headers) Instantiates a new mock http servlet request. -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(javax.servlet.http.HttpServletResponse response) javax.servlet.AsyncContextgetAttribute(String name) intlongjavax.servlet.http.Cookie[]longgetDateHeader(String name) javax.servlet.DispatcherTypegetHeaders(String name) javax.servlet.ServletInputStreamintgetIntHeader(String name) Gets the local addr.Gets the local name.intGets the local port.getParameter(String name) String[]getParameterValues(String name) javax.servlet.http.PartCollection<javax.servlet.http.Part>getParts()getRealPath(String arg0) intGets the remote port.javax.servlet.RequestDispatcherintjavax.servlet.ServletContextjavax.servlet.http.HttpSessionjavax.servlet.http.HttpSessiongetSession(boolean b) booleanbooleanbooleanbooleanbooleanbooleanbooleanisSecure()booleanisUserInRole(String role) voidvoidlogout()parseQueryString(String rawQuery) voidremoveAttribute(String name) voidreset()Reset.voidsetAttribute(String name, Object object) voidvoidsetParameter(String name, String value) Sets the parameter.javax.servlet.AsyncContextjavax.servlet.AsyncContextstartAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) <T extends javax.servlet.http.HttpUpgradeHandler>
TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.servlet.http.HttpServletRequest
getHttpServletMapping, getTrailerFields, isTrailerFieldsReady, newPushBuilder
-
Constructor Details
-
Method Details
-
reset
public void reset()Reset. -
getAttribute
- Specified by:
getAttributein interfacejavax.servlet.ServletRequest
-
getAttributeNames
- Specified by:
getAttributeNamesin interfacejavax.servlet.ServletRequest
-
getAuthType
- Specified by:
getAuthTypein interfacejavax.servlet.http.HttpServletRequest
-
getCharacterEncoding
- Specified by:
getCharacterEncodingin interfacejavax.servlet.ServletRequest
-
getContentLength
public int getContentLength()- Specified by:
getContentLengthin interfacejavax.servlet.ServletRequest
-
getContentType
- Specified by:
getContentTypein interfacejavax.servlet.ServletRequest
-
getContextPath
- Specified by:
getContextPathin interfacejavax.servlet.http.HttpServletRequest
-
getCookies
public javax.servlet.http.Cookie[] getCookies()- Specified by:
getCookiesin interfacejavax.servlet.http.HttpServletRequest
-
getDateHeader
- Specified by:
getDateHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getHeader
- Specified by:
getHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getHeaderNames
- Specified by:
getHeaderNamesin interfacejavax.servlet.http.HttpServletRequest
-
getHeaders
- Specified by:
getHeadersin interfacejavax.servlet.http.HttpServletRequest
-
getInputStream
- Specified by:
getInputStreamin interfacejavax.servlet.ServletRequest- Throws:
IOException
-
getIntHeader
- Specified by:
getIntHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getLocalAddr
Gets the local addr.- Specified by:
getLocalAddrin interfacejavax.servlet.ServletRequest- Returns:
- the local addr
-
getLocale
- Specified by:
getLocalein interfacejavax.servlet.ServletRequest
-
getLocales
- Specified by:
getLocalesin interfacejavax.servlet.ServletRequest
-
getLocalName
Gets the local name.- Specified by:
getLocalNamein interfacejavax.servlet.ServletRequest- Returns:
- the local name
-
getLocalPort
public int getLocalPort()Gets the local port.- Specified by:
getLocalPortin interfacejavax.servlet.ServletRequest- Returns:
- the local port
-
getMethod
- Specified by:
getMethodin interfacejavax.servlet.http.HttpServletRequest
-
getParameter
- Specified by:
getParameterin interfacejavax.servlet.ServletRequest
-
getParameterMap
- Specified by:
getParameterMapin interfacejavax.servlet.ServletRequest
-
getParameterNames
- Specified by:
getParameterNamesin interfacejavax.servlet.ServletRequest
-
getParameterValues
- Specified by:
getParameterValuesin interfacejavax.servlet.ServletRequest
-
getPathInfo
- Specified by:
getPathInfoin interfacejavax.servlet.http.HttpServletRequest
-
getPathTranslated
- Specified by:
getPathTranslatedin interfacejavax.servlet.http.HttpServletRequest
-
getProtocol
- Specified by:
getProtocolin interfacejavax.servlet.ServletRequest
-
getQueryString
- Specified by:
getQueryStringin interfacejavax.servlet.http.HttpServletRequest
-
getReader
- Specified by:
getReaderin interfacejavax.servlet.ServletRequest- Throws:
IOException
-
getRealPath
- Specified by:
getRealPathin interfacejavax.servlet.ServletRequest
-
getRemoteAddr
- Specified by:
getRemoteAddrin interfacejavax.servlet.ServletRequest
-
getRemoteHost
- Specified by:
getRemoteHostin interfacejavax.servlet.ServletRequest
-
getRemotePort
public int getRemotePort()Gets the remote port.- Specified by:
getRemotePortin interfacejavax.servlet.ServletRequest- Returns:
- the remote port
-
getRemoteUser
- Specified by:
getRemoteUserin interfacejavax.servlet.http.HttpServletRequest
-
getRequestDispatcher
- Specified by:
getRequestDispatcherin interfacejavax.servlet.ServletRequest
-
getRequestedSessionId
- Specified by:
getRequestedSessionIdin interfacejavax.servlet.http.HttpServletRequest
-
getRequestURI
- Specified by:
getRequestURIin interfacejavax.servlet.http.HttpServletRequest
-
getRequestURL
- Specified by:
getRequestURLin interfacejavax.servlet.http.HttpServletRequest
-
getScheme
- Specified by:
getSchemein interfacejavax.servlet.ServletRequest
-
getServerName
- Specified by:
getServerNamein interfacejavax.servlet.ServletRequest
-
getServerPort
public int getServerPort()- Specified by:
getServerPortin interfacejavax.servlet.ServletRequest
-
getServletPath
- Specified by:
getServletPathin interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession()- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession(boolean b) - Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest
-
getUserPrincipal
- Specified by:
getUserPrincipalin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()- Specified by:
isRequestedSessionIdFromCookiein interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()- Specified by:
isRequestedSessionIdFromUrlin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()- Specified by:
isRequestedSessionIdFromURLin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()- Specified by:
isRequestedSessionIdValidin interfacejavax.servlet.http.HttpServletRequest
-
isSecure
public boolean isSecure()- Specified by:
isSecurein interfacejavax.servlet.ServletRequest
-
isUserInRole
- Specified by:
isUserInRolein interfacejavax.servlet.http.HttpServletRequest
-
removeAttribute
- Specified by:
removeAttributein interfacejavax.servlet.ServletRequest
-
setAttribute
- Specified by:
setAttributein interfacejavax.servlet.ServletRequest
-
setCharacterEncoding
- Specified by:
setCharacterEncodingin interfacejavax.servlet.ServletRequest- Throws:
UnsupportedEncodingException
-
setParameter
Sets the parameter.- Parameters:
name- the namevalue- the value
-
parseQueryString
-
getServletContext
public javax.servlet.ServletContext getServletContext()- Specified by:
getServletContextin interfacejavax.servlet.ServletRequest
-
startAsync
- Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
IllegalStateException
-
startAsync
public javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws IllegalStateException - Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
IllegalStateException
-
isAsyncStarted
public boolean isAsyncStarted()- Specified by:
isAsyncStartedin interfacejavax.servlet.ServletRequest
-
isAsyncSupported
public boolean isAsyncSupported()- Specified by:
isAsyncSupportedin interfacejavax.servlet.ServletRequest
-
getAsyncContext
public javax.servlet.AsyncContext getAsyncContext()- Specified by:
getAsyncContextin interfacejavax.servlet.ServletRequest
-
getDispatcherType
public javax.servlet.DispatcherType getDispatcherType()- Specified by:
getDispatcherTypein interfacejavax.servlet.ServletRequest
-
authenticate
public boolean authenticate(javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException - Specified by:
authenticatein interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
login
- Specified by:
loginin interfacejavax.servlet.http.HttpServletRequest- Throws:
javax.servlet.ServletException
-
logout
public void logout() throws javax.servlet.ServletException- Specified by:
logoutin interfacejavax.servlet.http.HttpServletRequest- Throws:
javax.servlet.ServletException
-
getParts
public Collection<javax.servlet.http.Part> getParts() throws IOException, javax.servlet.ServletException- Specified by:
getPartsin interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
getPart
public javax.servlet.http.Part getPart(String name) throws IOException, javax.servlet.ServletException - Specified by:
getPartin interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
getContentLengthLong
public long getContentLengthLong()- Specified by:
getContentLengthLongin interfacejavax.servlet.ServletRequest
-
changeSessionId
- Specified by:
changeSessionIdin interfacejavax.servlet.http.HttpServletRequest
-
upgrade
public <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, javax.servlet.ServletException - Specified by:
upgradein interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-