private void handleContent(Object msg) { HttpContent content = (HttpContent) msg; if (content.decoderResult() != DecoderResult.SUCCESS) { handleError(content); return; } Buffer buffer = Buffer.buffer(VertxHandler.safeBuffer(content.content(), chctx.alloc())); if (METRICS_ENABLED) { reportBytesRead(buffer); } requestInProgress.handleContent(buffer); //TODO chunk trailers if (content instanceof LastHttpContent) { handleEnd(); } }
final DecoderResult decoderResult = content.decoderResult(); if (!decoderResult.isSuccess()) { fail(id, HttpResponseStatus.BAD_REQUEST);
if (msg instanceof HttpContent) { final HttpContent content = (HttpContent) msg; final DecoderResult decoderResult = content.decoderResult(); if (!decoderResult.isSuccess()) { fail(ctx, new ProtocolViolationException(decoderResult.cause()));
private void handleContent(Object msg) { HttpContent content = (HttpContent) msg; if (content.decoderResult() != DecoderResult.SUCCESS) { handleError(content); return; } Buffer buffer = Buffer.buffer(VertxHandler.safeBuffer(content.content(), chctx.alloc())); if (METRICS_ENABLED) { reportBytesRead(buffer); } requestInProgress.handleContent(buffer); //TODO chunk trailers if (content instanceof LastHttpContent) { handleEnd(); } }
private void validateHttpContent() { if (httpContent == null) { throw new DecoderException("No entity was added to the queue before the timeout"); } else if (httpContent.decoderResult().isFailure()) { throw new DecoderException(httpContent.decoderResult().cause().getMessage()); } } }
@Test public void doChannelRead_HttpContent_throws_exception_when_failed_decoder_result() { // given Throwable decoderFailureCauseMock = mock(Throwable.class); DecoderResult decoderResult = DecoderResult.failure(decoderFailureCauseMock); doReturn(decoderResult).when(httpContentMock).decoderResult(); // when Throwable thrownException = Assertions.catchThrowable(() -> handler.doChannelRead(ctxMock, httpContentMock)); // then assertThat(thrownException).isExactlyInstanceOf(InvalidHttpRequestException.class); assertThat(thrownException.getCause()).isSameAs(decoderFailureCauseMock); verify(httpContentMock).release(); } }
if (!chunk.decoderResult().isSuccess()) this.exceptionCaught(ctx, chunk.decoderResult().cause());
bodyStream.onNext(content.nioBuffer()); if (httpContent.decoderResult().isFailure()) { bodyStream.onError(httpContent.decoderResult().cause());
final DecoderResult decoderResult = content.decoderResult(); if (!decoderResult.isSuccess()) { fail(ctx, HttpResponseStatus.BAD_REQUEST);