Class ApplicationServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.nuxeo.ecm.webengine.rest.servlet.ApplicationServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
,ResourceLocator
,Reloadable
,ManagedServlet
- Direct Known Subclasses:
WebEngineServlet
public class ApplicationServlet
extends jakarta.servlet.http.HttpServlet
implements ManagedServlet, Reloadable, ResourceLocator
A hot re-loadable REST servlet. This servlet is building a Jersey REST Application.
Use it as the webengine servlet in web.xml if you want hot reload, otherwise directly use the Jersey servlet:
ServletContainer
.
- Author:
- Bogdan Stefanescu
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ApplicationHost
protected org.osgi.framework.Bundle
protected org.glassfish.jersey.servlet.ServletContainer
protected boolean
protected String
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
containerService
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected org.glassfish.jersey.servlet.ServletContainer
void
destroy()
protected void
protected void
protected void
doGet
(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) org.osgi.framework.Bundle
org.glassfish.jersey.servlet.ServletContainer
getResourceFile
(String key) Get a file resource given a keygetResourceURL
(String key) Gets an URL resource given a keyvoid
init
(jakarta.servlet.ServletConfig config) protected void
protected RenderingEngine
initRendering
(jakarta.servlet.ServletConfig config) void
reload()
protected void
void
service
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) void
Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
isDirty
protected volatile boolean isDirty -
bundle
protected org.osgi.framework.Bundle bundle -
app
-
container
protected org.glassfish.jersey.servlet.ServletContainer container -
resourcesPrefix
-
-
Constructor Details
-
ApplicationServlet
public ApplicationServlet()
-
-
Method Details
-
setDescriptor
- Specified by:
setDescriptor
in interfaceManagedServlet
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
init
in interfacejakarta.servlet.Servlet
- Overrides:
init
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Servlet
- Overrides:
destroy
in classjakarta.servlet.GenericServlet
-
reload
public void reload()- Specified by:
reload
in interfaceReloadable
-
getRenderingEngine
-
getBundle
public org.osgi.framework.Bundle getBundle() -
getContainer
public org.glassfish.jersey.servlet.ServletContainer getContainer() -
service
public void service(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException - Overrides:
service
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
IOException
-
containerService
protected void containerService(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException - Throws:
jakarta.servlet.ServletException
IOException
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doGet
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
IOException
-
initRendering
protected RenderingEngine initRendering(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Throws:
jakarta.servlet.ServletException
-
destroyRendering
protected void destroyRendering() -
initContainer
protected void initContainer() throws jakarta.servlet.ServletException- Throws:
jakarta.servlet.ServletException
-
destroyContainer
protected void destroyContainer() -
reloadContainer
protected void reloadContainer() throws jakarta.servlet.ServletException- Throws:
jakarta.servlet.ServletException
-
createServletContainer
-
getResourceFile
Description copied from interface:ResourceLocator
Get a file resource given a key- Specified by:
getResourceFile
in interfaceResourceLocator
-
getResourceURL
Description copied from interface:ResourceLocator
Gets an URL resource given a key- Specified by:
getResourceURL
in interfaceResourceLocator
- Parameters:
key
- the resource key- Returns:
- the resource URL or null if no such result was found
-