Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.spi.spring.container.servlet
Class SpringServlet

    java.lang.Object
      javax.servlet.GenericServlet
          javax.servlet.http.HttpServlet
              com.sun.jersey.spi.container.servlet.ServletContainer
                  com.sun.jersey.spi.spring.container.servlet.SpringServlet

All Implemented Interfaces:
  java.io.Serializable, javax.servlet.Filter, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class SpringServlet

extends ServletContainer

A servlet or filter for deploying root resource classes with Spring integration.

This class extends `ServletContainer` and initiates the `WebApplication` with a Spring-based `IoCComponentProviderFactory`, `SpringComponentProviderFactory`, such that instances of resource and provider classes declared and managed by Spring can be obtained.

Classes of Spring beans declared using XML-based configuration or auto-wire-based confguration 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 Spring-managed and Jersey-managed classes is required.

The servlet supports configuration of child applicationContexts, see `CONTEXT_CONFIG_LOCATION`.

Author:
  Martin Grotzke, Paul.Sandoz@Sun.Com, recht@dev.java.net
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class com.sun.jersey.spi.container.servlet.ServletContainer
`ServletContainer.ContextInjectableProvider<T>`

Field Summary
`static java.lang.String` | `CONTEXT_CONFIG_LOCATION` The context configuration location initialization parameter for declaring that a child context should be used for bean definitions.

Fields inherited from class com.sun.jersey.spi.container.servlet.ServletContainer
`APPLICATION_CONFIG_CLASS, 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 Summary
`SpringServlet()`

Method Summary
`protected org.springframework.context.ConfigurableApplicationContext` | `getChildContext(java.lang.String contextConfigLocation)` Get the child application context.
`protected org.springframework.context.ConfigurableApplicationContext` | `getContext()` Get the application context.
`protected org.springframework.context.ConfigurableApplicationContext` | `getDefaultContext()` Get the default application context.
`protected ResourceConfig` | `getDefaultResourceConfig(java.util.Map<java.lang.String,java.lang.Object> props, WebConfig webConfig)`
`protected void` | `initiate(ResourceConfig rc, WebApplication wa)`

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`

Field Detail

### CONTEXT_CONFIG_LOCATION

    public static final java.lang.String CONTEXT_CONFIG_LOCATION

  The context configuration location initialization parameter for declaring that a child context should be used for bean definitions. This feature can be used when configuration multiple Jersey/Spring servlets that contain different SPring-managed resources.

  The parameter name is the String "contextConfigLocation".

  A parameter value is a reference to one more spring configuration files separated by commas, semicolons or whitespace. distinct locations separated by commas, semicolons or whitespace

  If this parameter is absent then the default application context configuration is utilized.

  See Also:
    Constant Field Values

Constructor Detail

### SpringServlet

    public SpringServlet()

Method Detail

### getDefaultResourceConfig

    protected ResourceConfig getDefaultResourceConfig(java.util.Map<java.lang.String,java.lang.Object> props,
                                                      WebConfig webConfig)
                                               throws javax.servlet.ServletException

  Overrides:
    `getDefaultResourceConfig` in class `ServletContainer`
  Throws:
    `javax.servlet.ServletException`

### initiate

    protected void initiate(ResourceConfig rc,
                            WebApplication wa)

  Overrides:
    `initiate` in class `ServletContainer`

### getContext

    protected org.springframework.context.ConfigurableApplicationContext getContext()

  Get the application context.

  If the initialization parameter `CONTEXT_CONFIG_LOCATION` is present then this method will invoke `getChildContext(java.lang.String)` otherwise this method will invoke `getDefaultContext()`.

  Returns:
    the application context.

### getDefaultContext

    protected org.springframework.context.ConfigurableApplicationContext getDefaultContext()

  Get the default application context.

  The default application context will be looked up from the servlet context using `WebApplicationContextUtils.getRequiredWebApplicationContext(javax.servlet.ServletContext)`.

  Returns:
    the default application context.

### getChildContext

    protected org.springframework.context.ConfigurableApplicationContext getChildContext(java.lang.String contextConfigLocation)

  Get the child application context.

  The child application context is created as a child of the default application context obtained from `getDefaultContext()`.

  Parameters:
    `contextConfigLocation` - the location of the child application context.
  Returns:
    the child application context.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011 Oracle Corporation. All Rights Reserved.