Ejemplo n.º 1
0
 private boolean updateBodyAndInterrupt(
     NettyResponseFuture<?> future, AsyncHandler<?> handler, HttpResponseBodyPart bodyPart)
     throws Exception {
   boolean interrupt = handler.onBodyPartReceived(bodyPart) != State.CONTINUE;
   if (interrupt) future.setKeepAlive(false);
   return interrupt;
 }
Ejemplo n.º 2
0
  private boolean handleHttpResponse(
      final HttpResponse response,
      final Channel channel,
      final NettyResponseFuture<?> future,
      AsyncHandler<?> handler)
      throws Exception {

    HttpRequest httpRequest = future.getNettyRequest().getHttpRequest();
    logger.debug("\n\nRequest {}\n\nResponse {}\n", httpRequest, response);

    future.setKeepAlive(
        config.getKeepAliveStrategy().keepAlive(future.getTargetRequest(), httpRequest, response));

    NettyResponseStatus status =
        new NettyResponseStatus(future.getUri(), config, response, channel);
    HttpResponseHeaders responseHeaders = new HttpResponseHeaders(response.headers());

    return exitAfterProcessingFilters(channel, future, handler, status, responseHeaders)
        || //
        exitAfterSpecialCases(response, channel, future)
        || //
        exitAfterHandler(channel, future, response, handler, status, httpRequest, responseHeaders);
  }