use of com.google.inject.Provides in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getServerAttributeSyntax.
@Provides
@Singleton
@Named("ServerAttributeSyntax")
public Properties getServerAttributeSyntax() throws IOException {
Properties syntaxProperties = new Properties();
syntaxProperties.load(getClass().getClassLoader().getResourceAsStream("validserverconfig.properties"));
return syntaxProperties;
}
use of com.google.inject.Provides in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getAuthenticateHandler.
@Provides
@Named("AuthenticateHandler")
@Inject
Handler getAuthenticateHandler(@Named("InvalidRealmNames") Set<String> invalidRealms, HttpAccessAuditFilterFactory httpAuditFactory) {
invalidRealms.add(firstPathSegment("authenticate"));
org.forgerock.http.routing.Router authenticateVersionRouter = new org.forgerock.http.routing.Router();
Handler authenticateHandlerV1 = Endpoints.from(AuthenticationServiceV1.class);
Handler authenticateHandlerV2 = Endpoints.from(AuthenticationServiceV2.class);
authenticateVersionRouter.addRoute(RouteMatchers.requestResourceApiVersionMatcher(version(1, 1)), authenticateHandlerV1);
authenticateVersionRouter.addRoute(RouteMatchers.requestResourceApiVersionMatcher(version(2)), authenticateHandlerV2);
return chainOf(authenticateVersionRouter, httpAuditFactory.createFilter(AUTHENTICATION));
}
use of com.google.inject.Provides in project gerrit by GerritCodeReview.
the class MimeUtil2Module method provideMimeUtil2.
@Provides
@Singleton
MimeUtil2 provideMimeUtil2() {
MimeUtil2 m = new MimeUtil2();
m.registerMimeDetector(ExtensionMimeDetector.class.getName());
m.registerMimeDetector(MagicMimeMimeDetector.class.getName());
if (HostPlatform.isWin32()) {
m.registerMimeDetector("eu.medsea.mimeutil.detector.WindowsRegistryMimeDetector");
}
m.registerMimeDetector(DefaultFileExtensionRegistry.class.getName());
return m;
}
use of com.google.inject.Provides in project ratpack by ratpack.
the class ThymeleafModule method provideTemplateResolver.
@Provides
@Singleton
ITemplateResolver provideTemplateResolver(ServerConfig serverConfig, Config config) {
IResourceResolver resourceResolver = new FileSystemBindingThymeleafResourceResolver(serverConfig.getBaseDir());
TemplateResolver templateResolver = new TemplateResolver();
templateResolver.setResourceResolver(resourceResolver);
templateResolver.setTemplateMode(getTemplatesModeSetting(config));
templateResolver.setPrefix(getTemplatesPrefixSetting(config));
templateResolver.setSuffix(getTemplatesSuffixSetting(config));
templateResolver.setCacheable(getCacheSizeSetting(config) > 0);
// Never use TTL expiration
templateResolver.setCacheTTLMs(null);
return templateResolver;
}
use of com.google.inject.Provides in project ratpack by ratpack.
the class ThymeleafModule method provideTemplateEngine.
@Provides
@Singleton
TemplateEngine provideTemplateEngine(ITemplateResolver templateResolver, ICacheManager cacheManager, Set<IDialect> dialects) {
final TemplateEngine templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.setCacheManager(cacheManager);
dialects.stream().forEach(templateEngine::addDialect);
return templateEngine;
}
Aggregations