Package org.restheart.exchange
Class ByteArrayProxyResponse
- java.lang.Object
-
- org.restheart.exchange.Exchange<T>
-
- org.restheart.exchange.Response<T>
-
- org.restheart.exchange.ProxyResponse<byte[]>
-
- org.restheart.exchange.ByteArrayProxyResponse
-
- All Implemented Interfaces:
BufferedExchange<byte[]>
public class ByteArrayProxyResponse extends ProxyResponse<byte[]>
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
-
Field Summary
-
Fields inherited from class org.restheart.exchange.ProxyResponse
BUFFERED_RESPONSE_DATA_KEY
-
Fields inherited from class org.restheart.exchange.Exchange
APP_FORM_URLENCODED_TYPE, APPLICATION_PDF_TYPE, HAL_JSON_MEDIA_TYPE, IN_ERROR_KEY, JSON_MEDIA_TYPE, LOGGER, MAX_BUFFERS, MAX_CONTENT_SIZE, MULTIPART_FORM_DATA_TYPE, wrapped
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedByteArrayProxyResponse(io.undertow.server.HttpServerExchange exchange)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]getErrorContent(int code, String httpStatusText, String message, Throwable t, boolean includeStackTrace)static ByteArrayProxyResponseof(io.undertow.server.HttpServerExchange exchange)byte[]readContent()reads data from the buffer converting it to Tstatic Typetype()voidwriteContent(byte[] content)writes data the buffer from T-
Methods inherited from class org.restheart.exchange.ProxyResponse
getBuffer, getRawContentKey, isContentAvailable, setBuffer, setContentLength, setInError
-
Methods inherited from class org.restheart.exchange.Response
getContentType, getContentType, getMDCContext, getStatusCode, setContentType, setContentTypeAsJson, setInError, setMDCContext, setStatusCode
-
Methods inherited from class org.restheart.exchange.Exchange
getExchange, getWrappedExchange, isAccountInRole, isAuthenticated, isAuthenticated, isContentTypeJson, isContentTypeText, isContentTypeXml, isInError, isInError, responseInterceptorsExecuted, setInError, setInError, setResponseInterceptorsExecuted, updateBufferSize
-
-
-
-
Method Detail
-
of
public static ByteArrayProxyResponse of(io.undertow.server.HttpServerExchange exchange)
-
type
public static Type type()
-
readContent
public byte[] readContent() throws IOExceptionDescription 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
public void writeContent(byte[] content) throws IOExceptionDescription copied from interface:BufferedExchangewrites data the buffer from T- Specified by:
writeContentin interfaceBufferedExchange<byte[]>- Specified by:
writeContentin classProxyResponse<byte[]>- Throws:
IOException
-
getErrorContent
protected byte[] getErrorContent(int code, String httpStatusText, String message, Throwable t, boolean includeStackTrace) throws IOException- Specified by:
getErrorContentin classProxyResponse<byte[]>- Returns:
- the content descibing the error
- Throws:
IOException
-
-