Class AbstractHandler<T>
java.lang.Object
org.apache.calcite.avatica.remote.AbstractHandler<T>
- Type Parameters:
T- The format Requests/Responses are serialized as.
- All Implemented Interfaces:
Handler<T>
- Direct Known Subclasses:
JsonHandler,ProtobufHandler
Abstract base class for
Handlers to extend to inherit functionality common across
serialization strategies.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.avatica.remote.Handler
Handler.HandlerResponse<T> -
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionCompute a response for the given request, handling errors generated by that computation.Attempts to convert an Exception to an ErrorResponse.voidsetRpcMetadata(Service.RpcMetadataResponse metadata) Sets some general server information to return to the client in all responses.Attempts to convert an Exception to an ErrorResponse with an HTTP status code of401.Attempts to convert an Exception to an ErrorResponse with an HTTP stauts code of403.
-
Field Details
-
service
-
-
Constructor Details
-
AbstractHandler
-
-
Method Details
-
apply
Compute a response for the given request, handling errors generated by that computation.- Specified by:
applyin interfaceHandler<T>- Parameters:
serializedRequest- The caller's request.- Returns:
- A
Service.Responsewith additional context about that response.
-
convertToErrorResponse
Attempts to convert an Exception to an ErrorResponse. If there is an issue in serialization, a RuntimeException is thrown instead (wrapping the original exception if necessary).- Parameters:
e- The exception to convert.- Returns:
- A HandlerResponse instance.
-
unauthenticatedErrorResponse
Attempts to convert an Exception to an ErrorResponse with an HTTP status code of401. -
unauthorizedErrorResponse
Attempts to convert an Exception to an ErrorResponse with an HTTP stauts code of403. -
setRpcMetadata
Description copied from interface:HandlerSets some general server information to return to the client in all responses.- Specified by:
setRpcMetadatain interfaceHandler<T>- Parameters:
metadata- Server-wide information
-