Class HandlerUtils


  • public class HandlerUtils
    extends Object
    Utilities for the REST handlers.
    • Constructor Summary

      Constructors 
      Constructor Description
      HandlerUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static CompletableFuture<Void> sendErrorResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, boolean keepAlive, ErrorResponseBody errorMessage, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode, Map<String,​String> headers)
      Sends the given error response and status code to the given channel.
      static CompletableFuture<Void> sendErrorResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest, ErrorResponseBody errorMessage, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode, Map<String,​String> headers)
      Sends the given error response and status code to the given channel.
      static CompletableFuture<Void> sendResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, boolean keepAlive, String message, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode, Map<String,​String> headers)
      Sends the given response and status code to the given channel.
      static CompletableFuture<Void> sendResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest, String message, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode, Map<String,​String> headers)
      Sends the given response and status code to the given channel.
      static <P extends ResponseBody>
      CompletableFuture<Void>
      sendResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest, P response, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode, Map<String,​String> headers)
      Sends the given response and status code to the given channel.
      static void transferFile​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, File file, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest)  
    • Constructor Detail

      • HandlerUtils

        public HandlerUtils()
    • Method Detail

      • sendResponse

        public static <P extends ResponseBodyCompletableFuture<Void> sendResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext,
                                                                                    org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest,
                                                                                    P response,
                                                                                    org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode,
                                                                                    Map<String,​String> headers)
        Sends the given response and status code to the given channel.
        Type Parameters:
        P - type of the response
        Parameters:
        channelHandlerContext - identifying the open channel
        httpRequest - originating http request
        response - which should be sent
        statusCode - of the message to send
        headers - additional header values
      • sendErrorResponse

        public static CompletableFuture<Void> sendErrorResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext,
                                                                org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest,
                                                                ErrorResponseBody errorMessage,
                                                                org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode,
                                                                Map<String,​String> headers)
        Sends the given error response and status code to the given channel.
        Parameters:
        channelHandlerContext - identifying the open channel
        httpRequest - originating http request
        errorMessage - which should be sent
        statusCode - of the message to send
        headers - additional header values
      • sendErrorResponse

        public static CompletableFuture<Void> sendErrorResponse​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext,
                                                                boolean keepAlive,
                                                                ErrorResponseBody errorMessage,
                                                                org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode,
                                                                Map<String,​String> headers)
        Sends the given error response and status code to the given channel.
        Parameters:
        channelHandlerContext - identifying the open channel
        keepAlive - If the connection should be kept alive.
        errorMessage - which should be sent
        statusCode - of the message to send
        headers - additional header values
      • sendResponse

        public static CompletableFuture<Void> sendResponse​(@Nonnull
                                                           org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext,
                                                           @Nonnull
                                                           org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest,
                                                           @Nonnull
                                                           String message,
                                                           @Nonnull
                                                           org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode,
                                                           @Nonnull
                                                           Map<String,​String> headers)
        Sends the given response and status code to the given channel.
        Parameters:
        channelHandlerContext - identifying the open channel
        httpRequest - originating http request
        message - which should be sent
        statusCode - of the message to send
        headers - additional header values
      • sendResponse

        public static CompletableFuture<Void> sendResponse​(@Nonnull
                                                           org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext channelHandlerContext,
                                                           boolean keepAlive,
                                                           @Nonnull
                                                           String message,
                                                           @Nonnull
                                                           org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus statusCode,
                                                           @Nonnull
                                                           Map<String,​String> headers)
        Sends the given response and status code to the given channel.
        Parameters:
        channelHandlerContext - identifying the open channel
        keepAlive - If the connection should be kept alive.
        message - which should be sent
        statusCode - of the message to send
        headers - additional header values
      • transferFile

        public static void transferFile​(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
                                        File file,
                                        org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest)
                                 throws org.apache.flink.util.FlinkException
        Throws:
        org.apache.flink.util.FlinkException