Groovy Documentation

org.codehaus.groovy.grails.plugins.testing
[Groovy] Class AbstractGrailsMockHttpServletResponse

java.lang.Object
  org.springframework.mock.web.MockHttpServletResponse
      org.codehaus.groovy.grails.plugins.testing.AbstractGrailsMockHttpServletResponse

abstract class AbstractGrailsMockHttpServletResponse
extends org.springframework.mock.web.MockHttpServletResponse

Simple sub-class of Spring's MockHttpServletResponse that adds the left-shift operator, "<<".


Field Summary
 
Fields inherited from class org.springframework.mock.web.MockHttpServletResponse
SC_CONTINUE, SC_SWITCHING_PROTOCOLS, SC_OK, SC_CREATED, SC_ACCEPTED, SC_NON_AUTHORITATIVE_INFORMATION, SC_NO_CONTENT, SC_RESET_CONTENT, SC_PARTIAL_CONTENT, SC_MULTIPLE_CHOICES, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_FOUND, SC_SEE_OTHER, SC_NOT_MODIFIED, SC_USE_PROXY, SC_TEMPORARY_REDIRECT, SC_BAD_REQUEST, SC_UNAUTHORIZED, SC_PAYMENT_REQUIRED, SC_FORBIDDEN, SC_NOT_FOUND, SC_METHOD_NOT_ALLOWED, SC_NOT_ACCEPTABLE, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_TIMEOUT, SC_CONFLICT, SC_GONE, SC_LENGTH_REQUIRED, SC_PRECONDITION_FAILED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_URI_TOO_LONG, SC_UNSUPPORTED_MEDIA_TYPE, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_EXPECTATION_FAILED, SC_INTERNAL_SERVER_ERROR, SC_NOT_IMPLEMENTED, SC_BAD_GATEWAY, SC_SERVICE_UNAVAILABLE, SC_GATEWAY_TIMEOUT, SC_HTTP_VERSION_NOT_SUPPORTED
 
Property Summary
ResponseMimeTypesApi responseMimeTypesApi

 
Method Summary
JSONElement getJson()

Get the response JSON

java.lang.String getRedirectUrl()

java.lang.String getRedirectedUrl()

java.lang.String getText()

The response body as text

groovy.util.slurpersupport.GPathResult getXml()

Get the response XML

java.lang.String header(java.lang.String name)

Return the primary value for the given header as a String, if any.

java.util.List headers(java.lang.String name)

Return all values for the given header as a List of Strings.

void leftShift(java.lang.String content)

Appends the given content string to the response's output stream.

void reset()

void setFormat(java.lang.String format)

