T
- type of the leader gatewayR
- type of the incoming requestM
- type of the message parameterspublic abstract class AbstractHandler<T extends RestfulGateway,R extends RequestBody,M extends MessageParameters> extends RedirectHandler<T>
RequestBody
.
Subclasses must be thread-safe
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
protected static org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper |
MAPPER |
leaderRetriever, localAddressFuture, logger, responseHeaders, timeout
Modifier | Constructor and Description |
---|---|
protected |
AbstractHandler(CompletableFuture<String> localAddressFuture,
GatewayRetriever<? extends T> leaderRetriever,
org.apache.flink.api.common.time.Time timeout,
Map<String,String> responseHeaders,
UntypedResponseMessageHeaders<R,M> untypedResponseMessageHeaders) |
Modifier and Type | Method and Description |
---|---|
protected void |
respondAsLeader(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
org.apache.flink.shaded.netty4.io.netty.handler.codec.http.router.Routed routed,
T gateway) |
protected abstract 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,M> handlerRequest,
T gateway)
Respond to the given
HandlerRequest . |
channelRead0
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
handlerAdded, handlerRemoved, isSharable
protected final org.slf4j.Logger log
protected static final org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper MAPPER
protected AbstractHandler(@Nonnull CompletableFuture<String> localAddressFuture, @Nonnull GatewayRetriever<? extends T> leaderRetriever, @Nonnull org.apache.flink.api.common.time.Time timeout, @Nonnull Map<String,String> responseHeaders, @Nonnull UntypedResponseMessageHeaders<R,M> untypedResponseMessageHeaders)
protected void respondAsLeader(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.router.Routed routed, T gateway) throws Exception
respondAsLeader
in class RedirectHandler<T extends RestfulGateway>
Exception
protected abstract 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,M> handlerRequest, T gateway) throws RestHandlerException
HandlerRequest
.ctx
- channel handler context to write the responsehttpRequest
- original http requesthandlerRequest
- typed handler requestgateway
- leader gatewayRestHandlerException
- if an exception occurred while respondingCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.