Class SlingServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- org.apache.sling.launchpad.webapp.SlingServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,Notifiable
public class SlingServlet extends javax.servlet.GenericServlet implements Notifiable
TheSlingServletis the externally visible Web Application launcher for Sling. Please refer to the full description The Sling Launchpad on the Sling Wiki for a full description of this class.Logging goes to ServletContext.log methods.
This class goes into the secondary artifact with the classifier webapp to be used as the main servlet to be registered in the servlet container.
- See Also:
- The Sling Launchpad, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SlingServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Stop the Sling framework when the web application is being stoppedStringgetServletInfo()voidinit()Launches the SLing framework if the sling.home setting can be derived from the configuration or the SerlvetContext.voidservice(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)If Sling has already been started, the request is forwarded to the started Sling framework.voidstopped()The framework has been stopped by calling theBundle.stop()on the system bundle.voidupdated(File updateFile)The framework has been stopped with the intent to be restarted by calling either of theBundle.updatemethods on the system bundle.
-
-
-
Method Detail
-
init
public void init()
Launches the SLing framework if the sling.home setting can be derived from the configuration or the SerlvetContext. Otherwise Sling is not started yet and will be started when the first request comes in.- Overrides:
initin classjavax.servlet.GenericServlet
-
getServletInfo
public String getServletInfo()
- Specified by:
getServletInfoin interfacejavax.servlet.Servlet- Overrides:
getServletInfoin classjavax.servlet.GenericServlet
-
service
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, IOExceptionIf Sling has already been started, the request is forwarded to the started Sling framework. Otherwise the Sling framework is started unless there were too many startup failures.If the request is not forwarded to Sling, this method returns a 404/NOT FOUND if the startup failure counter has exceeded or 503/SERVICE UNAVAILABLE if the Sling framework is starting up.
If a request causes the framework to start, it is immediately terminated with said response status and framework is started in a separate thread.
- Specified by:
servicein interfacejavax.servlet.Servlet- Specified by:
servicein classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletExceptionIOException
-
destroy
public void destroy()
Stop the Sling framework when the web application is being stopped- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classjavax.servlet.GenericServlet
-
stopped
public void stopped()
The framework has been stopped by calling theBundle.stop()on the system bundle. This actually terminates the Sling Standalone application.Note, that a new request coming in while the web application is still running, will actually cause Sling to restart !
- Specified by:
stoppedin interfaceNotifiable
-
updated
public void updated(File updateFile)
The framework has been stopped with the intent to be restarted by calling either of theBundle.updatemethods on the system bundle.If an
InputStreamwas provided, this has been copied to a temporary file, which will be used in place of the existing launcher jar file.- Specified by:
updatedin interfaceNotifiable- Parameters:
updateFile- The temporary file to replace the existing launcher jar file. Ifnullthe existing launcher jar will be used again.
-
-