Package org.restheart.exchange
Class JsonProxyResponse
- java.lang.Object
-
- org.restheart.exchange.Exchange<T>
-
- org.restheart.exchange.Response<T>
-
- org.restheart.exchange.ProxyResponse<com.google.gson.JsonElement>
-
- org.restheart.exchange.JsonProxyResponse
-
- All Implemented Interfaces:
BufferedExchange<com.google.gson.JsonElement>
public class JsonProxyResponse extends ProxyResponse<com.google.gson.JsonElement>
- 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 protectedJsonProxyResponse(io.undertow.server.HttpServerExchange exchange)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.google.gson.JsonElementgetErrorContent(int code, String httpStatusText, String message, Throwable t, boolean includeStackTrace)static JsonProxyResponseof(io.undertow.server.HttpServerExchange exchange)com.google.gson.JsonElementreadContent()reads data from the buffer converting it to TvoidwriteContent(com.google.gson.JsonElement 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, type
-
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 JsonProxyResponse of(io.undertow.server.HttpServerExchange exchange)
-
readContent
public com.google.gson.JsonElement readContent() throws IOExceptionDescription 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
public void writeContent(com.google.gson.JsonElement content) throws IOExceptionDescription copied from interface:BufferedExchangewrites data the buffer from T- Specified by:
writeContentin interfaceBufferedExchange<com.google.gson.JsonElement>- Specified by:
writeContentin classProxyResponse<com.google.gson.JsonElement>- 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>- Returns:
- the content descibing the error
- Throws:
IOException
-
-