Class JsonHandler
- java.lang.Object
-
- org.apache.calcite.avatica.remote.AbstractHandler<java.lang.String>
-
- org.apache.calcite.avatica.remote.JsonHandler
-
- All Implemented Interfaces:
Handler<java.lang.String>
public class JsonHandler extends AbstractHandler<java.lang.String>
Implementation ofHandlerthat decodes JSON requests, sends them to aService, and encodes the responses into JSON.- See Also:
JsonService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.avatica.remote.Handler
Handler.HandlerResponse<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.fasterxml.jackson.databind.ObjectMapperMAPPER(package private) org.apache.calcite.avatica.metrics.MetricsSystemmetrics(package private) org.apache.calcite.avatica.metrics.TimerserializationTimer-
Fields inherited from class org.apache.calcite.avatica.remote.AbstractHandler
service
-
Fields inherited from interface org.apache.calcite.avatica.remote.Handler
HANDLER_SERIALIZATION_METRICS_NAME, HTTP_INTERNAL_SERVER_ERROR, HTTP_OK, HTTP_UNAUTHENTICATED, HTTP_UNAUTHORIZED
-
-
Constructor Summary
Constructors Constructor Description JsonHandler(Service service, org.apache.calcite.avatica.metrics.MetricsSystem metrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Handler.HandlerResponse<java.lang.String>apply(java.lang.String jsonRequest)Compute a response for the given request, handling errors generated by that computation.(package private) Service.Requestdecode(java.lang.String request)(package private) java.lang.Stringencode(Service.Response response)Serializes the provided object as JSON.-
Methods inherited from class org.apache.calcite.avatica.remote.AbstractHandler
convertToErrorResponse, setRpcMetadata, unauthenticatedErrorResponse, unauthorizedErrorResponse, unwrapException
-
-
-
-
Constructor Detail
-
JsonHandler
public JsonHandler(Service service, org.apache.calcite.avatica.metrics.MetricsSystem metrics)
-
-
Method Detail
-
apply
public Handler.HandlerResponse<java.lang.String> apply(java.lang.String jsonRequest)
Description copied from class:AbstractHandlerCompute a response for the given request, handling errors generated by that computation.- Specified by:
applyin interfaceHandler<java.lang.String>- Overrides:
applyin classAbstractHandler<java.lang.String>- Parameters:
jsonRequest- The caller's request.- Returns:
- A
Service.Responsewith additional context about that response.
-
decode
Service.Request decode(java.lang.String request) throws java.io.IOException
- Specified by:
decodein classAbstractHandler<java.lang.String>- Throws:
java.io.IOException
-
encode
java.lang.String encode(Service.Response response) throws java.io.IOException
Serializes the provided object as JSON.- Specified by:
encodein classAbstractHandler<java.lang.String>- Parameters:
response- The object to serialize.- Returns:
- A JSON string.
- Throws:
java.io.IOException
-
-