@Override public State onHeadersReceived(HttpHeaders headers) throws Exception { responseBuilder.accumulate(headers); String contentLengthHeader = headers.get(CONTENT_LENGTH); if (contentLengthHeader != null) { if (Long.parseLong(contentLengthHeader) == -1L) { return AsyncHandler.State.ABORT; } } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onHeadersReceived(headers); } return State.CONTINUE; }
@Override public State onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception { if (accumulateBody) { responseBuilder.accumulate(bodyPart); } State state = State.CONTINUE; try { resumableListener.onBytesReceived(bodyPart.getBodyByteBuffer()); } catch (IOException ex) { return AsyncHandler.State.ABORT; } if (decoratedAsyncHandler != null) { state = decoratedAsyncHandler.onBodyPartReceived(bodyPart); } byteTransferred.addAndGet(bodyPart.getBodyPartBytes().length); resumableProcessor.put(url, byteTransferred.get()); return state; }
/** * {@inheritDoc} */ public State onHeadersReceived(final HttpResponseHeaders headers) throws Exception { builder.accumulate(headers); return State.CONTINUE; }
/** * {@inheritDoc} */ public State onStatusReceived(final HttpResponseStatus status) throws Exception { builder.reset(); builder.accumulate(status); return State.CONTINUE; }
/** * {@inheritDoc} */ public State onStatusReceived(final HttpResponseStatus status) throws Exception { builder.reset(); builder.accumulate(status); return State.CONTINUE; }
public State onHeadersReceived(HttpResponseHeaders headers) throws Exception { responseBuilder.accumulate(headers); return State.CONTINUE; }
public State onStatusReceived(HttpResponseStatus responseStatus) throws Exception { responseBuilder.reset(); responseBuilder.accumulate(responseStatus); return State.CONTINUE; }
/** * {@inheritDoc} */ public State onHeadersReceived(final HttpResponseHeaders headers) throws Exception { builder.accumulate(headers); return State.CONTINUE; }
/** * {@inheritDoc} */ public State onBodyPartReceived(final HttpResponseBodyPart content) throws Exception { builder.accumulate(content); return State.CONTINUE; }
/** * {@inheritDoc} */ public State onStatusReceived(final HttpResponseStatus status) throws Exception { builder.reset(); builder.accumulate(status); return State.CONTINUE; }
@Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { responseBuilder.accumulate(status); if (status.getStatusCode() == 200 || status.getStatusCode() == 206) { url = status.getUri().toUrl(); } else { return AsyncHandler.State.ABORT; } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onStatusReceived(status); } return AsyncHandler.State.CONTINUE; }
@Override public State onBodyPartReceived(HttpResponseBodyPart content) throws Exception { builder.accumulate(content); return State.CONTINUE; }
@Override public State onStatusReceived(HttpResponseStatus status) throws Exception { builder.reset(); builder.accumulate(status); return State.CONTINUE; }
@Override public State onHeadersReceived(HttpHeaders headers) throws Exception { builder.accumulate(headers); return State.CONTINUE; }
@Override public State onHeadersReceived(HttpHeaders headers) { responseBuilder.accumulate(headers); return State.CONTINUE; }
@Override public State onTrailingHeadersReceived(HttpHeaders headers) { responseBuilder.accumulate(headers); return State.CONTINUE; }
@Override public State onStatusReceived(HttpResponseStatus responseStatus) { responseBuilder.reset(); responseBuilder.accumulate(responseStatus); return State.CONTINUE; }
@Override public State onTrailingHeadersReceived(HttpHeaders headers) throws Exception { builder.accumulate(headers); return State.CONTINUE; }
@Override public State onTrailingHeadersReceived(HttpHeaders headers) { responseBuilder.accumulate(headers); return State.CONTINUE; }
private static Response.ResponseBuilder responseBuilder(HttpVersion version, HttpResponseStatus status) { final Response.ResponseBuilder builder = new Response.ResponseBuilder(); builder.accumulate( new NettyResponseStatus( Uri.create(TARGET_URL), new DefaultHttpResponse(version, status), null )); return builder; }