@Deprecated public class MockServletRequest extends Object implements HttpServletRequest, MockHttpRequest
HttpServletRequest for mocking purposes.BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH| Constructor and Description |
|---|
MockServletRequest()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
MockServletRequest |
accept(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
acceptCharset(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
acceptEncoding(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
acceptLanguage(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
attribute(String name,
Object value)
Deprecated.
Fluent setter.
|
boolean |
authenticate(HttpServletResponse response)
Deprecated.
|
MockServletRequest |
authorization(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
authType(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
body(Object value)
Deprecated.
Fluent setter.
|
MockServletRequest |
cacheControl(Object value)
Deprecated.
Specifies the
|
String |
changeSessionId()
Deprecated.
|
MockServletRequest |
characterEncoding(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
clientVersion(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
connection(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
contentEncoding(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
contentLength(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
contentType(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
contextPath(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
cookies(Cookie[] value)
Deprecated.
Fluent setter.
|
static MockServletRequest |
create()
Deprecated.
Creates a new servlet request.
|
static MockServletRequest |
create(String method,
String path,
Object... pathArgs)
Deprecated.
Creates a new servlet request with the specified method name and request path.
|
MockServletRequest |
date(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
debug()
Deprecated.
Enabled debug mode on this request.
|
MockServletRequest |
dispatcherType(DispatcherType value)
Deprecated.
Fluent setter.
|
MockServletResponse |
execute()
Deprecated.
Executes this request and returns the response object.
|
MockServletRequest |
expect(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
formData(String key,
Object value)
Deprecated.
Adds a form data entry to this request.
|
MockServletRequest |
from(Object value)
Deprecated.
Specifies the
|
AsyncContext |
getAsyncContext()
Deprecated.
|
Object |
getAttribute(String name)
Deprecated.
|
Enumeration<String> |
getAttributeNames()
Deprecated.
|
String |
getAuthType()
Deprecated.
|
String |
getCharacterEncoding()
Deprecated.
|
int |
getContentLength()
Deprecated.
|
long |
getContentLengthLong()
Deprecated.
|
String |
getContentType()
Deprecated.
|
String |
getContextPath()
Deprecated.
|
Cookie[] |
getCookies()
Deprecated.
|
long |
getDateHeader(String name)
Deprecated.
|
DispatcherType |
getDispatcherType()
Deprecated.
|
String |
getHeader(String name)
Deprecated.
|
Enumeration<String> |
getHeaderNames()
Deprecated.
|
Enumeration<String> |
getHeaders(String name)
Deprecated.
|
ServletInputStream |
getInputStream()
Deprecated.
|
int |
getIntHeader(String name)
Deprecated.
|
String |
getLocalAddr()
Deprecated.
|
Locale |
getLocale()
Deprecated.
|
Enumeration<Locale> |
getLocales()
Deprecated.
|
String |
getLocalName()
Deprecated.
|
int |
getLocalPort()
Deprecated.
|
String |
getMethod()
Deprecated.
|
String |
getParameter(String name)
Deprecated.
|
Map<String,String[]> |
getParameterMap()
Deprecated.
|
Enumeration<String> |
getParameterNames()
Deprecated.
|
String[] |
getParameterValues(String name)
Deprecated.
|
Part |
getPart(String name)
Deprecated.
|
Collection<Part> |
getParts()
Deprecated.
|
String |
getPathInfo()
Deprecated.
|
String |
getPathTranslated()
Deprecated.
|
String |
getProtocol()
Deprecated.
|
String |
getQueryString()
Deprecated.
|
BufferedReader |
getReader()
Deprecated.
|
String |
getRealPath(String path)
Deprecated.
|
String |
getRemoteAddr()
Deprecated.
|
String |
getRemoteHost()
Deprecated.
|
int |
getRemotePort()
Deprecated.
|
String |
getRemoteUser()
Deprecated.
|
RequestDispatcher |
getRequestDispatcher(String path)
Deprecated.
|
String |
getRequestedSessionId()
Deprecated.
|
String |
getRequestURI()
Deprecated.
|
StringBuffer |
getRequestURL()
Deprecated.
|
String |
getScheme()
Deprecated.
|
String |
getServerName()
Deprecated.
|
int |
getServerPort()
Deprecated.
|
ServletContext |
getServletContext()
Deprecated.
|
String |
getServletPath()
Deprecated.
|
HttpSession |
getSession()
Deprecated.
|
HttpSession |
getSession(boolean create)
Deprecated.
|
Principal |
getUserPrincipal()
Deprecated.
|
MockServletRequest |
header(String name,
Object value)
Deprecated.
Fluent setter.
|
MockServletRequest |
host(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
html()
Deprecated.
Convenience method for setting
|
MockServletRequest |
httpSession(HttpSession value)
Deprecated.
Fluent setter.
|
MockServletRequest |
ifMatch(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
ifModifiedSince(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
ifNoneMatch(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
ifRange(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
ifUnmodifiedSince(Object value)
Deprecated.
Specifies the
|
boolean |
isAsyncStarted()
Deprecated.
|
boolean |
isAsyncSupported()
Deprecated.
|
boolean |
isRequestedSessionIdFromCookie()
Deprecated.
|
boolean |
isRequestedSessionIdFromUrl()
Deprecated.
|
boolean |
isRequestedSessionIdFromURL()
Deprecated.
|
boolean |
isRequestedSessionIdValid()
Deprecated.
|
boolean |
isSecure()
Deprecated.
|
boolean |
isUserInRole(String role)
Deprecated.
|
MockServletRequest |
json()
Deprecated.
Convenience method for setting
|
MockServletRequest |
localAddr(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
locale(Locale value)
Deprecated.
Fluent setter.
|
MockServletRequest |
localName(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
localPort(int value)
Deprecated.
Fluent setter.
|
void |
login(String username,
String password)
Deprecated.
|
void |
logout()
Deprecated.
|
MockServletRequest |
maxForwards(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
method(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
msgpack()
Deprecated.
Convenience method for setting
|
MockServletRequest |
pathInfo(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
pathTranslated(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
plainText()
Deprecated.
Convenience method for setting
|
MockServletRequest |
pragma(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
protocol(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
proxyAuthorization(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
query(String key,
Object value)
Deprecated.
Adds a query data entry to this request.
|
MockServletRequest |
queryString(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
range(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
realPath(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
referer(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
remoteAddr(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
remoteHost(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
remotePort(int value)
Deprecated.
Fluent setter.
|
MockServletRequest |
remoteUser(String value)
Deprecated.
Fluent setter.
|
void |
removeAttribute(String name)
Deprecated.
|
MockServletRequest |
requestDispatcher(RequestDispatcher value)
Deprecated.
Fluent setter.
|
MockServletRequest |
requestedSessionId(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
requestURI(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
restContext(RestContext restContext)
Deprecated.
Fluent setter.
|
MockServletRequest |
scheme(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
serverName(String value)
Deprecated.
Fluent setter.
|
MockServletRequest |
serverPort(int value)
Deprecated.
Fluent setter.
|
MockServletRequest |
servletContext(ServletContext value)
Deprecated.
Fluent setter.
|
MockServletRequest |
servletPath(String value)
Deprecated.
Fluent setter.
|
void |
setAttribute(String name,
Object o)
Deprecated.
|
void |
setCharacterEncoding(String characterEncoding)
Deprecated.
|
AsyncContext |
startAsync()
Deprecated.
|
AsyncContext |
startAsync(ServletRequest servletRequest,
ServletResponse servletResponse)
Deprecated.
|
MockServletRequest |
te(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
uon()
Deprecated.
Convenience method for setting
|
<T extends HttpUpgradeHandler> |
upgrade(Class<T> handlerClass)
Deprecated.
|
MockServletRequest |
upgrade(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
uri(String uri)
Deprecated.
Fluent setter.
|
MockServletRequest |
urlEnc()
Deprecated.
Convenience method for setting
|
MockServletRequest |
userAgent(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
userPrincipal(Principal value)
Deprecated.
Fluent setter.
|
MockServletRequest |
warning(Object value)
Deprecated.
Specifies the
|
MockServletRequest |
xml()
Deprecated.
Convenience method for setting
|
MockServletRequest |
yaml()
Deprecated.
Convenience method for setting
|
public MockServletRequest()
public static MockServletRequest create()
public static MockServletRequest create(String method, String path, Object... pathArgs)
method - The HTTP method name.path - The request path.pathArgs - Optional path arguments.public MockServletRequest json()
public MockServletRequest xml()
public MockServletRequest html()
public MockServletRequest plainText()
public MockServletRequest msgpack()
public MockServletRequest uon()
public MockServletRequest urlEnc()
public MockServletRequest yaml()
public MockServletRequest uri(String uri)
uri in interface MockHttpRequesturi - The URI of the request.public MockServletRequest restContext(RestContext restContext)
restContext - The rest context.public MockServletResponse execute() throws Exception
execute in interface MockHttpRequestException - Error occurred.public MockServletRequest method(String value)
method in interface MockHttpRequestvalue - The method name for this request.public MockServletRequest characterEncoding(String value)
value - The character encoding.public MockServletRequest protocol(String value)
value - The protocol.public MockServletRequest scheme(String value)
value - The scheme.public MockServletRequest serverName(String value)
value - The server name.public MockServletRequest serverPort(int value)
value - The server port.public MockServletRequest remoteAddr(String value)
value - The remote address.public MockServletRequest remoteHost(String value)
value - The remote port.public MockServletRequest locale(Locale value)
value - The locale.public MockServletRequest realPath(String value)
value - The real path.public MockServletRequest remotePort(int value)
value - The remote port.public MockServletRequest localName(String value)
value - The local name.public MockServletRequest localAddr(String value)
value - The local address.public MockServletRequest localPort(int value)
value - The local port.public MockServletRequest requestDispatcher(RequestDispatcher value)
value - The request dispatcher.public MockServletRequest servletContext(ServletContext value)
value - The servlet context.public MockServletRequest dispatcherType(DispatcherType value)
value - The dispatcher type.public MockServletRequest authType(String value)
value - The auth type.public MockServletRequest cookies(Cookie[] value)
value - The cookies.public MockServletRequest pathInfo(String value)
value - The path info.public MockServletRequest pathTranslated(String value)
value - The path translated.public MockServletRequest contextPath(String value)
value - The context path.public MockServletRequest queryString(String value)
value - The query string.public MockServletRequest remoteUser(String value)
value - The remote user.public MockServletRequest userPrincipal(Principal value)
value - The user principal.public MockServletRequest requestedSessionId(String value)
value - The requested session ID.public MockServletRequest requestURI(String value)
value - The request URI.public MockServletRequest servletPath(String value)
value - The servlet path.public MockServletRequest httpSession(HttpSession value)
value - The HTTP session.public Object getAttribute(String name)
getAttribute in interface ServletRequestpublic Enumeration<String> getAttributeNames()
getAttributeNames in interface ServletRequestpublic String getCharacterEncoding()
getCharacterEncoding in interface ServletRequestpublic void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException
setCharacterEncoding in interface ServletRequestUnsupportedEncodingExceptionpublic int getContentLength()
getContentLength in interface ServletRequestpublic long getContentLengthLong()
getContentLengthLong in interface ServletRequestpublic String getContentType()
getContentType in interface ServletRequestpublic ServletInputStream getInputStream() throws IOException
getInputStream in interface ServletRequestIOExceptionpublic 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 ServletRequestpublic String getProtocol()
getProtocol in interface ServletRequestpublic String getScheme()
getScheme in interface ServletRequestpublic String getServerName()
getServerName in interface ServletRequestpublic int getServerPort()
getServerPort in interface ServletRequestpublic BufferedReader getReader() throws IOException
getReader in interface ServletRequestIOExceptionpublic String getRemoteAddr()
getRemoteAddr in interface ServletRequestpublic String getRemoteHost()
getRemoteHost in interface ServletRequestpublic void setAttribute(String name, Object o)
setAttribute in interface ServletRequestpublic void removeAttribute(String name)
removeAttribute in interface ServletRequestpublic Locale getLocale()
getLocale in interface ServletRequestpublic Enumeration<Locale> getLocales()
getLocales in interface ServletRequestpublic boolean isSecure()
isSecure in interface ServletRequestpublic RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface ServletRequestpublic String getRealPath(String path)
getRealPath in interface ServletRequestpublic int getRemotePort()
getRemotePort in interface ServletRequestpublic String getLocalName()
getLocalName in interface ServletRequestpublic String getLocalAddr()
getLocalAddr in interface ServletRequestpublic int getLocalPort()
getLocalPort in interface ServletRequestpublic ServletContext getServletContext()
getServletContext in interface ServletRequestpublic AsyncContext startAsync() throws IllegalStateException
startAsync in interface ServletRequestIllegalStateExceptionpublic AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException
startAsync in interface ServletRequestIllegalStateExceptionpublic boolean isAsyncStarted()
isAsyncStarted in interface ServletRequestpublic boolean isAsyncSupported()
isAsyncSupported in interface ServletRequestpublic AsyncContext getAsyncContext()
getAsyncContext in interface ServletRequestpublic DispatcherType getDispatcherType()
getDispatcherType in interface ServletRequestpublic String getAuthType()
getAuthType in interface HttpServletRequestpublic Cookie[] getCookies()
getCookies in interface HttpServletRequestpublic long getDateHeader(String name)
getDateHeader in interface HttpServletRequestpublic String getHeader(String name)
getHeader in interface HttpServletRequestpublic Enumeration<String> getHeaders(String name)
getHeaders in interface HttpServletRequestpublic Enumeration<String> getHeaderNames()
getHeaderNames in interface HttpServletRequestpublic int getIntHeader(String name)
getIntHeader in interface HttpServletRequestpublic String getMethod()
getMethod in interface HttpServletRequestpublic String getPathInfo()
getPathInfo in interface HttpServletRequestpublic String getPathTranslated()
getPathTranslated in interface HttpServletRequestpublic String getContextPath()
getContextPath in interface HttpServletRequestpublic String getQueryString()
getQueryString in interface HttpServletRequestpublic String getRemoteUser()
getRemoteUser in interface HttpServletRequestpublic boolean isUserInRole(String role)
isUserInRole in interface HttpServletRequestpublic Principal getUserPrincipal()
getUserPrincipal in interface HttpServletRequestpublic String getRequestedSessionId()
getRequestedSessionId in interface HttpServletRequestpublic String getRequestURI()
getRequestURI in interface HttpServletRequestpublic StringBuffer getRequestURL()
getRequestURL in interface HttpServletRequestpublic String getServletPath()
getServletPath in interface HttpServletRequestpublic HttpSession getSession(boolean create)
getSession in interface HttpServletRequestpublic HttpSession getSession()
getSession in interface HttpServletRequestpublic String changeSessionId()
changeSessionId 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 boolean authenticate(HttpServletResponse response) throws IOException, ServletException
authenticate in interface HttpServletRequestIOExceptionServletExceptionpublic void login(String username, String password) throws ServletException
login in interface HttpServletRequestServletExceptionpublic void logout() throws ServletException
logout in interface HttpServletRequestServletExceptionpublic Collection<Part> getParts() throws IOException, ServletException
getParts in interface HttpServletRequestIOExceptionServletExceptionpublic Part getPart(String name) throws IOException, ServletException
getPart in interface HttpServletRequestIOExceptionServletExceptionpublic <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException
upgrade in interface HttpServletRequestIOExceptionServletExceptionpublic MockServletRequest header(String name, Object value)
header in interface MockHttpRequestname - Header name.value - Header value.
Object.toString().public MockServletRequest attribute(String name, Object value)
name - Request attribute name.value - Request attribute value.public MockServletRequest body(Object value)
body in interface MockHttpRequestvalue - The body of the request.
byte []
Reader
InputStream
CharSequence
public MockServletRequest formData(String key, Object value)
key - The form data key.value - The form data value.
Object.toString().public MockServletRequest query(String key, Object value)
key - The query key.value - The query value.
Object.toString().public MockServletRequest accept(Object value)
value - The new value.public MockServletRequest acceptCharset(Object value)
value - The new value.public MockServletRequest acceptEncoding(Object value)
value - The new value.public MockServletRequest acceptLanguage(Object value)
value - The new value.public MockServletRequest authorization(Object value)
value - The new value for the header.public MockServletRequest cacheControl(Object value)
value - The new value for the header.public MockServletRequest clientVersion(Object value)
value - The new value.public MockServletRequest connection(Object value)
value - The new value for the header.public MockServletRequest contentEncoding(Object value)
value - The new value.public MockServletRequest contentLength(Object value)
value - The new value for the header.public MockServletRequest contentType(Object value)
value - The new value.public MockServletRequest date(Object value)
value - The new value for the header.public MockServletRequest expect(Object value)
value - The new value for the header.public MockServletRequest from(Object value)
value - The new value for the header.public MockServletRequest host(Object value)
value - The new value for the header.public MockServletRequest ifMatch(Object value)
value - The new value for the header.public MockServletRequest ifModifiedSince(Object value)
value - The new value for the header.public MockServletRequest ifNoneMatch(Object value)
value - The new value for the header.public MockServletRequest ifRange(Object value)
value - The new value for the header.public MockServletRequest ifUnmodifiedSince(Object value)
value - The new value for the header.public MockServletRequest maxForwards(Object value)
value - The new value for the header.public MockServletRequest pragma(Object value)
value - The new value for the header.public MockServletRequest proxyAuthorization(Object value)
value - The new value for the header.public MockServletRequest range(Object value)
value - The new value for the header.public MockServletRequest referer(Object value)
value - The new value for the header.public MockServletRequest te(Object value)
value - The new value for the header.public MockServletRequest upgrade(Object value)
value - The new value for the header.public MockServletRequest userAgent(Object value)
value - The new value for the header.public MockServletRequest warning(Object value)
value - The new value for the header.public MockServletRequest debug()
Causes information about the request execution to be sent to STDERR.
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.