Sets the response format

 
Methods inherited from class org.springframework.mock.web.MockHttpServletResponse
org.springframework.mock.web.MockHttpServletResponse#flushBuffer(), org.springframework.mock.web.MockHttpServletResponse#getContentType(), org.springframework.mock.web.MockHttpServletResponse#setContentType(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#setContentLength(int), org.springframework.mock.web.MockHttpServletResponse#getOutputStream(), org.springframework.mock.web.MockHttpServletResponse#getHeaders(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getLocale(), org.springframework.mock.web.MockHttpServletResponse#setLocale(java.util.Locale), org.springframework.mock.web.MockHttpServletResponse#getStatus(), org.springframework.mock.web.MockHttpServletResponse#getWriter(), org.springframework.mock.web.MockHttpServletResponse#getHeader(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#setBufferSize(int), org.springframework.mock.web.MockHttpServletResponse#reset(), org.springframework.mock.web.MockHttpServletResponse#getContentLength(), org.springframework.mock.web.MockHttpServletResponse#getErrorMessage(), org.springframework.mock.web.MockHttpServletResponse#setHeader(java.lang.String, java.lang.String), org.springframework.mock.web.MockHttpServletResponse#containsHeader(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#addCookie(javax.servlet.http.Cookie), org.springframework.mock.web.MockHttpServletResponse#getCookies(), org.springframework.mock.web.MockHttpServletResponse#getHeaderValue(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#setStatus(int, java.lang.String), org.springframework.mock.web.MockHttpServletResponse#setStatus(int), org.springframework.mock.web.MockHttpServletResponse#addHeader(java.lang.String, java.lang.String), org.springframework.mock.web.MockHttpServletResponse#setCharacterEncoding(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getHeaderNames(), org.springframework.mock.web.MockHttpServletResponse#resetBuffer(), org.springframework.mock.web.MockHttpServletResponse#isCommitted(), org.springframework.mock.web.MockHttpServletResponse#getBufferSize(), org.springframework.mock.web.MockHttpServletResponse#encodeRedirectURL(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#encodeUrl(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#encodeRedirectUrl(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#sendError(int), org.springframework.mock.web.MockHttpServletResponse#sendError(int, java.lang.String), org.springframework.mock.web.MockHttpServletResponse#sendRedirect(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#setDateHeader(java.lang.String, long), org.springframework.mock.web.MockHttpServletResponse#addDateHeader(java.lang.String, long), org.springframework.mock.web.MockHttpServletResponse#setIntHeader(java.lang.String, int), org.springframework.mock.web.MockHttpServletResponse#addIntHeader(java.lang.String, int), org.springframework.mock.web.MockHttpServletResponse#setOutputStreamAccessAllowed(boolean), org.springframework.mock.web.MockHttpServletResponse#isOutputStreamAccessAllowed(), org.springframework.mock.web.MockHttpServletResponse#setWriterAccessAllowed(boolean), org.springframework.mock.web.MockHttpServletResponse#isWriterAccessAllowed(), org.springframework.mock.web.MockHttpServletResponse#getContentAsByteArray(), org.springframework.mock.web.MockHttpServletResponse#getContentAsString(), org.springframework.mock.web.MockHttpServletResponse#setCommitted(boolean), org.springframework.mock.web.MockHttpServletResponse#getCookie(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getRedirectedUrl(), org.springframework.mock.web.MockHttpServletResponse#setForwardedUrl(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getForwardedUrl(), org.springframework.mock.web.MockHttpServletResponse#setIncludedUrl(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getIncludedUrl(), org.springframework.mock.web.MockHttpServletResponse#addIncludedUrl(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getIncludedUrls(), org.springframework.mock.web.MockHttpServletResponse#encodeURL(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getCharacterEncoding(), org.springframework.mock.web.MockHttpServletResponse#getHeaderValues(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#wait(), org.springframework.mock.web.MockHttpServletResponse#wait(long, int), org.springframework.mock.web.MockHttpServletResponse#wait(long), org.springframework.mock.web.MockHttpServletResponse#equals(java.lang.Object), org.springframework.mock.web.MockHttpServletResponse#toString(), org.springframework.mock.web.MockHttpServletResponse#hashCode(), org.springframework.mock.web.MockHttpServletResponse#getClass(), org.springframework.mock.web.MockHttpServletResponse#notify(), org.springframework.mock.web.MockHttpServletResponse#notifyAll(), org.springframework.mock.web.MockHttpServletResponse#getHeaders(java.lang.String)
 
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

responseMimeTypesApi

@ApiDelegate(HttpServletResponse)
ResponseMimeTypesApi responseMimeTypesApi


 
Method Detail

getJson

JSONElement getJson()
Get the response JSON
Returns:
The JSON response


getRedirectUrl

java.lang.String getRedirectUrl()


getRedirectedUrl

@Override
java.lang.String getRedirectedUrl()


getText

java.lang.String getText()
The response body as text
Returns:
The text within the response body


getXml

groovy.util.slurpersupport.GPathResult getXml()
Get the response XML
Returns:
The response XML


header

java.lang.String header(java.lang.String name)
Return the primary value for the given header as a String, if any. Will return the first value in case of multiple values.
Parameters:
name - the name of the header
Returns:
the associated header value, or null if none


headers

java.util.List headers(java.lang.String name)
Return all values for the given header as a List of Strings.
Parameters:
name - the name of the header
Returns:
the associated header values, or an empty List if none


leftShift

void leftShift(java.lang.String content)
Appends the given content string to the response's output stream.


reset

@Override
void reset()


setFormat

void setFormat(java.lang.String format)
Sets the response format
Parameters:
format - The format of the response


 

Groovy Documentation