@Singleton public class GuiceContainer extends ServletContainer
Servlet or Filter for deploying root resource classes
with Guice integration.
This class must be registered using
com.google.inject.servlet.ServletModule.
This class extends ServletContainer and initiates the
WebApplication with a Guice-based IoCComponentProviderFactory,
GuiceComponentProviderFactory, such that instances of resource and
provider classes declared and managed by Guice can be obtained.
Guice-bound classes will be automatically registered if such classes are root resource classes or provider classes. It is not necessary to provide initialization parameters for declaring classes in the web.xml unless a mixture of Guice-bound and Jersey-managed classes is required.
ServletModule,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
class |
GuiceContainer.ServletGuiceComponentProviderFactory |
ServletContainer.ContextInjectableProvider<T>APPLICATION_CONFIG_CLASS, FEATURE_ALLOW_RAW_MANAGED_BEANS, FEATURE_FILTER_FORWARD_ON_404, GLASSFISH_DEFAULT_ERROR_PAGE_RESPONSE, JSP_TEMPLATES_BASE_PATH, PROPERTY_FILTER_CONTEXT_PATH, PROPERTY_WEB_PAGE_CONTENT_REGEX, RESOURCE_CONFIG_CLASS| Constructor and Description |
|---|
GuiceContainer(com.google.inject.Injector injector)
Creates a new Injector.
|
| Modifier and Type | Method and Description |
|---|---|
protected ResourceConfig |
getDefaultResourceConfig(java.util.Map<java.lang.String,java.lang.Object> props,
WebConfig webConfig) |
WebApplication |
getWebApplication() |
protected void |
initiate(ResourceConfig config,
WebApplication webapp) |
configure, configure, configure, create, destroy, doFilter, doFilter, getDefaultResourceConfig, getServletContext, getStaticContentPattern, getWebConfig, init, init, init, load, reload, service, servicedoDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service@Inject public GuiceContainer(com.google.inject.Injector injector)
injector - the Guice injectorprotected ResourceConfig getDefaultResourceConfig(java.util.Map<java.lang.String,java.lang.Object> props, WebConfig webConfig) throws javax.servlet.ServletException
getDefaultResourceConfig in class ServletContainerjavax.servlet.ServletExceptionprotected void initiate(ResourceConfig config, WebApplication webapp)
initiate in class ServletContainerpublic WebApplication getWebApplication()
Copyright © 2016 Oracle Corporation. All Rights Reserved.