Class ApplicationServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.nuxeo.ecm.webengine.jaxrs.servlet.ApplicationServlet
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,ResourceLocator,Reloadable,ManagedServlet
- Direct Known Subclasses:
WebEngineServlet
public class ApplicationServlet
extends javax.servlet.http.HttpServlet
implements ManagedServlet, Reloadable, ResourceLocator
A hot re-loadable JAX-RS servlet. This servlet is building a Jersey JAX-RS Application. If you need to support other
JAX-RS containers than Jersey you need to write your own servlet.
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 ApplicationHostprotected org.osgi.framework.Bundleprotected com.sun.jersey.spi.container.servlet.ServletContainerprotected booleanprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcontainerService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) protected com.sun.jersey.spi.container.servlet.ServletContainervoiddestroy()protected voidprotected voidprotected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) org.osgi.framework.Bundlecom.sun.jersey.spi.container.servlet.ServletContainergetResourceFile(String key) Get a file resource given a keygetResourceURL(String key) Gets an URL resource given a keyvoidinit(javax.servlet.ServletConfig config) protected voidinitContainer(javax.servlet.ServletConfig config) protected RenderingEngineinitRendering(javax.servlet.ServletConfig config) voidreload()protected voidvoidservice(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) voidMethods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.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 com.sun.jersey.spi.container.servlet.ServletContainer container -
resourcesPrefix
-
-
Constructor Details
-
ApplicationServlet
public ApplicationServlet()
-
-
Method Details
-
setDescriptor
- Specified by:
setDescriptorin interfaceManagedServlet
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException - Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classjavax.servlet.GenericServlet
-
reload
public void reload()- Specified by:
reloadin interfaceReloadable
-
getRenderingEngine
-
getBundle
public org.osgi.framework.Bundle getBundle() -
getContainer
public com.sun.jersey.spi.container.servlet.ServletContainer getContainer() -
service
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException - Overrides:
servicein classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
containerService
protected void containerService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException - Throws:
javax.servlet.ServletExceptionIOException
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException - Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
initRendering
protected RenderingEngine initRendering(javax.servlet.ServletConfig config) throws javax.servlet.ServletException - Throws:
javax.servlet.ServletException
-
destroyRendering
protected void destroyRendering() -
initContainer
protected void initContainer(javax.servlet.ServletConfig config) throws javax.servlet.ServletException - Throws:
javax.servlet.ServletException
-
destroyContainer
protected void destroyContainer() -
reloadContainer
protected void reloadContainer() throws javax.servlet.ServletException- Throws:
javax.servlet.ServletException
-
createServletContainer
protected com.sun.jersey.spi.container.servlet.ServletContainer createServletContainer(ApplicationHost app) -
getResourceFile
Description copied from interface:ResourceLocatorGet a file resource given a key- Specified by:
getResourceFilein interfaceResourceLocator
-
getResourceURL
Description copied from interface:ResourceLocatorGets an URL resource given a key- Specified by:
getResourceURLin interfaceResourceLocator- Parameters:
key- the resource key- Returns:
- the resource URL or null if no such result was found
-