Package com.barchart.http.request

Examples of com.barchart.http.request.RequestHandler


    // Create request/response
    final PooledServerRequest request =
        new PooledServerRequest(ctx.channel());
    request.init(msg, relativePath);

    final RequestHandler handler = mapping.handler(request);

    final PooledServerResponse response = new PooledServerResponse();
    response.init(ctx, handler, request, config.logger());

    // Store in ChannelHandlerContext for future reference
    ctx.attr(ATTR_RESPONSE).set(response);

    try {

      // Process request
      handler.onRequest(request, response);

    } catch (final Exception e) {

      // Catch server errors
      response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
View Full Code Here


    final PooledServerResponse response = ctx.attr(ATTR_RESPONSE).get();

    if (response != null && !response.isFinished()) {

      final RequestHandler handler = response.handler();

      if (handler != null) {
        handler.onAbort(response.request(), response);
      }

      // response.close() calls handler.onComplete() also
      response.close();
View Full Code Here

    final PooledServerResponse response = ctx.attr(ATTR_RESPONSE).get();

    if (response != null && !response.isFinished()) {

      final RequestHandler handler = response.handler();

      if (handler != null) {
        handler.onException(response.request(), response, exception);
      }

      config.logger().error(response.request(), response, exception);

      response.close();
View Full Code Here

    // Create request/response
    final PooledServerRequest request = messagePool.getRequest();
    request.init(ctx.channel(), msg, relativePath);

    final RequestHandler handler = mapping.handler(request);

    final PooledServerResponse response = messagePool.getResponse();
    response.init(ctx, this, handler, request, config.logger());

    // Store in ChannelHandlerContext for future reference
    ctx.attr(ATTR_RESPONSE).set(response);

    try {

      // Process request
      handler.onRequest(request, response);

    } catch (final Throwable t) {

      // Catch server errors
      response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
View Full Code Here

        if (!response.isFinished()) {

          response.close();

          final RequestHandler handler = response.handler();

          if (handler != null) {
            handler.onAbort(response.request(), response);
          }

        }

      } finally {
View Full Code Here

            config.errorHandler().onError(response.request(),
                response, exception);

            response.close();

            final RequestHandler handler = response.handler();

            if (handler != null) {
              handler.onException(response.request(), response,
                  exception);
            }

          }
View Full Code Here

    if (response != null) {

      try {

        final RequestHandler handler = response.handler();

        if (handler != null) {
          handler.onComplete(response.request(), response);
        }

      } finally {

        messagePool.makeAvailable(response.request());
View Full Code Here

      return;
    }

    request.init(ctx.channel(), msg, relativePath);

    final RequestHandler handler = mapping.handler(request);

    final PooledServerResponse response = messagePool.getResponse();
    response.init(ctx, this, handler, request, config.logger());

    // Store in ChannelHandlerContext for future reference
    ctx.attr(ATTR_RESPONSE).set(response);

    try {

      // Process request
      handler.onRequest(request, response);

    } catch (final Throwable t) {

      // Catch server errors
      response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
View Full Code Here

        if (!response.isFinished()) {

          response.close();

          final RequestHandler handler = response.handler();

          if (handler != null) {
            handler.onAbort(response.request(), response);
          }

        }

      } finally {
View Full Code Here

            config.errorHandler().onError(response.request(),
                response, exception);

            response.close();

            final RequestHandler handler = response.handler();

            if (handler != null) {
              handler.onException(response.request(), response,
                  exception);
            }

          }
View Full Code Here

TOP

Related Classes of com.barchart.http.request.RequestHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.