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


Java Environment.metrics方法代码示例

本文整理汇总了Java中io.dropwizard.setup.Environment.metrics方法的典型用法代码示例。如果您正苦于以下问题:Java Environment.metrics方法的具体用法?Java Environment.metrics怎么用?Java Environment.metrics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.dropwizard.setup.Environment的用法示例。


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

示例1: metricsCollector

import io.dropwizard.setup.Environment; //导入方法依赖的package包/类
@Provides
@Singleton
private IdpAssertionMetricsCollector metricsCollector(Environment environment) {
    return new IdpAssertionMetricsCollector(environment.metrics());
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:6,代码来源:SamlEngineModule.java

示例2: metricRegistry

import io.dropwizard.setup.Environment; //导入方法依赖的package包/类
@Provides
@Singleton
public MetricRegistry metricRegistry(Environment environment) {
    return environment.metrics();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:6,代码来源:SamlSoapProxyModule.java

示例3: run

import io.dropwizard.setup.Environment; //导入方法依赖的package包/类
@Override
public void run(RufusConfiguration conf, Environment env) throws Exception {
    final DBIFactory factory = new DBIFactory();
    final DBI jdbi = factory.build(env, conf.getDataSourceFactory(), DB_SOURCE);

    final UserDao userDao = jdbi.onDemand(UserDao.class);
    final ArticleDao articleDao = jdbi.onDemand(ArticleDao.class);

    final FeedProcessorImpl processor = FeedProcessorImpl.newInstance(articleDao);
    final FeedParser parser = new FeedParser(articleDao, processor);

    final JwtConsumer jwtConsumer = new JwtConsumerBuilder()
        .setAllowedClockSkewInSeconds(30)
        .setRequireExpirationTime()
        .setRequireSubject()
        .setVerificationKey(new HmacKey(VERIFICATION_KEY))
        .setRelaxVerificationKeyValidation()
        .build();
    final CachingJwtAuthenticator<User> cachingJwtAuthenticator = new CachingJwtAuthenticator<>(
        env.metrics(),
        new JwtAuthenticator(userDao),
        conf.getAuthenticationCachePolicy()
    );

    env.jersey().register(new ArticleResource(userDao, articleDao, processor, parser));
    env.jersey().register(
        new UserResource(
            new BasicAuthenticator(userDao),
            new TokenGenerator(VERIFICATION_KEY),
            userDao,
            articleDao
        )
    );

    //route source
    env.jersey().setUrlPattern(ROOT_PATH);

    env.jersey().register(new AuthValueFactoryProvider.Binder<>(User.class));
    env.jersey().register(new AuthDynamicFeature(
        new JwtAuthFilter.Builder<User>()
            .setJwtConsumer(jwtConsumer)
            .setRealm(REALM)
            .setPrefix(BEARER)
            .setAuthenticator(cachingJwtAuthenticator)
            .buildAuthFilter()
    ));
}
 
开发者ID:jtanza,项目名称:rufus,代码行数:48,代码来源:RufusApplication.java


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