|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Object org.springframework.mock.web.MockHttpServletRequest org.codehaus.groovy.grails.plugins.testing.GrailsMockHttpServletRequest
class GrailsMockHttpServletRequest extends org.springframework.mock.web.MockHttpServletRequest
A custom mock HTTP servlet request that provides the extra properties and methods normally injected by the "servlets" plugin.
Field Summary |
---|
Fields inherited from class org.springframework.mock.web.MockHttpServletRequest | |
---|---|
DEFAULT_PROTOCOL, DEFAULT_SERVER_ADDR, DEFAULT_SERVER_NAME, DEFAULT_SERVER_PORT, DEFAULT_REMOTE_ADDR, DEFAULT_REMOTE_HOST, BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH |
Property Summary | |
---|---|
javax.servlet.AsyncContext |
asyncContext
|
javax.servlet.DispatcherType |
dispatcherType
|
boolean |
invalidToken
|
org.springframework.util.MultiValueMap |
multipartFiles
|
RequestMimeTypesApi |
requestMimeTypesApi
|
Method Summary | |
---|---|
void
|
addFile(org.springframework.web.multipart.MultipartFile file)
Add a file to this request. |
void
|
addFile(java.lang.String location, byte[] contents)
Add a file for the given location and bytes |
void
|
clearAttributes()
|
java.lang.Object
|
each(groovy.lang.Closure c)
Iterates over the request attributes. |
java.lang.Object
|
find(groovy.lang.Closure c)
Adds a "find()" method to the request that searches the request's attributes. |
java.lang.Object
|
findAll(groovy.lang.Closure c)
Like the find(Closure) method, this searches the request attributes. |
java.lang.Object
|
getAt(java.lang.String key)
Map-like access to request attributes, e.g. request["count"]. |
org.springframework.web.multipart.MultipartFile
|
getFile(java.lang.String name)
{@inheritDoc } |
java.util.Map
|
getFileMap()
{@inheritDoc } |
java.util.Iterator
|
getFileNames()
{@inheritDoc } |
java.util.List
|
getFiles(java.lang.String name)
{@inheritDoc } |
java.lang.String
|
getForwardURI()
Implementation of the dynamic "forwardURI" property. |
java.lang.Object
|
getJSON()
Parses the request content as JSON using the JSON converter. |
org.springframework.util.MultiValueMap
|
getMultiFileMap()
{@inheritDoc } |
java.lang.String
|
getMultipartContentType(java.lang.String paramOrFileName)
|
org.springframework.http.HttpHeaders
|
getMultipartHeaders(java.lang.String paramOrFileName)
|
javax.servlet.http.Part
|
getPart(java.lang.String name)
|
java.util.Collection
|
getParts()
|
java.lang.Object
|
getProperty(java.lang.String name)
Property access for request attributes. |
org.springframework.http.HttpHeaders
|
getRequestHeaders()
|
org.springframework.http.HttpMethod
|
getRequestMethod()
|
java.lang.Object
|
getXML()
Parses the request content as XML using XmlSlurper and returns the GPath result object. |
boolean
|
isAsyncStarted()
|
boolean
|
isAsyncSupported()
|
boolean
|
isGet()
|
boolean
|
isPost()
|
boolean
|
isXhr()
Indicates whether this is an AJAX request or not (as far as Grails is concerned). |
void
|
makeAjaxRequest()
Makes this request an AJAX request as Grails understands it. |
void
|
putAt(java.lang.String key, java.lang.Object val)
Map-like setting of request attributes, e.g. request["count"] = 10. |
void
|
setFormat(java.lang.String format)
Sets the request format to use |
void
|
setForwardURI(java.lang.String uri)
Sets the "forwardURI" property for the request. |
void
|
setJSON(java.lang.Object sourceJson)
|
void
|
setJson(java.lang.Object sourceJson)
Sets the body of the request to be a json packet |
java.lang.String
|
setMultipartContentType(java.lang.String paramOrFileName, java.lang.String contentType)
|
org.springframework.http.HttpHeaders
|
setMultipartHeaders(java.lang.String paramOrFileName, org.springframework.http.HttpHeaders headers)
|
void
|
setProperty(java.lang.String name, java.lang.Object value)
Property setting of request attributes. |
void
|
setRequestHeaders(org.springframework.http.HttpHeaders headers)
|
org.springframework.http.HttpMethod
|
setRequestMethod(org.springframework.http.HttpMethod method)
|
void
|
setXML(java.lang.Object sourceXml)
|
void
|
setXml(java.lang.Object sourceXml)
Sets the body of the request to be an XML packet |
javax.servlet.AsyncContext
|
startAsync()
|
javax.servlet.AsyncContext
|
startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)
|
Methods inherited from class org.springframework.mock.web.MockHttpServletRequest | |
---|---|
org.springframework.mock.web.MockHttpServletRequest#getScheme(), org.springframework.mock.web.MockHttpServletRequest#getInputStream(), org.springframework.mock.web.MockHttpServletRequest#getProtocol(), org.springframework.mock.web.MockHttpServletRequest#getContentType(), org.springframework.mock.web.MockHttpServletRequest#setContentType(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getHeaders(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getLocale(), org.springframework.mock.web.MockHttpServletRequest#setAttribute(java.lang.String, java.lang.Object), org.springframework.mock.web.MockHttpServletRequest#isActive(), org.springframework.mock.web.MockHttpServletRequest#getLocalPort(), org.springframework.mock.web.MockHttpServletRequest#setParameter(java.lang.String, java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setParameter(java.lang.String, [Ljava.lang.String;), org.springframework.mock.web.MockHttpServletRequest#invalidate(), org.springframework.mock.web.MockHttpServletRequest#getQueryString(), org.springframework.mock.web.MockHttpServletRequest#setScheme(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setQueryString(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#removeParameter(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setParameters(java.util.Map), org.springframework.mock.web.MockHttpServletRequest#getHeader(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setProtocol(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getParameter(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getMethod(), org.springframework.mock.web.MockHttpServletRequest#close(), org.springframework.mock.web.MockHttpServletRequest#setMethod(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getContentLength(), org.springframework.mock.web.MockHttpServletRequest#getAttribute(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getReader(), org.springframework.mock.web.MockHttpServletRequest#getCookies(), org.springframework.mock.web.MockHttpServletRequest#removeAttribute(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getLocalName(), org.springframework.mock.web.MockHttpServletRequest#getUserPrincipal(), org.springframework.mock.web.MockHttpServletRequest#authenticate(javax.servlet.http.HttpServletResponse), org.springframework.mock.web.MockHttpServletRequest#addHeader(java.lang.String, java.lang.Object), org.springframework.mock.web.MockHttpServletRequest#getAttributeNames(), org.springframework.mock.web.MockHttpServletRequest#getIntHeader(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getPathTranslated(), org.springframework.mock.web.MockHttpServletRequest#getRemoteUser(), org.springframework.mock.web.MockHttpServletRequest#setContent([B), org.springframework.mock.web.MockHttpServletRequest#getSession(boolean), org.springframework.mock.web.MockHttpServletRequest#getSession(), org.springframework.mock.web.MockHttpServletRequest#login(java.lang.String, java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getRemotePort(), org.springframework.mock.web.MockHttpServletRequest#getLocalAddr(), org.springframework.mock.web.MockHttpServletRequest#getAuthType(), org.springframework.mock.web.MockHttpServletRequest#setCharacterEncoding(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getParameterValues(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getParameterMap(), org.springframework.mock.web.MockHttpServletRequest#getServerName(), org.springframework.mock.web.MockHttpServletRequest#getServerPort(), org.springframework.mock.web.MockHttpServletRequest#getRemoteAddr(), org.springframework.mock.web.MockHttpServletRequest#getRemoteHost(), org.springframework.mock.web.MockHttpServletRequest#getLocales(), org.springframework.mock.web.MockHttpServletRequest#isSecure(), org.springframework.mock.web.MockHttpServletRequest#getRequestDispatcher(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getRealPath(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#isUserInRole(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getRequestedSessionId(), org.springframework.mock.web.MockHttpServletRequest#getRequestURL(), org.springframework.mock.web.MockHttpServletRequest#isRequestedSessionIdValid(), org.springframework.mock.web.MockHttpServletRequest#isRequestedSessionIdFromCookie(), org.springframework.mock.web.MockHttpServletRequest#isRequestedSessionIdFromURL(), org.springframework.mock.web.MockHttpServletRequest#isRequestedSessionIdFromUrl(), org.springframework.mock.web.MockHttpServletRequest#logout(), org.springframework.mock.web.MockHttpServletRequest#getDateHeader(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getHeaderNames(), org.springframework.mock.web.MockHttpServletRequest#setLocalName(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#clearAttributes(), org.springframework.mock.web.MockHttpServletRequest#addParameter(java.lang.String, java.lang.String), org.springframework.mock.web.MockHttpServletRequest#addParameter(java.lang.String, [Ljava.lang.String;), org.springframework.mock.web.MockHttpServletRequest#addParameters(java.util.Map), org.springframework.mock.web.MockHttpServletRequest#removeAllParameters(), org.springframework.mock.web.MockHttpServletRequest#setServerName(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setServerPort(int), org.springframework.mock.web.MockHttpServletRequest#setRemoteAddr(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setRemoteHost(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#addPreferredLocale(java.util.Locale), org.springframework.mock.web.MockHttpServletRequest#setSecure(boolean), org.springframework.mock.web.MockHttpServletRequest#setRemotePort(int), org.springframework.mock.web.MockHttpServletRequest#setLocalAddr(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setLocalPort(int), org.springframework.mock.web.MockHttpServletRequest#setAuthType(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setCookies([Ljavax.servlet.http.Cookie;), org.springframework.mock.web.MockHttpServletRequest#setPathInfo(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setContextPath(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setRemoteUser(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#addUserRole(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setUserPrincipal(java.security.Principal), org.springframework.mock.web.MockHttpServletRequest#setRequestedSessionId(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setRequestURI(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setServletPath(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#setSession(javax.servlet.http.HttpSession), org.springframework.mock.web.MockHttpServletRequest#setRequestedSessionIdValid(boolean), org.springframework.mock.web.MockHttpServletRequest#setRequestedSessionIdFromCookie(boolean), org.springframework.mock.web.MockHttpServletRequest#setRequestedSessionIdFromURL(boolean), org.springframework.mock.web.MockHttpServletRequest#getServletContext(), org.springframework.mock.web.MockHttpServletRequest#getContextPath(), org.springframework.mock.web.MockHttpServletRequest#getParameterNames(), org.springframework.mock.web.MockHttpServletRequest#getServletPath(), org.springframework.mock.web.MockHttpServletRequest#getPathInfo(), org.springframework.mock.web.MockHttpServletRequest#getRequestURI(), org.springframework.mock.web.MockHttpServletRequest#getCharacterEncoding(), org.springframework.mock.web.MockHttpServletRequest#wait(), org.springframework.mock.web.MockHttpServletRequest#wait(long, int), org.springframework.mock.web.MockHttpServletRequest#wait(long), org.springframework.mock.web.MockHttpServletRequest#equals(java.lang.Object), org.springframework.mock.web.MockHttpServletRequest#toString(), org.springframework.mock.web.MockHttpServletRequest#hashCode(), org.springframework.mock.web.MockHttpServletRequest#getClass(), org.springframework.mock.web.MockHttpServletRequest#notify(), org.springframework.mock.web.MockHttpServletRequest#notifyAll(), org.springframework.mock.web.MockHttpServletRequest#getPart(java.lang.String), org.springframework.mock.web.MockHttpServletRequest#getParts(), org.springframework.mock.web.MockHttpServletRequest#startAsync(), org.springframework.mock.web.MockHttpServletRequest#startAsync(javax.servlet.ServletRequest, javax.servlet.ServletResponse), org.springframework.mock.web.MockHttpServletRequest#isAsyncStarted(), org.springframework.mock.web.MockHttpServletRequest#isAsyncSupported(), org.springframework.mock.web.MockHttpServletRequest#getAsyncContext(), org.springframework.mock.web.MockHttpServletRequest#getDispatcherType() |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Property Detail |
---|
javax.servlet.AsyncContext asyncContext
javax.servlet.DispatcherType dispatcherType
boolean invalidToken
org.springframework.util.MultiValueMap multipartFiles
@ApiDelegate(HttpServletRequest) RequestMimeTypesApi requestMimeTypesApi
Method Detail |
---|
void addFile(org.springframework.web.multipart.MultipartFile file)
file
- multipart file to be added
void addFile(java.lang.String location, byte[] contents)
location
- The locationcontents
- The bytes
@Override void clearAttributes()
java.lang.Object each(groovy.lang.Closure c)
java.lang.Object find(groovy.lang.Closure c)
true
, just like the normal Groovy find() method.
java.lang.Object findAll(groovy.lang.Closure c)
java.lang.Object getAt(java.lang.String key)
org.springframework.web.multipart.MultipartFile getFile(java.lang.String name)
java.util.Map getFileMap()
java.util.Iterator getFileNames()
java.util.List getFiles(java.lang.String name)
java.lang.String getForwardURI()
java.lang.Object getJSON()
org.springframework.util.MultiValueMap getMultiFileMap()
java.lang.String getMultipartContentType(java.lang.String paramOrFileName)
org.springframework.http.HttpHeaders getMultipartHeaders(java.lang.String paramOrFileName)
javax.servlet.http.Part getPart(java.lang.String name)
java.util.Collection getParts()
java.lang.Object getProperty(java.lang.String name)
org.springframework.http.HttpHeaders getRequestHeaders()
org.springframework.http.HttpMethod getRequestMethod()
java.lang.Object getXML()
boolean isAsyncStarted()
boolean isAsyncSupported()
boolean isGet()
boolean isPost()
boolean isXhr()
true
if it is an
AJAX request, otherwise false
.
void makeAjaxRequest()
void putAt(java.lang.String key, java.lang.Object val)
void setFormat(java.lang.String format)
format
- The request format
void setForwardURI(java.lang.String uri)
void setJSON(java.lang.Object sourceJson)
void setJson(java.lang.Object sourceJson)
sourceJson
- The source json
java.lang.String setMultipartContentType(java.lang.String paramOrFileName, java.lang.String contentType)
org.springframework.http.HttpHeaders setMultipartHeaders(java.lang.String paramOrFileName, org.springframework.http.HttpHeaders headers)
void setProperty(java.lang.String name, java.lang.Object value)
void setRequestHeaders(org.springframework.http.HttpHeaders headers)
org.springframework.http.HttpMethod setRequestMethod(org.springframework.http.HttpMethod method)
void setXML(java.lang.Object sourceXml)
void setXml(java.lang.Object sourceXml)
javax.servlet.AsyncContext startAsync()
javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)
Groovy Documentation