Package io.micronaut.http
Class ByteBodyHttpResponseWrapper<B>
java.lang.Object
io.micronaut.http.HttpMessageWrapper<B>
io.micronaut.http.HttpResponseWrapper<B>
io.micronaut.http.ByteBodyHttpResponseWrapper<B>
- Type Parameters:
B- The original body type
- All Implemented Interfaces:
AttributeHolder,MutableAttributeHolder,ByteBodyHttpResponse<B>,HttpMessage<B>,HttpResponse<B>,Closeable,AutoCloseable
public final class ByteBodyHttpResponseWrapper<B>
extends HttpResponseWrapper<B>
implements ByteBodyHttpResponse<B>
Simple response wrapper to implement
ByteBodyHttpResponse.- Since:
- 4.7.0
- Author:
- Jonas Konrad
-
Method Summary
Modifier and TypeMethodDescriptionbyteBody()The body bytes.voidclose()Close this response.static @NonNull ByteBodyHttpResponse<?>wrap(@NonNull HttpResponse<?> delegate, @NonNull CloseableByteBody byteBody) Attach a body to the given response.Methods inherited from class io.micronaut.http.HttpResponseWrapper
code, getDelegate, reasonMethods inherited from class io.micronaut.http.HttpMessageWrapper
getAttributes, getBody, getBody, getBody, getBody, getHeadersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttributeMethods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getHeaders, getLocaleMethods inherited from interface io.micronaut.http.HttpResponse
body, code, getCookie, getCookies, getStatus, header, reason, setAttribute, status, toMutableResponseMethods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
-
Method Details
-
wrap
@NonNull public static @NonNull ByteBodyHttpResponse<?> wrap(@NonNull @NonNull HttpResponse<?> delegate, @NonNull @NonNull CloseableByteBody byteBody) Attach a body to the given response.- Parameters:
delegate- The original response to be used for e.g. headers and statusbyteBody- The bytes to respond with- Returns:
- A
ByteBodyHttpResponseimplementation with the given response and bytes
-
byteBody
Description copied from interface:ByteBodyHttpResponseThe body bytes.- Specified by:
byteBodyin interfaceByteBodyHttpResponse<B>- Returns:
- The bytes
-
close
public void close()Description copied from interface:ByteBodyHttpResponseClose this response.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceByteBodyHttpResponse<B>- Specified by:
closein interfaceCloseable
-