Package org.restheart.exchange
Class JsonRequest
java.lang.Object
org.restheart.exchange.Exchange<com.google.gson.JsonElement>
org.restheart.exchange.Request<com.google.gson.JsonElement>
org.restheart.exchange.ServiceRequest<com.google.gson.JsonElement>
org.restheart.exchange.JsonRequest
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Field Summary
Fields inherited from class org.restheart.exchange.ServiceRequest
content, CONTENT_INJECTEDFields 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
ConstructorsModifierConstructorDescriptionprotectedJsonRequest(io.undertow.server.HttpServerExchange exchange) -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonRequestinit(io.undertow.server.HttpServerExchange exchange) static JsonRequestof(io.undertow.server.HttpServerExchange exchange) com.google.gson.JsonElementParses the content from the exchange and converts it into an instance of the specified typeT.Methods inherited from class org.restheart.exchange.ServiceRequest
getContent, isContentInjected, isHandledBy, of, setContent, setContentInjectedMethods 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, 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
-
JsonRequest
protected JsonRequest(io.undertow.server.HttpServerExchange exchange)
-
-
Method Details
-
init
-
of
-
parseContent
Description copied from class:ServiceRequestParses the content from the exchange and converts it into an instance of the specified typeT. This method retrieves data from the exchange, interprets it according to the expected format, and attempts to convert this data into an object of typeT.- Specified by:
parseContentin classServiceRequest<com.google.gson.JsonElement>- Returns:
- an instance of
Trepresenting the parsed content - Throws:
IOException- if an IO error occursBadRequestException- if the content does not match the expected format for typeT
-