当前位置: 首页>>代码示例>>Java>>正文


Java Handler类代码示例

本文整理汇总了Java中ratpack.handling.Handler的典型用法代码示例。如果您正苦于以下问题:Java Handler类的具体用法?Java Handler怎么用?Java Handler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Handler类属于ratpack.handling包,在下文中一共展示了Handler类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Route

import ratpack.handling.Handler; //导入依赖的package包/类
public Route(final Resource resource, final Method method) {
    final Registry registry = Registry.builder().add(resource).add(method).build();
    final Handler chain = Handlers.chain(
            RequestLogger.ncsa(LOG),
            requestValidationHandler,
            Handlers.when(isMode(VrapMode.proxy),
                    Handlers.chain(
                            requestProxyHandler,
                            receivedResponseValidationHandler,
                            receivedResponseForwardHandler)),
            Handlers.when(isMode(VrapMode.example), requestExampleHandler));
    this.delegate = Handlers.register(registry, chain);
}
 
开发者ID:vrapio,项目名称:vrap,代码行数:14,代码来源:RamlRouter.java

示例2: RamlHandler

import ratpack.handling.Handler; //导入依赖的package包/类
public RamlHandler(FileContentModifier contentModifier) {
    final Registry registry = Registry.builder().add("get").build();
    final Handler chain = Handlers.chain(
            RequestLogger.ncsa(LOG),
            Handlers.when(
                    isJsonFile(),
                    new JsonFileHandler(contentModifier)
            ),
            new RamlFileHandler(contentModifier)
    );
    this.delegate = Handlers.register(registry, chain);
}
 
开发者ID:vrapio,项目名称:vrap,代码行数:13,代码来源:RamlFilesHandler.java

示例3: createRoutes

import ratpack.handling.Handler; //导入依赖的package包/类
private List<Handler> createRoutes(final List<SecurityScheme> schemes) throws Exception {
    final List<Handler> routes = new ArrayList<>();

    for (final SecurityScheme scheme : schemes) {
        routes.add(Handlers.prefix(
                scheme.name(),
                new Route(scheme.settings().accessTokenUri().value())
        ));
    }

    return routes;
}
 
开发者ID:vrapio,项目名称:vrap,代码行数:13,代码来源:AuthRouter.java

示例4: Route

import ratpack.handling.Handler; //导入依赖的package包/类
public Route(final String authUri) {
    requestProxyHandler = new AuthRouter.RequestProxyHandler(authUri);
    final Registry registry = Registry.builder().add(authUri).build();
    final Handler chain = Handlers.chain(
            RequestLogger.ncsa(LOG),
            requestProxyHandler
    );
    this.delegate = Handlers.register(registry, chain);
}
 
开发者ID:vrapio,项目名称:vrap,代码行数:10,代码来源:AuthRouter.java

示例5: doAuthorized

import ratpack.handling.Handler; //导入依赖的package包/类
/**
 * executes the consumer if the client is authorized
 * @param contextConsumer the consumer to execute
 * @return a handler that executes the consumer if authorized
 */
private Handler doAuthorized(Consumer<Context> contextConsumer) {
    return ctx -> {
        ctx.maybeGet(WorkerID.class)
                .orElseThrow(() -> new UnauthorizedException("Client needs the Authorization-header to acces the method"));
        contextConsumer.accept(ctx);
    };
}
 
开发者ID:coolcrowd,项目名称:worker-service,代码行数:13,代码来源:RatpackRouter.java

示例6: getRoutes

import ratpack.handling.Handler; //导入依赖的package包/类
public Handler getRoutes() {
    return routes;
}
 
开发者ID:vrapio,项目名称:vrap,代码行数:4,代码来源:RamlRouter.java

示例7: createRoutes

import ratpack.handling.Handler; //导入依赖的package包/类
private List<Handler> createRoutes(final Api api) throws Exception {
    return createRoutes(api, api.resources());
}
 
开发者ID:vrapio,项目名称:vrap,代码行数:4,代码来源:RamlRouter.java

示例8: getHandler

import ratpack.handling.Handler; //导入依赖的package包/类
public Handler getHandler() {
    return handler;
}
 
开发者ID:vrapio,项目名称:vrap,代码行数:4,代码来源:RamlFilesHandler.java

示例9: SoapActionHandler

import ratpack.handling.Handler; //导入依赖的package包/类
public SoapActionHandler(String soapAction, Handler handler) {
  this.soapAction = soapAction;
  this.handler = handler;
}
 
开发者ID:danveloper,项目名称:hands-on-ratpack-java,代码行数:5,代码来源:SoapActionHandler.java

示例10: fromHandler

import ratpack.handling.Handler; //导入依赖的package包/类
/**
 * Creates an embedded application with a default launch config (no base dir, ephemeral port) and the given handler.
 * <p>
 * If you need to tweak the launch config, use {@link #fromLaunchConfigBuilder(Function)}.
 *
 * @param handler the application handler
 * @return a newly created embedded application
 */
static EmbeddedApp fromHandler(Handler handler) {
    return fromLaunchConfigBuilder(lcb -> lcb.build(lc -> handler));
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-ratpack,代码行数:12,代码来源:EmbeddedApp.java


注:本文中的ratpack.handling.Handler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。