Package org.restheart.exchange
Class ProxyRequest<T>
java.lang.Object
org.restheart.exchange.Exchange<T>
org.restheart.exchange.Request<T>
org.restheart.exchange.ProxyRequest<T>
- Type Parameters:
T- generic type
- All Implemented Interfaces:
AutoCloseable,BufferedExchange<T>
- Direct Known Subclasses:
ByteArrayProxyRequest,JsonProxyRequest
public abstract class ProxyRequest<T>
extends Request<T>
implements BufferedExchange<T>, AutoCloseable
Base class for Request implementation that can be used in proxied requests.
It stores the response content in the BUFFERED_REQUEST_DATA attachment
of the HttpServerExchange.
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Field Summary
Fields inherited from class org.restheart.exchange.Request
PATCH, PIPELINE_INFO_KEY, SLASH, UNDERSCOREFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this resource, relinquishing any underlying resources.io.undertow.connector.PooledByteBuffer[]protected io.undertow.util.AttachmentKey<io.undertow.connector.PooledByteBuffer[]> booleanabstract Treads data from the buffer converting it to TvoidsetBuffer(io.undertow.connector.PooledByteBuffer[] raw) abstract voidwriteContent(T content) writes data the buffer from TMethods inherited from class org.restheart.exchange.Request
addXForwardedHeader, blockForTooManyRequests, getAuthenticatedAccount, getContentType, getContentType, getCookie, getHeader, getHeaders, getMethod, getPath, getPathParam, getPathParams, getPipelineInfo, getPipelineInfo, getQueryParameterOfDefault, getQueryParameterOrDefault, getQueryParameters, getQueryString, getRequestContentLength, getStartTime, getURL, getXForwardedHeaders, isAuthenticated, isBlockForTooManyRequests, isDelete, isGet, isOptions, isPatch, isPost, isPut, of, pipelineInfo, setContentLength, setContentType, setContentTypeAsJson, setHeader, setHeader, setPipelineInfo, setPipelineInfo, setStartTimeMethods inherited from class org.restheart.exchange.Exchange
getExchange, getWrappedExchange, isAccountInRole, isAuthenticated, isContentTypeFormOrMultipart, isContentTypeFormOrMultipart, isContentTypeJson, isContentTypeJson, isContentTypeText, isContentTypeXml, isInError, isInError, responseInterceptorsExecuted, setInError, setInError, setResponseInterceptorsExecuted, updateBufferSize
-
Constructor Details
-
ProxyRequest
public ProxyRequest(io.undertow.server.HttpServerExchange exchange)
-
-
Method Details
-
readContent
Description copied from interface:BufferedExchangereads data from the buffer converting it to T- Specified by:
readContentin interfaceBufferedExchange<T>- Returns:
- Throws:
IOException
-
writeContent
Description copied from interface:BufferedExchangewrites data the buffer from T- Specified by:
writeContentin interfaceBufferedExchange<T>- Parameters:
content-- Throws:
IOException
-
getRawContentKey
protected io.undertow.util.AttachmentKey<io.undertow.connector.PooledByteBuffer[]> getRawContentKey() -
setBuffer
public void setBuffer(io.undertow.connector.PooledByteBuffer[] raw) - Specified by:
setBufferin interfaceBufferedExchange<T>
-
getBuffer
public io.undertow.connector.PooledByteBuffer[] getBuffer()- Specified by:
getBufferin interfaceBufferedExchange<T>
-
isContentAvailable
public boolean isContentAvailable()- Specified by:
isContentAvailablein interfaceBufferedExchange<T>
-
close
public void close()Closes this resource, relinquishing any underlying resources.- Specified by:
closein interfaceAutoCloseable
-