Package io.micronaut.servlet.http
Interface ServletHttpResponse<N,B> 
- Type Parameters:
- N- The native response type
- B- The body type
- All Superinterfaces:
- io.micronaut.core.attr.AttributeHolder,- io.micronaut.http.HttpMessage<B>,- io.micronaut.http.HttpResponse<B>,- io.micronaut.core.attr.MutableAttributeHolder,- io.micronaut.http.MutableHttpMessage<B>,- io.micronaut.http.MutableHttpResponse<B>
- All Known Implementing Classes:
- ApacheServletHttpResponse,- DefaultServletHttpResponse,- PojaHttpResponse
public interface ServletHttpResponse<N,B> 
extends io.micronaut.http.MutableHttpResponse<B>
Models a serverless HTTP response, allowing access to the native response.
- Since:
- 2.0.0
- Author:
- graemerocher
- 
Method SummaryModifier and TypeMethodDescriptionReturns anOutputStreamthat can be used to write the body of the response.Returns aBufferedWriterthat can be used to write the text body of the response.default org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>>stream(org.reactivestreams.Publisher<?> dataPublisher) Streams data using the given data publisher.Methods inherited from interface io.micronaut.core.attr.AttributeHoldergetAttribute, getAttributeMethods inherited from interface io.micronaut.http.HttpMessagegetAttributes, getBody, getBody, getBody, getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getLocaleMethods inherited from interface io.micronaut.http.HttpResponsebody, code, getCookie, getCookies, getStatus, header, reason, setAttribute, statusMethods inherited from interface io.micronaut.core.attr.MutableAttributeHolderremoveAttributeMethods inherited from interface io.micronaut.http.MutableHttpMessagebasicAuth, bearerAuth, bodyWriter, getHeadersMethods inherited from interface io.micronaut.http.MutableHttpResponseattribute, body, characterEncoding, characterEncoding, contentEncoding, contentLength, contentType, contentType, cookie, cookies, header, headers, headers, locale, status, status, status, status, toMutableResponse
- 
Method Details- 
getNativeResponseN getNativeResponse()- Returns:
- The native response type.
 
- 
getOutputStreamReturns anOutputStreamthat can be used to write the body of the response. This method is typically used to write binary data. If the body is text, thegetWriter()method is more appropriate.- Returns:
- The output stream
- Throws:
- IOException- if a valid- OutputStreamcannot be returned for some reason.
- IllegalStateException- if- getWriter()has already been called on this instance.
 
- 
getWriterReturns aBufferedWriterthat 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 callingMutableHttpResponse.contentEncoding(CharSequence)before calling this method.- Returns:
- The writer
- Throws:
- IOException- if a valid- BufferedWritercannot be returned for some reason.
- IllegalStateException- if- getOutputStream()has already been called on this instance.
 
- 
streamdefault org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> stream(org.reactivestreams.Publisher<?> dataPublisher) Streams data using the given data publisher.- Parameters:
- dataPublisher- The data publisher
- Returns:
- Emits the response once the stream has completed
 
 
-