Class SlingServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
,Notifiable
SlingServlet
is 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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Stop the Sling framework when the web application is being stoppedvoid
init()
Launches the SLing framework if the sling.home setting can be derived from the configuration or the SerlvetContext.void
service
(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res) If Sling has already been started, the request is forwarded to the started Sling framework.void
stopped()
The framework has been stopped by calling theBundle.stop()
on the system bundle.void
The framework has been stopped with the intent to be restarted by calling either of theBundle.update
methods on the system bundle.Methods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
-
Constructor Details
-
SlingServlet
public SlingServlet()
-
-
Method Details
-
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:
init
in classjakarta.servlet.GenericServlet
-
getServletInfo
- Specified by:
getServletInfo
in interfacejakarta.servlet.Servlet
- Overrides:
getServletInfo
in classjakarta.servlet.GenericServlet
-
service
public void service(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res) throws jakarta.servlet.ServletException, IOException If 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:
service
in interfacejakarta.servlet.Servlet
- Specified by:
service
in classjakarta.servlet.GenericServlet
- Throws:
jakarta.servlet.ServletException
IOException
-
destroy
public void destroy()Stop the Sling framework when the web application is being stopped- Specified by:
destroy
in interfacejakarta.servlet.Servlet
- Overrides:
destroy
in classjakarta.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:
stopped
in interfaceNotifiable
-
updated
The framework has been stopped with the intent to be restarted by calling either of theBundle.update
methods on the system bundle.If an
InputStream
was provided, this has been copied to a temporary file, which will be used in place of the existing launcher jar file.- Specified by:
updated
in interfaceNotifiable
- Parameters:
updateFile
- The temporary file to replace the existing launcher jar file. Ifnull
the existing launcher jar will be used again.
-