Package org.restheart.exchange
Class JsonProxyResponse
java.lang.Object
org.restheart.exchange.Exchange<com.google.gson.JsonElement>
org.restheart.exchange.Response<com.google.gson.JsonElement>
org.restheart.exchange.ProxyResponse<com.google.gson.JsonElement>
org.restheart.exchange.JsonProxyResponse
- All Implemented Interfaces:
AutoCloseable,BufferedExchange<com.google.gson.JsonElement>
- 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
ConstructorsModifierConstructorDescriptionprotectedJsonProxyResponse(io.undertow.server.HttpServerExchange exchange) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.google.gson.JsonElementgetErrorContent(int code, String httpStatusText, String message, Throwable t, boolean includeStackTrace) static JsonProxyResponseof(io.undertow.server.HttpServerExchange exchange) com.google.gson.JsonElementreads data from the buffer converting it to TvoidwriteContent(com.google.gson.JsonElement 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
-
JsonProxyResponse
protected JsonProxyResponse(io.undertow.server.HttpServerExchange exchange)
-
-
Method Details
-
of
-
readContent
Description copied from interface:BufferedExchangereads data from the buffer converting it to T- Specified by:
readContentin interfaceBufferedExchange<com.google.gson.JsonElement>- Specified by:
readContentin classProxyResponse<com.google.gson.JsonElement>- 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<com.google.gson.JsonElement>- Specified by:
writeContentin classProxyResponse<com.google.gson.JsonElement>- Parameters:
content-- Throws:
IOException
-
getErrorContent
protected com.google.gson.JsonElement getErrorContent(int code, String httpStatusText, String message, Throwable t, boolean includeStackTrace) throws IOException - Specified by:
getErrorContentin classProxyResponse<com.google.gson.JsonElement>- Parameters:
code-httpStatusText-message-t-includeStackTrace-- Returns:
- the content descibing the error
- Throws:
IOException
-