@Override protected void initialize(UniversityFooConfiguration configuration, Environment environment) throws ClassNotFoundException { environment .addProvider(new OAuthProvider<AuthenticatedPrincipal>(new OAuthAuthenticator(configuration), "protected-resources")); environment.addResource(new UniversityResource()); }
@Override public void run(Environment environment) { environment.addProvider(ViewMessageBodyWriter.class); } }
@Override public void run(Environment environment) { environment.addProvider(new ScalaCollectionsQueryParamInjectableProvider()); } }
private void initializeExceptionMappers(MultiBitExchangeApiConfiguration configuration, Environment environment) { ResourceConfig jerseyResourceConfig = environment.getJerseyResourceConfig(); Set<Object> singletons = jerseyResourceConfig.getSingletons(); List<Object> toRemove = Lists.newArrayList(); for (Object singleton : singletons) { if (ExceptionMapper.class.isAssignableFrom(singleton.getClass())) { if (singleton.getClass().getName().startsWith("com.yammer.dropwizard.jersey")) { toRemove.add(singleton); } } } for (Object exceptionMapper : toRemove) { jerseyResourceConfig.getSingletons().remove(exceptionMapper); } environment.addProvider(new MultiBitExchangeExceptionMapper()); }
@Override public void run(OpenIDDemoConfiguration openIDDemoConfiguration, Environment environment) throws Exception { // Configure authenticator OpenIDAuthenticator authenticator = new OpenIDAuthenticator(); // Configure environment environment.scanPackagesForResourcesAndProviders(PublicHomeResource.class); // Health checks environment.addHealthCheck(new uk.co.froot.demo.openid.health.OpenIdDemoHealthCheck()); // Providers environment.addProvider(new ViewMessageBodyWriter()); environment.addProvider(new OpenIDRestrictedToProvider<User>(authenticator, "OpenID")); // Session handler environment.setSessionHandler(new SessionHandler()); } }
@Override public void run(HVDFConfiguration config, Environment environment) throws Exception { // Get the configured default MongoDB URI MongoClientURI default_uri = config.mongodb.default_database_uri; // Initialize the services as per configuration ServiceManager services = new ServiceManager(config.services, default_uri); environment.manage(services); // Register the custom ExceptionMapper to handle ServiceExceptions environment.addProvider(new ServiceExceptionMapper()); environment.addResource( new FeedResource( services.getChannelService()) ); } }
@Override public void run(SocialiteConfiguration config, Environment environment) throws Exception { // Get the configured default MongoDB URI MongoClientURI default_uri = config.mongodb.default_database_uri; // Initialize the services as per configuration ServiceManager services = new ServiceManager(config.services, default_uri); environment.manage(services); // Register the custom ExceptionMapper to handle ServiceExceptions environment.addProvider(new ServiceExceptionMapper()); environment.addResource( new UserResource( services.getContentService(), services.getFeedService(), services.getUserGraphService() ) ); } }
@Override public void run(Configuration configuration, Environment environment) throws Exception { environment.addResource(new PizzaResource()); environment.addHealthCheck(new PizzaHealthCheck()); environment.addProvider(new HmacAuthProvider<>(new DefaultRequestHandler<>(new PizzaAuthenticator()))); } }