Package io.dropwizard.jersey.setup
Class JerseyEnvironment
- java.lang.Object
-
- io.dropwizard.jersey.setup.JerseyEnvironment
-
public class JerseyEnvironment extends Object
-
-
Constructor Summary
Constructors Constructor Description JerseyEnvironment(JerseyContainerHolder holder, DropwizardResourceConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisable()voiddisable(String featureName)Disables the Jersey feature with the given name.voidenable(String featureName)Enables the Jersey feature with the given name.<T> @Nullable TgetProperty(String name)Gets the given Jersey property.DropwizardResourceConfiggetResourceConfig()StringgetUrlPattern()voidpackages(String... packages)Adds array of package names which will be used to scan for components.voidproperty(String name, @Nullable Object value)Sets the given Jersey property.voidregister(Class<?> componentClass)Adds the given class as a Jersey component.voidregister(Object component)Adds the given object as a Jersey singleton component.voidreplace(Function<org.glassfish.jersey.server.ResourceConfig,javax.servlet.Servlet> replace)voidsetUrlPattern(String urlPattern)
-
-
-
Constructor Detail
-
JerseyEnvironment
public JerseyEnvironment(JerseyContainerHolder holder, DropwizardResourceConfig config)
-
-
Method Detail
-
disable
public void disable()
-
replace
public void replace(Function<org.glassfish.jersey.server.ResourceConfig,javax.servlet.Servlet> replace)
-
register
public void register(Object component)
Adds the given object as a Jersey singleton component.- Parameters:
component- a Jersey singleton component
-
register
public void register(Class<?> componentClass)
Adds the given class as a Jersey component. N.B.: This class must either have a no-args constructor or use Jersey's built-in dependency injection.- Parameters:
componentClass- a Jersey component class
-
packages
public void packages(String... packages)
Adds array of package names which will be used to scan for components. Packages will be scanned recursively, including all nested packages.- Parameters:
packages- array of package names
-
enable
public void enable(String featureName)
Enables the Jersey feature with the given name.- Parameters:
featureName- the name of the feature to be enabled- See Also:
ResourceConfig
-
disable
public void disable(String featureName)
Disables the Jersey feature with the given name.- Parameters:
featureName- the name of the feature to be disabled- See Also:
ResourceConfig
-
property
public void property(String name, @Nullable Object value)
Sets the given Jersey property.- Parameters:
name- the name of the Jersey propertyvalue- the value of the Jersey property- See Also:
ResourceConfig
-
getProperty
public <T> @Nullable T getProperty(String name)
Gets the given Jersey property.- Parameters:
name- the name of the Jersey property- See Also:
ResourceConfig
-
getUrlPattern
public String getUrlPattern()
-
setUrlPattern
public void setUrlPattern(String urlPattern)
-
getResourceConfig
public DropwizardResourceConfig getResourceConfig()
-
-