use of com.example.helloworld.core.Template 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());
}
use of com.example.helloworld.core.Template in project dropwizard by dropwizard.
the class RenderCommand method run.
@Override
protected void run(Bootstrap<HelloWorldConfiguration> bootstrap, Namespace namespace, HelloWorldConfiguration configuration) throws Exception {
final Template template = configuration.buildTemplate();
if (namespace.getBoolean("include-default")) {
LOGGER.info("DEFAULT => {}", template.render(Optional.empty()));
}
for (String name : namespace.<String>getList("names")) {
for (int i = 0; i < 1000; i++) {
LOGGER.info("{} => {}", name, template.render(Optional.of(name)));
Thread.sleep(1000);
}
}
}
Aggregations