Search in sources :

Example 1 with EchoTask

use of com.example.helloworld.tasks.EchoTask in project dropwizard by dropwizard.

the class HelloWorldApplication method run.

@Override
public void run(HelloWorldConfiguration configuration, Environment environment) {
    final PersonDAO dao = new PersonDAO(hibernateBundle.getSessionFactory());
    final Template template = configuration.buildTemplate();
    environment.healthChecks().register("template", new TemplateHealthCheck(template));
    environment.admin().addTask(new EchoTask());
    environment.jersey().register(DateRequiredFeature.class);
    environment.jersey().register(new AuthDynamicFeature(new BasicCredentialAuthFilter.Builder<User>().setAuthenticator(new ExampleAuthenticator()).setAuthorizer(new ExampleAuthorizer()).setRealm("SUPER SECRET STUFF").buildAuthFilter()));
    environment.jersey().register(new AuthValueFactoryProvider.Binder<>(User.class));
    environment.jersey().register(RolesAllowedDynamicFeature.class);
    environment.jersey().register(new HelloWorldResource(template));
    environment.jersey().register(new ViewResource());
    environment.jersey().register(new ProtectedResource());
    environment.jersey().register(new PeopleResource(dao));
    environment.jersey().register(new PersonResource(dao));
    environment.jersey().register(new FilteredResource());
}
Also used : User(com.example.helloworld.core.User) AuthValueFactoryProvider(io.dropwizard.auth.AuthValueFactoryProvider) PeopleResource(com.example.helloworld.resources.PeopleResource) ExampleAuthorizer(com.example.helloworld.auth.ExampleAuthorizer) ExampleAuthenticator(com.example.helloworld.auth.ExampleAuthenticator) Template(com.example.helloworld.core.Template) PersonDAO(com.example.helloworld.db.PersonDAO) ProtectedResource(com.example.helloworld.resources.ProtectedResource) ViewResource(com.example.helloworld.resources.ViewResource) TemplateHealthCheck(com.example.helloworld.health.TemplateHealthCheck) AuthDynamicFeature(io.dropwizard.auth.AuthDynamicFeature) HelloWorldResource(com.example.helloworld.resources.HelloWorldResource) PersonResource(com.example.helloworld.resources.PersonResource) EchoTask(com.example.helloworld.tasks.EchoTask) FilteredResource(com.example.helloworld.resources.FilteredResource)

Aggregations

ExampleAuthenticator (com.example.helloworld.auth.ExampleAuthenticator)1 ExampleAuthorizer (com.example.helloworld.auth.ExampleAuthorizer)1 Template (com.example.helloworld.core.Template)1 User (com.example.helloworld.core.User)1 PersonDAO (com.example.helloworld.db.PersonDAO)1 TemplateHealthCheck (com.example.helloworld.health.TemplateHealthCheck)1 FilteredResource (com.example.helloworld.resources.FilteredResource)1 HelloWorldResource (com.example.helloworld.resources.HelloWorldResource)1 PeopleResource (com.example.helloworld.resources.PeopleResource)1 PersonResource (com.example.helloworld.resources.PersonResource)1 ProtectedResource (com.example.helloworld.resources.ProtectedResource)1 ViewResource (com.example.helloworld.resources.ViewResource)1 EchoTask (com.example.helloworld.tasks.EchoTask)1 AuthDynamicFeature (io.dropwizard.auth.AuthDynamicFeature)1 AuthValueFactoryProvider (io.dropwizard.auth.AuthValueFactoryProvider)1