Class SpringServerServlet

  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.Servlet, javax.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

      Fields 
      Modifier and Type Field Description
      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.
    • 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 org.restlet.Application createApplication​(org.restlet.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 org.restlet.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 org.springframework.web.context.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.