com.noelios.restlet.ext.spring
Class SpringServerServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.noelios.restlet.ext.servlet.ServerServlet
com.noelios.restlet.ext.spring.SpringServerServlet
- All Implemented Interfaces:
- java.io.Serializable, Servlet, ServletConfig
public class SpringServerServlet
- extends ServerServlet
Spring specific ServerServlet adapter. This class is similar to the
ServerServlet, but instead of creating the used Restlet Application and
Restlet Component, it lookups them up from the SpringContext which is found
in the ServletContext.
If the Application or Component beans can't be found, the default behavior of
the parent class is used.
- Author:
- Florian Schwarz
- See Also:
- Serialized Form
Field Summary |
static java.lang.String |
APPLICATION_BEAN_PARAM_NAME
Name of the Servlet parameter containing a bean-id of the application to
use. |
static java.lang.String |
Component_BEAN_PARAM_NAME
Name of the Servlet parameter containing a bean-id of the component to
use. |
Methods inherited from class com.noelios.restlet.ext.servlet.ServerServlet |
createCall, createServer, createWarClient, destroy, getApplication, getComponent, getInitParameter, getServer, init, loadClass, service |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
APPLICATION_BEAN_PARAM_NAME
public static final java.lang.String APPLICATION_BEAN_PARAM_NAME
- Name of the Servlet parameter containing a bean-id of the application to
use.
- See Also:
- Constant Field Values
Component_BEAN_PARAM_NAME
public static final java.lang.String Component_BEAN_PARAM_NAME
- Name of the Servlet parameter containing a bean-id of the component to
use.
- See Also:
- Constant Field Values
SpringServerServlet
public SpringServerServlet()
createApplication
public Application createApplication(Context parentContext)
- Lookups the single Restlet Application used by this Servlet from the
SpringContext inside the ServletContext. The bean name looked up is
APPLICATION_BEAN_PARAM_NAME
.
- Overrides:
createApplication
in class ServerServlet
- Parameters:
parentContext
- The parent component context.
- Returns:
- The Restlet-Application to use.
createComponent
public Component createComponent()
- Lookups the single Restlet Component used by this Servlet from Spring's
Context available inside the ServletContext. The bean name looked up is
Component_BEAN_PARAM_NAME
.
- Overrides:
createComponent
in class ServerServlet
- Returns:
- The Restlet-Component to use.
getWebApplicationContext
public WebApplicationContext getWebApplicationContext()
- Get the Spring WebApplicationContext from the ServletContext. (by hand
would be webApplicationContext applicationContext =
(WebApplicationContext)
getServletContext().getAttribute(WebApplicationContext
.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);)
- Returns:
- The Spring WebApplicationContext.
Copyright © 2005-2008 Noelios Technologies.