Package org.restheart.exchange
Class UninitializedResponse
UninitializedResponse wraps the exchage and allows
setting a customResponseInitializer
Interceptors at intercePoint REQUEST_BEFORE_EXCHANGE_INIT
receive UninitializedResponse as response argument
-
Field Summary
Fields inherited from class org.restheart.exchange.ServiceResponse
contentFields 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 -
Method Summary
Modifier and TypeMethodDescriptionConsumer<io.undertow.server.HttpServerExchange> throws IllegalStateExceptionstatic UninitializedResponseof(io.undertow.server.HttpServerExchange exchange) throws IllegalStateExceptionvoidsetContent(Object content) throws IllegalStateExceptionvoidsetCustomResponseInitializer(Consumer<io.undertow.server.HttpServerExchange> customResponseInitializer) If a customResponseInitializer is set (not null), the ServiceExchangeInitializer will delegate to customResponseInitializer.accept(exchange) the responsability to initialize the responsevoidsetInError(int code, String message, Throwable t) throws IllegalStateExceptionMethods inherited from class org.restheart.exchange.ServiceResponse
getCustomSender, of, setCustomSenderMethods 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
-
Method Details
-
of
-
getContent
throws IllegalStateException- Overrides:
getContentin classServiceResponse<Object>
-
setContent
throws IllegalStateException- Overrides:
setContentin classServiceResponse<Object>
-
readContent
throws IllegalStateException- Specified by:
readContentin classServiceResponse<Object>- Returns:
- the content as string
-
setInError
throws IllegalStateException- Specified by:
setInErrorin classServiceResponse<Object>- Parameters:
code-message-t-
-
setCustomResponseInitializer
public void setCustomResponseInitializer(Consumer<io.undertow.server.HttpServerExchange> customResponseInitializer) If a customResponseInitializer is set (not null), the ServiceExchangeInitializer will delegate to customResponseInitializer.accept(exchange) the responsability to initialize the response- Parameters:
customSender-
-
customResponseInitializer
- Returns:
- the custom Consumer used to initialize the response in place of the Service default one
-