當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。