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.void
close()
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, reason
Methods inherited from class io.micronaut.http.HttpMessageWrapper
getAttributes, getBody, getBody, getBody, getBody, getHeaders
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttribute
Methods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getHeaders, getLocale
Methods inherited from interface io.micronaut.http.HttpResponse
body, code, getCookie, getCookies, getStatus, header, reason, setAttribute, status, toMutableResponse
Methods 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
ByteBodyHttpResponse
implementation with the given response and bytes
-
byteBody
Description copied from interface:ByteBodyHttpResponse
The body bytes.- Specified by:
byteBody
in interfaceByteBodyHttpResponse<B>
- Returns:
- The bytes
-
close
public void close()Description copied from interface:ByteBodyHttpResponse
Close this response.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceByteBodyHttpResponse<B>
- Specified by:
close
in interfaceCloseable
-