Package ratpack.handling

Examples of ratpack.handling.Handler


    final CountDownLatch latch = new CountDownLatch(1);

    final EventController<RequestOutcome> eventController = new DefaultEventController<>();

    final Handler next = context -> {
      calledNext = true;
      latch.countDown();
    };

    final BindAddress bindAddress = new BindAddress() {
View Full Code Here


  @Override
  public HandlingResult handleChain(Action<? super Chain> chainAction) throws Exception {
    LaunchConfig launchConfig = launchConfigBuilder.build();
    Registry registry = registryBuilder.build();
    Handler handler = Handlers.chain(launchConfig, registry, chainAction);
    return invoke(handler, launchConfig, registry);
  }
View Full Code Here

    for (Action<? super Injector> initAction : injectorActions) {
      initAction.execute(injector);
    }

    Handler handler = injectorTransformer.apply(injector);
    Collections.reverse(modules);
    for (Module module : modules) {
      if (module instanceof HandlerDecoratingModule) {
        handler = ((HandlerDecoratingModule) module).decorate(injector, handler);
      }
View Full Code Here

    this.factory = factory;
  }

  @Override
  public void handle(Context context) throws Exception {
    Handler handler = factory.create();
    handler.handle(context);
  }
View Full Code Here

      applicationConstants, bindAddress, request, response, directChannelAccess, requestOutcomeEventController.getRegistry()
    );

    DefaultContext.start(execController.getControl(), requestConstants, registry, handlers, execution -> {
      if (!transmitted.get()) {
        Handler lastHandler = requestConstants.handler;
        StringBuilder description = new StringBuilder();
        description
          .append("No response sent for ")
          .append(request.getMethod().getName())
          .append(" request to ")
View Full Code Here

      }
    }).run();
  }

  public void handle(Context context) throws Exception {
    Handler handler = reloadHandler.create();
    if (handler == null) {
      context.getResponse().send("script file does not exist:" + script.toAbsolutePath());
    } else {
      handler.handle(context);
    }
  }
View Full Code Here

    if (winner == null || winner.toString().isEmpty()) {
      context.clientError(406);
    } else {
      context.getResponse().contentType(winner);
      Handler handler = handlers.get(winner);
      handler.handle(context);
    }
  }
View Full Code Here

  public Handler decorate(Injector injector, Handler handler) {
    final String callbackPath = getCallbackPath(injector);
    final Client<C, U> client = getClient(injector);
    final Authorizer authorizer = getAuthorizer(injector);
    final Pac4jClientsHandler clientsHandler = new Pac4jClientsHandler(callbackPath, client);
    final Handler callbackHandler = new Pac4jCallbackHandlerBuilder().build();
    final Pac4jAuthenticationHandler authenticationHandler = new Pac4jAuthenticationHandler(client.getName(), authorizer);
    return Handlers.chain(clientsHandler, Handlers.path(callbackPath, callbackHandler), authenticationHandler, handler);
  }
View Full Code Here

  @Override
  public void render(final Context context, final JsonRender object) throws Exception {
    context.byContent(new Action<ByContentSpec>() {
      @Override
      public void execute(ByContentSpec byContentSpec) throws Exception {
        byContentSpec.json(new Handler() {
          @Override
          public void handle(Context context) {
            ObjectWriter writer = object.getObjectWriter();
            if (writer == null) {
              writer = defaultObjectWriter;
View Full Code Here

TOP

Related Classes of ratpack.handling.Handler

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.