com.noelios.restlet.ext.spring
Class SpringServerServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.noelios.restlet.ext.servlet.ServerServlet
              extended by 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.
 
Constructor Summary
SpringServerServlet()
           
 
Method Summary
 Application createApplication(Context parentContext)
          Lookups the single Restlet Application used by this Servlet from the SpringContext inside the ServletContext.
 Component createComponent()
          Lookups the single Restlet Component used by this Servlet from Spring's Context available inside the ServletContext.
 WebApplicationContext getWebApplicationContext()
          Get the Spring WebApplicationContext from the ServletContext.
 
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 javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, 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

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
Constructor Detail

SpringServerServlet

public SpringServerServlet()
Method Detail

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.