Package io.dropwizard.setup
Class Environment
- java.lang.Object
-
- io.dropwizard.setup.Environment
-
public class Environment extends Object
A Dropwizard application's environment.
-
-
Constructor Summary
Constructors Constructor Description Environment(String name)
Creates an environment with the system classloader, default object mapper, default validator factory, default health check registry, and default configuration for tests.Environment(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper, javax.validation.ValidatorFactory validatorFactory, com.codahale.metrics.MetricRegistry metricRegistry, ClassLoader classLoader, com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, Configuration configuration)
Creates a new environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AdminEnvironment
admin()
Returns the application'sAdminEnvironment
.MutableServletContextHandler
getAdminContext()
MutableServletContextHandler
getApplicationContext()
ExecutorService
getHealthCheckExecutorService()
Returns anExecutorService
to run time bound health checksjavax.servlet.Servlet
getJerseyServletContainer()
String
getName()
Returns the application's name.com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
Returns the application'sObjectMapper
.javax.validation.Validator
getValidator()
Returns the application'sValidator
.com.codahale.metrics.health.HealthCheckRegistry
healthChecks()
Returns the application'sHealthCheckRegistry
.JerseyEnvironment
jersey()
Returns the application'sJerseyEnvironment
.LifecycleEnvironment
lifecycle()
Returns the application'sLifecycleEnvironment
.com.codahale.metrics.MetricRegistry
metrics()
Returns the application'sMetricRegistry
.ServletEnvironment
servlets()
Returns the application'sServletEnvironment
.void
setValidator(javax.validation.Validator validator)
Sets the application'sValidator
.
-
-
-
Constructor Detail
-
Environment
public Environment(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper, javax.validation.ValidatorFactory validatorFactory, com.codahale.metrics.MetricRegistry metricRegistry, @Nullable ClassLoader classLoader, com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, Configuration configuration)
Creates a new environment.- Parameters:
name
- the name of the applicationobjectMapper
- theObjectMapper
for the application
-
Environment
public Environment(String name)
Creates an environment with the system classloader, default object mapper, default validator factory, default health check registry, and default configuration for tests.- Since:
- 2.0
-
-
Method Detail
-
jersey
public JerseyEnvironment jersey()
Returns the application'sJerseyEnvironment
.
-
getHealthCheckExecutorService
public ExecutorService getHealthCheckExecutorService()
Returns anExecutorService
to run time bound health checks
-
admin
public AdminEnvironment admin()
Returns the application'sAdminEnvironment
.
-
lifecycle
public LifecycleEnvironment lifecycle()
Returns the application'sLifecycleEnvironment
.
-
servlets
public ServletEnvironment servlets()
Returns the application'sServletEnvironment
.
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
Returns the application'sObjectMapper
.
-
getName
public String getName()
Returns the application's name.
-
getValidator
public javax.validation.Validator getValidator()
Returns the application'sValidator
.
-
setValidator
public void setValidator(javax.validation.Validator validator)
Sets the application'sValidator
.
-
metrics
public com.codahale.metrics.MetricRegistry metrics()
Returns the application'sMetricRegistry
.
-
healthChecks
public com.codahale.metrics.health.HealthCheckRegistry healthChecks()
Returns the application'sHealthCheckRegistry
.
-
getApplicationContext
public MutableServletContextHandler getApplicationContext()
-
getJerseyServletContainer
@Nullable public javax.servlet.Servlet getJerseyServletContainer()
-
getAdminContext
public MutableServletContextHandler getAdminContext()
-
-