public class SlingServletDelegate extends javax.servlet.GenericServlet implements Launcher
SlingServletDelegate serves as a basic servlet for Project Sling.
 The tasks of this servlet are as follows:
 init() method launches Apache Felix as the
 OSGi framework implementation we use.
 javax.servlet.Servlet.
 javax.servlet.Servlet. If no delegatee servlet has been
 registered request handlings results in a temporary unavailability of the
 servlet.
 Request Handling
 This servlet handles request by forwarding to a delegatee servlet. The
 delegatee servlet is automatically retrieved from the service registry by the
 getDelegatee(). This method also makes sure, the such a servlet
 actually exits by throwing an UnvailableException if not and
 also makes sure the servlet is initialized.
 
Launch Configuration
 The Apache Felix framework requires configuration parameters
 to be specified for startup. This servlet builds the list of parameters from
 three locations:
 
sling.properties is read
 from the servlet class path. This properties file contains default settings.loadConfigProperties(String) method.
 
 After loading all properties, variable substitution takes place on the
 property values. A variable is indicated as ${<prop-name>}
 where <prop-name> is the name of a system or
 configuration property (configuration properties override system properties).
 Variables may be nested and are resolved from inner-most to outer-most. For
 example, the property value ${outer-${inner}} is resolved by
 first resolving ${inner} and then resolving the property whose
 name is the catenation of outer- and the result of resolving
 ${inner}.
 
Logging
 This servlet logs through the servlet container logging mechanism by calling
 the GenericServlet.log methods. Bundles launched within the
 framework provided by this servlet may use whatever logging mechanism they
 choose to use. The Commons OSGI Log Bundle provides an OSGi Log Service
 implementation, which also provides access to Apache Commons Logging, SLF4J
 and Log4J logging. It is recommended that this bundle is used to setup and
 configure logging for systems based on this servlet.
| Constructor and Description | 
|---|
| SlingServletDelegate() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | destroy()Destroys this servlet by shutting down the OSGi framework and hence the
 delegatee servlet if one is set at all. | 
| void | init()Initializes this servlet by loading the framework configuration
 properties, starting the OSGi framework (Apache Felix) and exposing the
 system bundle context and the  Felixinstance as servlet
 context attributes. | 
| void | service(javax.servlet.ServletRequest req,
       javax.servlet.ServletResponse res)Services the request by delegating to the delegatee servlet. | 
| void | setCommandLine(java.util.Map<java.lang.String,java.lang.String> args)The commandline provided from the standalone launch case. | 
| void | setNotifiable(Notifiable notifiable)The  Notifiableto notify on framework stop or update | 
| void | setSlingHome(java.lang.String slingHome)Sets the sling.home to be used for starting the framework. | 
| boolean | start()Starts the framework and returns  trueif successfull. | 
| void | stop()Stops the framework. | 
public void setNotifiable(Notifiable notifiable)
LauncherNotifiable to notify on framework stop or updatesetNotifiable in interface Launcherpublic void setCommandLine(java.util.Map<java.lang.String,java.lang.String> args)
LaunchersetCommandLine in interface Launcherpublic void setSlingHome(java.lang.String slingHome)
Launchernull argument before trying to
 start the framework.setSlingHome in interface Launcherpublic boolean start()
Launchertrue if successfull.public void stop()
Launcherpublic final void init()
                throws javax.servlet.ServletException
Felix instance as servlet
 context attributes.init in class javax.servlet.GenericServletjavax.servlet.ServletException - if the framework cannot be initialized.public final void service(javax.servlet.ServletRequest req,
                          javax.servlet.ServletResponse res)
                   throws javax.servlet.ServletException,
                          java.io.IOException
UnavailableException is
 thrown.service in interface javax.servlet.Servletservice in class javax.servlet.GenericServletreq - the ServletRequest object that contains the
            client's requestres - the ServletResponse object that will contain
            the servlet's responsejavax.servlet.UnavailableException - if the no delegatee servlet is currently
             availablejavax.servlet.ServletException - if an exception occurs that interferes with the
             servlet's normal operation occurredjava.io.IOException - if an input or output exception occurspublic final void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServletCopyright © 2018 The Apache Software Foundation. All rights reserved.