R
- type of incoming requestsP
- type of outgoing responsespublic abstract class AbstractSqlGatewayRestHandler<R extends RequestBody,P extends ResponseBody,M extends MessageParameters> extends AbstractHandler<NonLeaderRetrievalRestfulGateway,R,M>
RequestBody
s and ResponseBody
s.Modifier and Type | Field and Description |
---|---|
protected SqlGatewayService |
service |
log, MAPPER
leaderRetriever, logger, responseHeaders, timeout
Modifier | Constructor and Description |
---|---|
protected |
AbstractSqlGatewayRestHandler(SqlGatewayService service,
Map<String,String> responseHeaders,
MessageHeaders<R,P,M> messageHeaders) |
Modifier and Type | Method and Description |
---|---|
protected abstract CompletableFuture<P> |
handleRequest(SqlGatewayRestAPIVersion version,
HandlerRequest<R> request)
This method is called for every incoming request and returns a
CompletableFuture
containing a the response. |
protected CompletableFuture<Void> |
respondToRequest(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest,
HandlerRequest<R> handlerRequest,
NonLeaderRetrievalRestfulGateway gateway)
Respond to the given
HandlerRequest . |
closeAsync, closeHandlerAsync, respondAsLeader
channelRead0, getTimeout
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
protected SqlGatewayService service
protected AbstractSqlGatewayRestHandler(SqlGatewayService service, Map<String,String> responseHeaders, MessageHeaders<R,P,M> messageHeaders)
protected CompletableFuture<Void> respondToRequest(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest, HandlerRequest<R> handlerRequest, NonLeaderRetrievalRestfulGateway gateway)
AbstractHandler
HandlerRequest
.respondToRequest
in class AbstractHandler<NonLeaderRetrievalRestfulGateway,R extends RequestBody,M extends MessageParameters>
ctx
- channel handler context to write the responsehttpRequest
- original http requesthandlerRequest
- typed handler requestgateway
- leader gatewayprotected abstract CompletableFuture<P> handleRequest(@Nullable SqlGatewayRestAPIVersion version, @Nonnull HandlerRequest<R> request) throws RestHandlerException
CompletableFuture
containing a the response.
Implementations may decide whether to throw RestHandlerException
s or fail the
returned CompletableFuture
with a RestHandlerException
.
Failing the future with another exception type or throwing unchecked exceptions is
regarded as an implementation error as it does not allow us to provide a meaningful HTTP
status code. In this case a HttpResponseStatus.INTERNAL_SERVER_ERROR
will be
returned.
version
- request versionrequest
- request that should be handledRestHandlerException
- if the handling failedCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.