org.apache.flink.shaded.netty4.io.netty.handler.codec.TooLongFrameException Java Examples
The following examples show how to use
org.apache.flink.shaded.netty4.io.netty.handler.codec.TooLongFrameException.
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: FlinkHttpObjectAggregator.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override protected void decode( final ChannelHandlerContext ctx, final HttpObject msg, final List<Object> out) throws Exception { try { super.decode(ctx, msg, out); } catch (final TooLongFrameException e) { HandlerUtils.sendErrorResponse( ctx, false, new ErrorResponseBody(String.format( e.getMessage() + " Try to raise [%s]", RestOptions.SERVER_MAX_CONTENT_LENGTH.key())), HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE, responseHeaders); } }
Example #2
Source File: FlinkHttpObjectAggregator.java From flink with Apache License 2.0 | 6 votes |
@Override protected void decode( final ChannelHandlerContext ctx, final HttpObject msg, final List<Object> out) throws Exception { try { super.decode(ctx, msg, out); } catch (final TooLongFrameException e) { HandlerUtils.sendErrorResponse( ctx, false, new ErrorResponseBody(String.format( e.getMessage() + " Try to raise [%s]", RestOptions.SERVER_MAX_CONTENT_LENGTH.key())), HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE, responseHeaders); } }
Example #3
Source File: FlinkHttpObjectAggregator.java From flink with Apache License 2.0 | 6 votes |
@Override protected void decode( final ChannelHandlerContext ctx, final HttpObject msg, final List<Object> out) throws Exception { try { super.decode(ctx, msg, out); } catch (final TooLongFrameException e) { HandlerUtils.sendErrorResponse( ctx, false, new ErrorResponseBody(String.format( e.getMessage() + " Try to raise [%s]", RestOptions.SERVER_MAX_CONTENT_LENGTH.key())), HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE, responseHeaders); } }
Example #4
Source File: RestClient.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) { if (cause instanceof TooLongFrameException) { jsonFuture.completeExceptionally(new TooLongFrameException(String.format( cause.getMessage() + " Try to raise [%s]", RestOptions.CLIENT_MAX_CONTENT_LENGTH.key()))); } else { jsonFuture.completeExceptionally(cause); } ctx.close(); }
Example #5
Source File: RestServerEndpointITCase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Tests that responses larger than {@link #TEST_REST_MAX_CONTENT_LENGTH} are rejected. */ @Test public void testShouldRespectMaxContentLengthLimitForResponses() throws Exception { testHandler.handlerBody = id -> CompletableFuture.completedFuture( new TestResponse(id, createStringOfSize(TEST_REST_MAX_CONTENT_LENGTH))); try { sendRequestToTestHandler(new TestRequest(1)).get(); fail("Expected exception not thrown"); } catch (final ExecutionException e) { final Throwable throwable = ExceptionUtils.stripExecutionException(e); assertThat(throwable, instanceOf(TooLongFrameException.class)); assertThat(throwable.getMessage(), containsString("Try to raise")); } }
Example #6
Source File: RestClient.java From flink with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) { if (cause instanceof TooLongFrameException) { jsonFuture.completeExceptionally(new TooLongFrameException(String.format( cause.getMessage() + " Try to raise [%s]", RestOptions.CLIENT_MAX_CONTENT_LENGTH.key()))); } else { jsonFuture.completeExceptionally(cause); } ctx.close(); }
Example #7
Source File: RestServerEndpointITCase.java From flink with Apache License 2.0 | 5 votes |
/** * Tests that responses larger than {@link #TEST_REST_MAX_CONTENT_LENGTH} are rejected. */ @Test public void testShouldRespectMaxContentLengthLimitForResponses() throws Exception { testHandler.handlerBody = id -> CompletableFuture.completedFuture( new TestResponse(id, createStringOfSize(TEST_REST_MAX_CONTENT_LENGTH))); try { sendRequestToTestHandler(new TestRequest(1)).get(); fail("Expected exception not thrown"); } catch (final ExecutionException e) { final Throwable throwable = ExceptionUtils.stripExecutionException(e); assertThat(throwable, instanceOf(TooLongFrameException.class)); assertThat(throwable.getMessage(), containsString("Try to raise")); } }
Example #8
Source File: RestClient.java From flink with Apache License 2.0 | 5 votes |
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) { if (cause instanceof TooLongFrameException) { jsonFuture.completeExceptionally(new TooLongFrameException(String.format( cause.getMessage() + " Try to raise [%s]", RestOptions.CLIENT_MAX_CONTENT_LENGTH.key()))); } else { jsonFuture.completeExceptionally(cause); } ctx.close(); }
Example #9
Source File: RestServerEndpointITCase.java From flink with Apache License 2.0 | 5 votes |
/** * Tests that responses larger than {@link #TEST_REST_MAX_CONTENT_LENGTH} are rejected. */ @Test public void testShouldRespectMaxContentLengthLimitForResponses() throws Exception { testHandler.handlerBody = id -> CompletableFuture.completedFuture( new TestResponse(id, createStringOfSize(TEST_REST_MAX_CONTENT_LENGTH))); try { sendRequestToTestHandler(new TestRequest(1)).get(); fail("Expected exception not thrown"); } catch (final ExecutionException e) { final Throwable throwable = ExceptionUtils.stripExecutionException(e); assertThat(throwable, instanceOf(TooLongFrameException.class)); assertThat(throwable.getMessage(), containsString("Try to raise")); } }