org.apache.flink.runtime.rest.handler.util.KeepAliveWrite Java Examples
The following examples show how to use
org.apache.flink.runtime.rest.handler.util.KeepAliveWrite.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConstantTextHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected void channelRead0(ChannelHandlerContext ctx, RoutedRequest routed) throws Exception { HttpResponse response = new DefaultFullHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(encodedText)); response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, encodedText.length); response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain"); KeepAliveWrite.flush(ctx, routed.getRequest(), response); }
Example #2
Source File: RedirectingSslHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { HttpRequest request = msg instanceof HttpRequest ? (HttpRequest) msg : null; String path = request == null ? "" : request.uri(); String redirectAddress = getRedirectAddress(ctx); log.trace("Received non-SSL request, redirecting to {}{}", redirectAddress, path); HttpResponse response = HandlerRedirectUtils.getRedirectResponse( redirectAddress, path, HttpResponseStatus.MOVED_PERMANENTLY); if (request != null) { KeepAliveWrite.flush(ctx, request, response); } else { ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } }
Example #3
Source File: ConstantTextHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected void channelRead0(ChannelHandlerContext ctx, RoutedRequest routed) throws Exception { HttpResponse response = new DefaultFullHttpResponse( HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(encodedText)); response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, encodedText.length); response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain"); KeepAliveWrite.flush(ctx, routed.getRequest(), response); }
Example #4
Source File: RedirectingSslHandler.java From flink with Apache License 2.0 | 5 votes |
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { HttpRequest request = msg instanceof HttpRequest ? (HttpRequest) msg : null; String path = request == null ? "" : request.uri(); String redirectAddress = getRedirectAddress(ctx); log.trace("Received non-SSL request, redirecting to {}{}", redirectAddress, path); HttpResponse response = HandlerRedirectUtils.getRedirectResponse( redirectAddress, path, HttpResponseStatus.MOVED_PERMANENTLY); if (request != null) { KeepAliveWrite.flush(ctx, request, response); } else { ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } }
Example #5
Source File: RedirectingSslHandler.java From flink with Apache License 2.0 | 5 votes |
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { HttpRequest request = msg instanceof HttpRequest ? (HttpRequest) msg : null; String path = request == null ? "" : request.uri(); String redirectAddress = getRedirectAddress(ctx); log.trace("Received non-SSL request, redirecting to {}{}", redirectAddress, path); HttpResponse response = HandlerRedirectUtils.getRedirectResponse( redirectAddress, path, HttpResponseStatus.MOVED_PERMANENTLY); if (request != null) { KeepAliveWrite.flush(ctx, request, response); } else { ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } }
Example #6
Source File: LeaderRetrievalHandlerTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected void respondAsLeader(ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest, RestfulGateway gateway) throws Exception { Assert.assertTrue(channelHandlerContext.channel().eventLoop().inEventLoop()); HttpResponse response = HandlerRedirectUtils.getResponse(HttpResponseStatus.OK, RESPONSE_MESSAGE); KeepAliveWrite.flush(channelHandlerContext.channel(), routedRequest.getRequest(), response); }
Example #7
Source File: LeaderRetrievalHandlerTest.java From flink with Apache License 2.0 | 4 votes |
@Override protected void respondAsLeader(ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest, RestfulGateway gateway) throws Exception { Assert.assertTrue(channelHandlerContext.channel().eventLoop().inEventLoop()); HttpResponse response = HandlerRedirectUtils.getResponse(HttpResponseStatus.OK, RESPONSE_MESSAGE); KeepAliveWrite.flush(channelHandlerContext.channel(), routedRequest.getRequest(), response); }
Example #8
Source File: LeaderRetrievalHandlerTest.java From flink with Apache License 2.0 | 4 votes |
@Override protected void respondAsLeader(ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest, RestfulGateway gateway) throws Exception { Assert.assertTrue(channelHandlerContext.channel().eventLoop().inEventLoop()); HttpResponse response = HandlerRedirectUtils.getResponse(HttpResponseStatus.OK, RESPONSE_MESSAGE); KeepAliveWrite.flush(channelHandlerContext.channel(), routedRequest.getRequest(), response); }