|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.sun.jersey.spi.container.servlet.ServletContainer
com.sun.jersey.guice.spi.container.servlet.GuiceContainer
public class GuiceContainer
A 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
,
GuiceContainer.ServletGuiceComponentProviderFactory
, 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 FormNested Class Summary | |
---|---|
class |
GuiceContainer.ServletGuiceComponentProviderFactory
|
Nested classes/interfaces inherited from class com.sun.jersey.spi.container.servlet.ServletContainer |
---|
ServletContainer.ContextInjectableProvider<T> |
Field Summary |
---|
Fields inherited from class com.sun.jersey.spi.container.servlet.ServletContainer |
---|
APPLICATION_CONFIG_CLASS, FEATURE_FILTER_FORWARD_ON_404, JSP_TEMPLATES_BASE_PATH, PROPERTY_WEB_PAGE_CONTENT_REGEX, RESOURCE_CONFIG_CLASS |
Constructor Summary | |
---|---|
GuiceContainer(com.google.inject.Injector injector)
Creates a new Injector. |
Method Summary | |
---|---|
protected ResourceConfig |
getDefaultResourceConfig(Map<String,Object> props,
WebConfig webConfig)
Get the default resource configuration if one is not declared in the web.xml. |
WebApplication |
getWebApplication()
|
protected void |
initiate(ResourceConfig config,
WebApplication webapp)
Initiate the WebApplication . |
Methods inherited from class com.sun.jersey.spi.container.servlet.ServletContainer |
---|
configure, configure, configure, create, destroy, doFilter, doFilter, getDefaultResourceConfig, getServletContext, getStaticContentPattern, getWebConfig, init, init, init, load, reload, service, service |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@Inject public GuiceContainer(com.google.inject.Injector injector)
injector
- the Guice injectorMethod Detail |
---|
protected ResourceConfig getDefaultResourceConfig(Map<String,Object> props, WebConfig webConfig) throws javax.servlet.ServletException
ServletContainer
This implementaton returns an instance of WebAppResourceConfig
that scans in files and directories as declared by the
ClasspathResourceConfig.PROPERTY_CLASSPATH
if present, otherwise
in the "WEB-INF/lib" and "WEB-INF/classes" directories.
An inheriting class may override this method to supply a different default resource configuraton implementaton.
getDefaultResourceConfig
in class ServletContainer
props
- the properties to pass to the resource configuraton.webConfig
- the web configuration.
javax.servlet.ServletException
protected void initiate(ResourceConfig config, WebApplication webapp)
ServletContainer
WebApplication
.
This method will be called once at initiation and for each reload of the Web application.
An inheriting class may override this method to initiate the Web application with different parameters.
initiate
in class ServletContainer
config
- the Resource configurationwebapp
- the Web applicationpublic WebApplication getWebApplication()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |