abstract class AbstractGrailsMockHttpServletResponse extends org.springframework.mock.web.MockHttpServletResponse
Simple sub-class of Spring's MockHttpServletResponse that adds the left-shift operator, "<<".
Fields inherited from class | Fields |
---|---|
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 |
Constructor and description |
---|
AbstractGrailsMockHttpServletResponse
() |
Type Params | Return Type | Name and description |
---|---|---|
|
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<java.lang.String> |
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 | Name |
---|---|
class org.springframework.mock.web.MockHttpServletResponse |
org.springframework.mock.web.MockHttpServletResponse#getHeaderValue(java.lang.String), 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#setDefaultCharacterEncoding(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#addCookie(javax.servlet.http.Cookie), org.springframework.mock.web.MockHttpServletResponse#getCookies(), org.springframework.mock.web.MockHttpServletResponse#getBufferSize(), org.springframework.mock.web.MockHttpServletResponse#setBufferSize(int), org.springframework.mock.web.MockHttpServletResponse#getContentAsString(), org.springframework.mock.web.MockHttpServletResponse#getContentAsString(java.nio.charset.Charset), org.springframework.mock.web.MockHttpServletResponse#getContentLengthLong(), 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#getHeaders(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getContentLength(), org.springframework.mock.web.MockHttpServletResponse#getWriter(), org.springframework.mock.web.MockHttpServletResponse#getDateHeader(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getHeaderNames(), org.springframework.mock.web.MockHttpServletResponse#getCharacterEncoding(), org.springframework.mock.web.MockHttpServletResponse#setCharacterEncoding(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#encodeUrl(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#encodeRedirectUrl(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#sendError(int, java.lang.String), org.springframework.mock.web.MockHttpServletResponse#sendError(int), 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#resetBuffer(), org.springframework.mock.web.MockHttpServletResponse#setContentLengthLong(long), org.springframework.mock.web.MockHttpServletResponse#isCommitted(), org.springframework.mock.web.MockHttpServletResponse#getHeaderValues(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getContentAsByteArray(), org.springframework.mock.web.MockHttpServletResponse#isCharset(), 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#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#getLocale(), org.springframework.mock.web.MockHttpServletResponse#setLocale(java.util.Locale), org.springframework.mock.web.MockHttpServletResponse#getErrorMessage(), org.springframework.mock.web.MockHttpServletResponse#getStatus(), org.springframework.mock.web.MockHttpServletResponse#addHeader(java.lang.String, java.lang.String), org.springframework.mock.web.MockHttpServletResponse#getHeader(java.lang.String), org.springframework.mock.web.MockHttpServletResponse#setStatus(int), org.springframework.mock.web.MockHttpServletResponse#setStatus(int, java.lang.String), org.springframework.mock.web.MockHttpServletResponse#reset(), org.springframework.mock.web.MockHttpServletResponse#flushBuffer(), org.springframework.mock.web.MockHttpServletResponse#wait(long, int), org.springframework.mock.web.MockHttpServletResponse#wait(long), org.springframework.mock.web.MockHttpServletResponse#wait(), 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#getTrailerFields(), org.springframework.mock.web.MockHttpServletResponse#setTrailerFields(java.util.function.Supplier) |
Get the response JSON
The response body as text
Get the response XML
Return the primary value for the given header as a String, if any. Will return the first value in case of multiple values.
name
- the name of the headernull if none
Return all values for the given header as a List of Strings.
name
- the name of the headerAppends the given content string to the response's output stream.
Sets the response format
format
- The format of the response