Package org.restheart.exchange
Class ByteArrayProxyResponse
java.lang.Object
org.restheart.exchange.Exchange<byte[]>
org.restheart.exchange.Response<byte[]>
org.restheart.exchange.ProxyResponse<byte[]>
org.restheart.exchange.ByteArrayProxyResponse
- All Implemented Interfaces:
AutoCloseable,BufferedExchange<byte[]>
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Field Summary
Fields inherited from class org.restheart.exchange.ProxyResponse
BUFFERED_RESPONSE_DATA_KEYFields inherited from class org.restheart.exchange.Exchange
APPLICATION_PDF_TYPE, FORM_URLENCODED, HAL_JSON_MEDIA_TYPE, IN_ERROR_KEY, JSON_MEDIA_TYPE, MAX_BUFFERS, MAX_CONTENT_SIZE, MULTIPART, TEXT_PLAIN_CONTENT_TYPE, wrapped -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedByteArrayProxyResponse(io.undertow.server.HttpServerExchange exchange) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]getErrorContent(int code, String httpStatusText, String message, Throwable t, boolean includeStackTrace) static ByteArrayProxyResponseof(io.undertow.server.HttpServerExchange exchange) byte[]reads data from the buffer converting it to Tstatic Typetype()voidwriteContent(byte[] content) writes the response content allocates the PooledByteBuffer array so close() must be invoked to avoid memory leaksMethods inherited from class org.restheart.exchange.ProxyResponse
close, getBuffer, getRawContentKey, isContentAvailable, setBuffer, setContentLength, setInErrorMethods inherited from class org.restheart.exchange.Response
getContentType, getContentType, getHeader, getHeader, getHeaders, getMDCContext, getStatusCode, setContentType, setContentTypeAsJson, setHeader, setHeader, setInError, setMDCContext, setStatusCodeMethods inherited from class org.restheart.exchange.Exchange
getExchange, getWrappedExchange, isAccountInRole, isAuthenticated, isAuthenticated, isContentTypeFormOrMultipart, isContentTypeFormOrMultipart, isContentTypeJson, isContentTypeJson, isContentTypeText, isContentTypeXml, isInError, isInError, responseInterceptorsExecuted, setInError, setInError, setResponseInterceptorsExecuted, updateBufferSize
-
Constructor Details
-
ByteArrayProxyResponse
protected ByteArrayProxyResponse(io.undertow.server.HttpServerExchange exchange)
-
-
Method Details
-
of
-
type
-
readContent
Description copied from interface:BufferedExchangereads data from the buffer converting it to T- Specified by:
readContentin interfaceBufferedExchange<byte[]>- Specified by:
readContentin classProxyResponse<byte[]>- Returns:
- the content as Json
- Throws:
IOException
-
writeContent
writes the response content allocates the PooledByteBuffer array so close() must be invoked to avoid memory leaks- Specified by:
writeContentin interfaceBufferedExchange<byte[]>- Specified by:
writeContentin classProxyResponse<byte[]>- Parameters:
content-- Throws:
IOException
-
getErrorContent
protected byte[] getErrorContent(int code, String httpStatusText, String message, Throwable t, boolean includeStackTrace) throws IOException - Specified by:
getErrorContentin classProxyResponse<byte[]>- Parameters:
code-httpStatusText-message-t-includeStackTrace-- Returns:
- the content descibing the error
- Throws:
IOException
-