Class MockHttpServletRequest
- java.lang.Object
-
- org.apache.wicket.protocol.http.mock.MockHttpServletRequest
-
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest
public class MockHttpServletRequest extends java.lang.Object implements javax.servlet.http.HttpServletRequestMock servlet request. Implements all of the methods from the standard HttpServletRequest class plus helper methods to aid setting up a request.- Author:
- Chris Turner
-
-
Constructor Summary
Constructors Constructor Description MockHttpServletRequest(Application application, javax.servlet.http.HttpSession session, javax.servlet.ServletContext context)MockHttpServletRequest(Application application, javax.servlet.http.HttpSession session, javax.servlet.ServletContext context, java.util.Locale locale)Create the request using the supplied session object.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddCookie(javax.servlet.http.Cookie cookie)Add a new cookie.voidaddCookies(java.lang.Iterable<javax.servlet.http.Cookie> cookies)voidaddDateHeader(java.lang.String name, long date)voidaddFile(java.lang.String fieldName, org.apache.wicket.util.file.File file, java.lang.String contentType)Add an uploaded file to the request.voidaddHeader(java.lang.String name, java.lang.String value)Add a header to the request.voidaddParameter(java.lang.String name, java.lang.String value)booleanauthenticate(javax.servlet.http.HttpServletResponse response)java.lang.StringchangeSessionId()javax.servlet.AsyncContextgetAsyncContext()java.lang.ObjectgetAttribute(java.lang.String name)Get an attribute.java.util.Enumeration<java.lang.String>getAttributeNames()Get the names of all of the values.java.lang.StringgetAuthType()Get the auth type.java.lang.StringgetCharacterEncoding()Get the current character encoding.java.nio.charset.CharsetgetCharset()Get the current character set.intgetContentLength()Return the length of the content.longgetContentLengthLong()java.lang.StringgetContentType()If useMultiPartContentType set as true return the correct content-type.java.lang.StringgetContextPath()Get the context path.javax.servlet.http.CookiegetCookie(java.lang.String name)javax.servlet.http.Cookie[]getCookies()Get all of the cookies for this request.longgetDateHeader(java.lang.String name)Get the given header as a date.javax.servlet.DispatcherTypegetDispatcherType()java.lang.StringgetFilterPrefix()java.lang.StringgetHeader(java.lang.String name)Get the given header value.java.util.Enumeration<java.lang.String>getHeaderNames()Get the names of all of the headers.java.util.Enumeration<java.lang.String>getHeaders(java.lang.String name)Get enumeration of all header values with the given name.javax.servlet.ServletInputStreamgetInputStream()Returns an input stream if there has been added some uploaded files.intgetIntHeader(java.lang.String name)Get the given header as an int.java.lang.StringgetLocalAddr()java.util.LocalegetLocale()Get the locale of the request.java.util.Enumeration<java.util.Locale>getLocales()Return all the accepted locales.java.lang.StringgetLocalName()intgetLocalPort()java.lang.StringgetMethod()Get the method.java.lang.StringgetParameter(java.lang.String name)Get the request parameter with the given name.java.util.Map<java.lang.String,java.lang.String[]>getParameterMap()Get the map of all of the parameters.java.util.Enumeration<java.lang.String>getParameterNames()Get the names of all of the parameters.java.lang.String[]getParameterValues(java.lang.String name)Get the values for the given parameter.javax.servlet.http.PartgetPart(java.lang.String name)java.util.Collection<javax.servlet.http.Part>getParts()java.lang.StringgetPathInfo()Get the path info.java.lang.StringgetPathTranslated()Always returns null.MockRequestParametersgetPostParameters()java.lang.StringgetProtocol()Get the protocol.java.lang.StringgetQueryString()Get the query string part of the request.java.io.BufferedReadergetReader()This feature is not implemented at this time as we are not supporting binary servlet input.java.lang.StringgetRealPath(java.lang.String name)Deprecated.Use ServletContext.getRealPath(String) instead.java.lang.StringgetRemoteAddr()java.lang.StringgetRemoteHost()Get the remote host.intgetRemotePort()java.lang.StringgetRemoteUser()Get the name of the remote user from the REMOTE_USER header.javax.servlet.RequestDispatchergetRequestDispatcher(java.lang.String name)Return a dummy dispatcher that just records that dispatch has occurred without actually doing anything.java.lang.StringgetRequestedSessionId()Get the requested session id.java.lang.StringgetRequestURI()Returns context path and servlet path concatenated, typically /applicationClassName/applicationClassNamejava.lang.StringBuffergetRequestURL()Try to build a rough URL.java.lang.StringgetScheme()Get the scheme.java.lang.StringgetServerName()Get the server name.intgetServerPort()javax.servlet.ServletContextgetServletContext()java.lang.StringgetServletPath()The servlet path may either be the application name or /.javax.servlet.http.HttpSessiongetSession()Get the sessions.javax.servlet.http.HttpSessiongetSession(boolean createNew)Get the session.org.apache.wicket.request.UrlgetUrl()java.security.PrincipalgetUserPrincipal()Get the user principal.booleanhasUploadedFiles()voidinitialize(java.util.Locale locale)Reset the request back to a default state.booleanisAsyncStarted()booleanisAsyncSupported()booleanisRequestedSessionIdFromCookie()Check whether session id is from a cookie.booleanisRequestedSessionIdFromUrl()Check whether session id is from a url rewrite.booleanisRequestedSessionIdFromURL()Check whether session id is from a url rewrite.booleanisRequestedSessionIdValid()Check whether the session id is valid.booleanisSecure()booleanisUserInRole(java.lang.String name)NOT IMPLEMENTED.voidlogin(java.lang.String username, java.lang.String password)voidlogout()voidremoveAttribute(java.lang.String name)Remove the given attribute.voidsetAttribute(java.lang.String name, java.lang.Object o)Set the given attribute.voidsetAuthType(java.lang.String authType)Set the auth type.voidsetCharacterEncoding(java.lang.String encoding)Set the character encoding.voidsetCookies(javax.servlet.http.Cookie[] theCookies)Set the cookies.voidsetHeader(java.lang.String name, java.lang.String value)Sets a header to the request.voidsetLocale(java.util.Locale locale)voidsetMethod(java.lang.String method)Set the method.voidsetParameter(java.lang.String name, java.lang.String value)Set a parameter.voidsetParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)Sets a map of parameters.MockHttpServletRequestsetPart(java.lang.String name, javax.servlet.http.Part part)voidsetPath(java.lang.String path)Set the path that this request is supposed to be serving.voidsetRemoteAddr(java.lang.String addr)voidsetScheme(java.lang.String scheme)Sets the scheme of this requestvoidsetSecure(boolean secure)voidsetServerName(java.lang.String serverName)Set the server name.voidsetServerPort(int port)Sets the server port for this requestvoidsetUrl(org.apache.wicket.request.Url url)voidsetURL(java.lang.String url)Set the complete url for this request.voidsetUseMultiPartContentType(boolean useMultiPartContentType)true will force Request generate multiPart ContentType and ContentLengthjavax.servlet.AsyncContextstartAsync()javax.servlet.AsyncContextstartAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)<T extends javax.servlet.http.HttpUpgradeHandler>
Tupgrade(java.lang.Class<T> aClass)
-
-
-
Constructor Detail
-
MockHttpServletRequest
public MockHttpServletRequest(Application application, javax.servlet.http.HttpSession session, javax.servlet.ServletContext context, java.util.Locale locale)
Create the request using the supplied session object. Note that in order for temporary sessions to work, the supplied session must be an instance ofMockHttpSession- Parameters:
application- The application that this request is forsession- The session objectcontext- The current servlet contextlocale- The current locale
-
MockHttpServletRequest
public MockHttpServletRequest(Application application, javax.servlet.http.HttpSession session, javax.servlet.ServletContext context)
-
-
Method Detail
-
addCookie
public void addCookie(javax.servlet.http.Cookie cookie)
Add a new cookie.- Parameters:
cookie- The cookie
-
addCookies
public void addCookies(java.lang.Iterable<javax.servlet.http.Cookie> cookies)
- Parameters:
cookies-
-
addFile
public void addFile(java.lang.String fieldName, org.apache.wicket.util.file.File file, java.lang.String contentType)Add an uploaded file to the request. Use this to simulate a file that has been uploaded to a field.- Parameters:
fieldName- The fieldname of the upload field.file- The file to upload.contentType- The content type of the file. Must be a correct mimetype.
-
addHeader
public void addHeader(java.lang.String name, java.lang.String value)Add a header to the request.- Parameters:
name- The name of the header to addvalue- The value
-
setHeader
public void setHeader(java.lang.String name, java.lang.String value)Sets a header to the request. Overrides any previous value of this header.- Parameters:
name- The name of the header to addvalue- The value- See Also:
addHeader(String, String)
-
addDateHeader
public void addDateHeader(java.lang.String name, long date)- Parameters:
name-date-
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Get an attribute.- Specified by:
getAttributein interfacejavax.servlet.ServletRequest- Parameters:
name- The attribute name- Returns:
- The value, or null
-
getAttributeNames
public java.util.Enumeration<java.lang.String> getAttributeNames()
Get the names of all of the values.- Specified by:
getAttributeNamesin interfacejavax.servlet.ServletRequest- Returns:
- The names
-
getAuthType
public java.lang.String getAuthType()
Get the auth type.- Specified by:
getAuthTypein interfacejavax.servlet.http.HttpServletRequest- Returns:
- The auth type
-
getCharacterEncoding
public java.lang.String getCharacterEncoding()
Get the current character encoding.- Specified by:
getCharacterEncodingin interfacejavax.servlet.ServletRequest- Returns:
- The character encoding
-
getCharset
public java.nio.charset.Charset getCharset()
Get the current character set.- Returns:
- The character set
-
setUseMultiPartContentType
public void setUseMultiPartContentType(boolean useMultiPartContentType)
true will force Request generate multiPart ContentType and ContentLength- Parameters:
useMultiPartContentType-
-
getContentLength
public int getContentLength()
Return the length of the content. This is always -1 except if useMultiPartContentType set as true. Then the length will be the length of the generated request.- Specified by:
getContentLengthin interfacejavax.servlet.ServletRequest- Returns:
- -1 if useMultiPartContentType is false. Else the length of the generated request.
-
getContentLengthLong
public long getContentLengthLong()
- Specified by:
getContentLengthLongin interfacejavax.servlet.ServletRequest
-
getContentType
public java.lang.String getContentType()
If useMultiPartContentType set as true return the correct content-type.- Specified by:
getContentTypein interfacejavax.servlet.ServletRequest- Returns:
- The correct multipart content-type if useMultiPartContentType is true. Else null.
-
getContextPath
public java.lang.String getContextPath()
Get the context path. For this mock implementation the name of the application is always returned.- Specified by:
getContextPathin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The context path
-
getCookie
public javax.servlet.http.Cookie getCookie(java.lang.String name)
- Parameters:
name-- Returns:
- Cookie
-
getCookies
public javax.servlet.http.Cookie[] getCookies()
Get all of the cookies for this request.- Specified by:
getCookiesin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The cookies
-
getDateHeader
public long getDateHeader(java.lang.String name) throws java.lang.IllegalArgumentExceptionGet the given header as a date.- Specified by:
getDateHeaderin interfacejavax.servlet.http.HttpServletRequest- Parameters:
name- The header name- Returns:
- The date, or -1 if header not found
- Throws:
java.lang.IllegalArgumentException- If the header cannot be converted
-
getHeader
public java.lang.String getHeader(java.lang.String name)
Get the given header value.- Specified by:
getHeaderin interfacejavax.servlet.http.HttpServletRequest- Parameters:
name- The header name- Returns:
- The header value or null
-
getHeaderNames
public java.util.Enumeration<java.lang.String> getHeaderNames()
Get the names of all of the headers.- Specified by:
getHeaderNamesin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The header names
-
getHeaders
public java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
Get enumeration of all header values with the given name.- Specified by:
getHeadersin interfacejavax.servlet.http.HttpServletRequest- Parameters:
name- The name- Returns:
- The header values
-
getInputStream
public javax.servlet.ServletInputStream getInputStream() throws java.io.IOExceptionReturns an input stream if there has been added some uploaded files. UseaddFile(String, File, String)to add some uploaded files.- Specified by:
getInputStreamin interfacejavax.servlet.ServletRequest- Returns:
- The input stream
- Throws:
java.io.IOException- If an I/O related problem occurs
-
getIntHeader
public int getIntHeader(java.lang.String name)
Get the given header as an int.- Specified by:
getIntHeaderin interfacejavax.servlet.http.HttpServletRequest- Parameters:
name- The header name- Returns:
- The header value or -1 if header not found
- Throws:
java.lang.NumberFormatException- If the header is not formatted correctly
-
getLocale
public java.util.Locale getLocale()
Get the locale of the request. Attempts to decode the Accept-Language header and if not found returns the default locale of the JVM.- Specified by:
getLocalein interfacejavax.servlet.ServletRequest- Returns:
- The locale
-
setLocale
public void setLocale(java.util.Locale locale)
-
getLocales
public java.util.Enumeration<java.util.Locale> getLocales()
Return all the accepted locales. This implementation always returns just one.- Specified by:
getLocalesin interfacejavax.servlet.ServletRequest- Returns:
- The locales
-
getMethod
public java.lang.String getMethod()
Get the method.- Specified by:
getMethodin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The method
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Get the request parameter with the given name.- Specified by:
getParameterin interfacejavax.servlet.ServletRequest- Parameters:
name- The parameter name- Returns:
- The parameter value, or null
-
getParameterMap
public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Get the map of all of the parameters.- Specified by:
getParameterMapin interfacejavax.servlet.ServletRequest- Returns:
- The parameters
-
getParameterNames
public java.util.Enumeration<java.lang.String> getParameterNames()
Get the names of all of the parameters.- Specified by:
getParameterNamesin interfacejavax.servlet.ServletRequest- Returns:
- The parameter names
-
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
Get the values for the given parameter.- Specified by:
getParameterValuesin interfacejavax.servlet.ServletRequest- Parameters:
name- The name of the parameter- Returns:
- The return values
-
getPathInfo
public java.lang.String getPathInfo()
Get the path info.- Specified by:
getPathInfoin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The path info
-
getPathTranslated
public java.lang.String getPathTranslated()
Always returns null.- Specified by:
getPathTranslatedin interfacejavax.servlet.http.HttpServletRequest- Returns:
- null
-
getProtocol
public java.lang.String getProtocol()
Get the protocol.- Specified by:
getProtocolin interfacejavax.servlet.ServletRequest- Returns:
- Always HTTP/1.1
-
getQueryString
public java.lang.String getQueryString()
Get the query string part of the request.- Specified by:
getQueryStringin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The query string
-
getReader
public java.io.BufferedReader getReader() throws java.io.IOExceptionThis feature is not implemented at this time as we are not supporting binary servlet input. This functionality may be added in the future.- Specified by:
getReaderin interfacejavax.servlet.ServletRequest- Returns:
- The reader
- Throws:
java.io.IOException- If an I/O related problem occurs
-
getRealPath
@Deprecated public java.lang.String getRealPath(java.lang.String name)
Deprecated.Use ServletContext.getRealPath(String) instead.Deprecated method - should not be used.- Specified by:
getRealPathin interfacejavax.servlet.ServletRequest- Parameters:
name- The name- Returns:
- The path
-
getRemoteAddr
public java.lang.String getRemoteAddr()
- Specified by:
getRemoteAddrin interfacejavax.servlet.ServletRequest- Returns:
- the remote address of the client
-
setRemoteAddr
public void setRemoteAddr(java.lang.String addr)
- Parameters:
addr- Format: "aaa.bbb.ccc.ddd"
-
getRemoteHost
public java.lang.String getRemoteHost()
Get the remote host.- Specified by:
getRemoteHostin interfacejavax.servlet.ServletRequest- Returns:
- Return 'localhost' by default
-
getRemoteUser
public java.lang.String getRemoteUser()
Get the name of the remote user from the REMOTE_USER header.- Specified by:
getRemoteUserin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The name of the remote user
-
getRequestDispatcher
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String name)
Return a dummy dispatcher that just records that dispatch has occurred without actually doing anything.- Specified by:
getRequestDispatcherin interfacejavax.servlet.ServletRequest- Parameters:
name- The name to dispatch to- Returns:
- The dispatcher
-
getRequestedSessionId
public java.lang.String getRequestedSessionId()
Get the requested session id. Always returns the id of the current session.- Specified by:
getRequestedSessionIdin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The session id
-
getRequestURI
public java.lang.String getRequestURI()
Returns context path and servlet path concatenated, typically /applicationClassName/applicationClassName- Specified by:
getRequestURIin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The path value
- See Also:
HttpServletRequest.getRequestURI()
-
getRequestURL
public java.lang.StringBuffer getRequestURL()
Try to build a rough URL.- Specified by:
getRequestURLin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The url
- See Also:
HttpServletRequest.getRequestURL()
-
getScheme
public java.lang.String getScheme()
Get the scheme.- Specified by:
getSchemein interfacejavax.servlet.ServletRequest- Returns:
- the scheme of this request
-
setScheme
public void setScheme(java.lang.String scheme)
Sets the scheme of this request set thesecureflag accordingly (truefor 'https',falseotherwise)- Parameters:
scheme- protocol scheme (e.g. https, http, ftp)- See Also:
isSecure()
-
getServerName
public java.lang.String getServerName()
Get the server name.- Specified by:
getServerNamein interfacejavax.servlet.ServletRequest- Returns:
- by default returns 'localhost'
-
setServerName
public void setServerName(java.lang.String serverName)
Set the server name.- Parameters:
serverName- content of 'Host' header
-
getServerPort
public int getServerPort()
- Specified by:
getServerPortin interfacejavax.servlet.ServletRequest- Returns:
- the server port of this request
-
setServerPort
public void setServerPort(int port)
Sets the server port for this request- Parameters:
port-
-
getServletPath
public java.lang.String getServletPath()
The servlet path may either be the application name or /. For test purposes we always return the servlet name.- Specified by:
getServletPathin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The servlet path
-
getSession
public javax.servlet.http.HttpSession getSession()
Get the sessions.- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest- Returns:
- The session
-
changeSessionId
public java.lang.String changeSessionId()
- Specified by:
changeSessionIdin interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession(boolean createNew)
Get the session.- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest- Parameters:
createNew- Ignored, there is always a session- Returns:
- The session
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
Get the user principal.- Specified by:
getUserPrincipalin interfacejavax.servlet.http.HttpServletRequest- Returns:
- A user principal
-
hasUploadedFiles
public boolean hasUploadedFiles()
- Returns:
- True if there has been added files to this request using
addFile(String, File, String)
-
initialize
public void initialize(java.util.Locale locale)
Reset the request back to a default state.- Parameters:
locale-
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
Check whether session id is from a cookie. Always returns true.- Specified by:
isRequestedSessionIdFromCookiein interfacejavax.servlet.http.HttpServletRequest- Returns:
- Always true
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()
Check whether session id is from a url rewrite. Always returns false.- Specified by:
isRequestedSessionIdFromUrlin interfacejavax.servlet.http.HttpServletRequest- Returns:
- Always false
-
authenticate
public boolean authenticate(javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException- Specified by:
authenticatein interfacejavax.servlet.http.HttpServletRequest- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
login
public void login(java.lang.String username, java.lang.String password) throws javax.servlet.ServletException- 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 java.util.Collection<javax.servlet.http.Part> getParts() throws java.io.IOException, javax.servlet.ServletException- Specified by:
getPartsin interfacejavax.servlet.http.HttpServletRequest- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
getPart
public javax.servlet.http.Part getPart(java.lang.String name) throws java.io.IOException, javax.servlet.ServletException- Specified by:
getPartin interfacejavax.servlet.http.HttpServletRequest- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
upgrade
public <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(java.lang.Class<T> aClass) throws java.io.IOException, javax.servlet.ServletException- Specified by:
upgradein interfacejavax.servlet.http.HttpServletRequest- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
setPart
public MockHttpServletRequest setPart(java.lang.String name, javax.servlet.http.Part part)
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
Check whether session id is from a url rewrite. Always returns false.- Specified by:
isRequestedSessionIdFromURLin interfacejavax.servlet.http.HttpServletRequest- Returns:
- Always false
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
Check whether the session id is valid.- Specified by:
isRequestedSessionIdValidin interfacejavax.servlet.http.HttpServletRequest- Returns:
- Always true
-
isSecure
public boolean isSecure()
- Specified by:
isSecurein interfacejavax.servlet.ServletRequest- Returns:
trueif this request's scheme is 'https',false- otherwise
-
setSecure
public void setSecure(boolean secure)
- Parameters:
secure-
-
isUserInRole
public boolean isUserInRole(java.lang.String name)
NOT IMPLEMENTED.- Specified by:
isUserInRolein interfacejavax.servlet.http.HttpServletRequest- Parameters:
name- The role name- Returns:
- Always false
-
removeAttribute
public void removeAttribute(java.lang.String name)
Remove the given attribute.- Specified by:
removeAttributein interfacejavax.servlet.ServletRequest- Parameters:
name- The name of the attribute
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object o)Set the given attribute.- Specified by:
setAttributein interfacejavax.servlet.ServletRequest- Parameters:
name- The attribute nameo- The value to set
-
setAuthType
public void setAuthType(java.lang.String authType)
Set the auth type.- Parameters:
authType- The auth type
-
setCharacterEncoding
public void setCharacterEncoding(java.lang.String encoding) throws java.io.UnsupportedEncodingExceptionSet the character encoding.- Specified by:
setCharacterEncodingin interfacejavax.servlet.ServletRequest- Parameters:
encoding- The character encoding- Throws:
java.io.UnsupportedEncodingException- If encoding not supported
-
setCookies
public void setCookies(javax.servlet.http.Cookie[] theCookies)
Set the cookies.- Parameters:
theCookies- The cookies
-
setMethod
public void setMethod(java.lang.String method)
Set the method.- Parameters:
method- The method
-
setParameter
public void setParameter(java.lang.String name, java.lang.String value)Set a parameter.- Parameters:
name- The namevalue- The value
-
addParameter
public void addParameter(java.lang.String name, java.lang.String value)- Parameters:
name-value-
-
setParameters
public void setParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)
Sets a map of parameters.- Parameters:
parameters- the parameters to set
-
setPath
public void setPath(java.lang.String path)
Set the path that this request is supposed to be serving. The path is relative to the web application root and should start with a / character- Parameters:
path-
-
setURL
public void setURL(java.lang.String url)
Set the complete url for this request. The url will be analyzed.- Parameters:
url-
-
getLocalAddr
public java.lang.String getLocalAddr()
- Specified by:
getLocalAddrin interfacejavax.servlet.ServletRequest- Returns:
- local address
-
getLocalName
public java.lang.String getLocalName()
- Specified by:
getLocalNamein interfacejavax.servlet.ServletRequest- Returns:
- local host name
-
getLocalPort
public int getLocalPort()
- Specified by:
getLocalPortin interfacejavax.servlet.ServletRequest- Returns:
- local port
-
getRemotePort
public int getRemotePort()
- Specified by:
getRemotePortin interfacejavax.servlet.ServletRequest- Returns:
- remote port
-
setUrl
public void setUrl(org.apache.wicket.request.Url url)
- Parameters:
url-
-
getUrl
public org.apache.wicket.request.Url getUrl()
- Returns:
- request url
-
getPostParameters
public MockRequestParameters getPostParameters()
- Returns:
- post parameters
-
getFilterPrefix
public java.lang.String getFilterPrefix()
- Returns:
- filter prefix
-
getServletContext
public javax.servlet.ServletContext getServletContext()
- Specified by:
getServletContextin interfacejavax.servlet.ServletRequest- Returns:
- ServletContext
-
startAsync
public javax.servlet.AsyncContext startAsync() throws java.lang.IllegalStateException- Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
java.lang.IllegalStateException
-
startAsync
public javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws java.lang.IllegalStateException- Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
java.lang.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
-
-