B - The body type@Internal public class DefaultServletHttpResponse<B> extends java.lang.Object implements ServletHttpResponse<javax.servlet.http.HttpServletResponse,B>
ServletHttpResponse for the Servlet API.| Modifier | Constructor and Description |
|---|---|
protected |
DefaultServletHttpResponse(DefaultServletHttpRequest request,
javax.servlet.http.HttpServletResponse delegate)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
io.micronaut.http.MutableHttpResponse<B> |
body(B body) |
io.micronaut.http.MutableHttpResponse<B> |
contentLength(long length) |
io.micronaut.http.MutableHttpResponse<B> |
contentType(java.lang.CharSequence contentType) |
io.micronaut.http.MutableHttpResponse<B> |
contentType(io.micronaut.http.MediaType mediaType) |
io.micronaut.http.MutableHttpResponse<B> |
cookie(io.micronaut.http.cookie.Cookie cookie) |
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
getAttributes() |
java.util.Optional<B> |
getBody() |
io.micronaut.http.MutableHttpHeaders |
getHeaders() |
javax.servlet.http.HttpServletResponse |
getNativeResponse() |
java.io.OutputStream |
getOutputStream()
Returns an
OutputStream that can be used to write the body of the response. |
io.micronaut.http.HttpStatus |
getStatus() |
java.io.BufferedWriter |
getWriter()
Returns a
BufferedWriter that can be used to write the text body of the response. |
io.micronaut.http.MutableHttpResponse<B> |
header(java.lang.CharSequence name,
java.lang.CharSequence value) |
io.micronaut.http.MutableHttpResponse<B> |
locale(java.util.Locale locale) |
io.micronaut.http.MutableHttpResponse<B> |
status(io.micronaut.http.HttpStatus status) |
io.micronaut.http.MutableHttpResponse<B> |
status(io.micronaut.http.HttpStatus status,
java.lang.CharSequence message) |
io.micronaut.http.MutableHttpResponse<B> |
status(int status) |
io.micronaut.http.MutableHttpResponse<B> |
status(int status,
java.lang.CharSequence message) |
org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> |
stream(org.reactivestreams.Publisher<?> dataPublisher)
Streams data using the given data publisher.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcharacterEncoding, characterEncoding, contentEncoding, cookies, headers, headersaccepted, accepted, badRequest, badRequest, body, code, created, created, created, header, noContent, notAllowed, notAllowed, notAllowedGeneric, notFound, notFound, notModified, ok, ok, permanentRedirect, reason, redirect, seeOther, serverError, serverError, setAttribute, status, status, status, temporaryRedirect, unauthorized, unprocessableEntity, uriprotected DefaultServletHttpResponse(DefaultServletHttpRequest request, javax.servlet.http.HttpServletResponse delegate)
request - The servlet requestdelegate - The servlet responsepublic org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> stream(org.reactivestreams.Publisher<?> dataPublisher)
ServletHttpResponsestream in interface ServletHttpResponse<javax.servlet.http.HttpServletResponse,B>dataPublisher - The data publisherpublic io.micronaut.http.MutableHttpResponse<B> contentType(java.lang.CharSequence contentType)
public io.micronaut.http.MutableHttpResponse<B> contentType(io.micronaut.http.MediaType mediaType)
public io.micronaut.http.MutableHttpResponse<B> contentLength(long length)
public io.micronaut.http.MutableHttpResponse<B> locale(java.util.Locale locale)
locale in interface io.micronaut.http.MutableHttpResponse<B>public io.micronaut.http.MutableHttpResponse<B> header(java.lang.CharSequence name, java.lang.CharSequence value)
public io.micronaut.http.MutableHttpResponse<B> status(int status)
status in interface io.micronaut.http.MutableHttpResponse<B>public io.micronaut.http.MutableHttpResponse<B> status(int status, java.lang.CharSequence message)
status in interface io.micronaut.http.MutableHttpResponse<B>public io.micronaut.http.MutableHttpResponse<B> status(io.micronaut.http.HttpStatus status)
status in interface io.micronaut.http.MutableHttpResponse<B>public javax.servlet.http.HttpServletResponse getNativeResponse()
getNativeResponse in interface ServletHttpResponse<javax.servlet.http.HttpServletResponse,B>public java.io.OutputStream getOutputStream()
throws java.io.IOException
ServletHttpResponseOutputStream that can be used to write the body of the response.
This method is typically used to write binary data. If the body is text, the
ServletHttpResponse.getWriter() method is more appropriate.getOutputStream in interface ServletHttpResponse<javax.servlet.http.HttpServletResponse,B>java.io.IOException - if a valid OutputStream cannot be returned for some reason.public java.io.BufferedWriter getWriter()
throws java.io.IOException
ServletHttpResponseBufferedWriter that can be used to write the text body of the response.
If the written text will not be US-ASCII, you should specify a character encoding by calling
MutableHttpResponse.contentEncoding(CharSequence) before calling this method.getWriter in interface ServletHttpResponse<javax.servlet.http.HttpServletResponse,B>java.io.IOException - if a valid BufferedWriter cannot be returned for some reason.public io.micronaut.http.MutableHttpResponse<B> cookie(io.micronaut.http.cookie.Cookie cookie)
cookie in interface io.micronaut.http.MutableHttpResponse<B>public io.micronaut.http.MutableHttpHeaders getHeaders()
@Nonnull public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> getAttributes()
getAttributes in interface io.micronaut.core.attr.AttributeHoldergetAttributes in interface io.micronaut.core.attr.MutableAttributeHoldergetAttributes in interface io.micronaut.http.HttpMessage<B>@Nonnull public java.util.Optional<B> getBody()
getBody in interface io.micronaut.http.HttpMessage<B>public io.micronaut.http.MutableHttpResponse<B> status(io.micronaut.http.HttpStatus status, java.lang.CharSequence message)
status in interface io.micronaut.http.MutableHttpResponse<B>public io.micronaut.http.HttpStatus getStatus()
getStatus in interface io.micronaut.http.HttpResponse<B>