Class JacksonRequestConverterFunction
java.lang.Object
com.linecorp.armeria.server.annotation.JacksonRequestConverterFunction
- All Implemented Interfaces:
RequestConverterFunction
public final class JacksonRequestConverterFunction
extends Object
implements RequestConverterFunction
A
RequestConverterFunction
which converts a JSON body of
the AggregatedHttpRequest
to an object using the default ObjectMapper
.
The RequestConverterFunction
is applied only when the content-type
of the
RequestHeaders
is MediaType.JSON
or ends with +json
.
Note that this RequestConverterFunction
is applied to an annotated service by default,
so you don't have to specify this converter explicitly unless you want to use your own ObjectMapper
.-
Constructor Summary
ConstructorDescriptionCreates an instance with the defaultObjectMapper
.Creates an instance with the specifiedObjectMapper
. -
Method Summary
Modifier and TypeMethodDescriptionconvertRequest(ServiceRequestContext ctx, AggregatedHttpRequest request, Class<?> expectedResultType, @Nullable ParameterizedType expectedParameterizedResultType)
Converts the specifiedAggregatedHttpRequest
to an object ofexpectedResultType
.
-
Constructor Details
-
JacksonRequestConverterFunction
public JacksonRequestConverterFunction()Creates an instance with the defaultObjectMapper
. -
JacksonRequestConverterFunction
Creates an instance with the specifiedObjectMapper
.
-
-
Method Details
-
convertRequest
@Nullable public @Nullable Object convertRequest(ServiceRequestContext ctx, AggregatedHttpRequest request, Class<?> expectedResultType, @Nullable @Nullable ParameterizedType expectedParameterizedResultType) throws ExceptionConverts the specifiedAggregatedHttpRequest
to an object ofexpectedResultType
.- Specified by:
convertRequest
in interfaceRequestConverterFunction
- Parameters:
ctx
- theServiceRequestContext
ofrequest
.request
- theAggregatedHttpRequest
being handled.expectedResultType
- the desired type of the conversion result.expectedParameterizedResultType
- the desired parameterized type of the conversion result.null
will be given ifexpectedResultType
doesn't have any type parameters.- Throws:
Exception
-