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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ApplicationHost
app
protected org.osgi.framework.Bundle
bundle
protected com.sun.jersey.spi.container.servlet.ServletContainer
container
protected boolean
isDirty
protected String
resourcesPrefix
-
Constructor Summary
Constructors Constructor Description ApplicationServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
containerService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected com.sun.jersey.spi.container.servlet.ServletContainer
createServletContainer(ApplicationHost app)
void
destroy()
protected void
destroyContainer()
protected void
destroyRendering()
protected void
doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
org.osgi.framework.Bundle
getBundle()
com.sun.jersey.spi.container.servlet.ServletContainer
getContainer()
RenderingEngine
getRenderingEngine()
File
getResourceFile(String key)
Get a file resource given a keyURL
getResourceURL(String key)
Gets an URL resource given a keyvoid
init(javax.servlet.ServletConfig config)
protected void
initContainer(javax.servlet.ServletConfig config)
protected RenderingEngine
initRendering(javax.servlet.ServletConfig config)
void
reload()
protected void
reloadContainer()
void
service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
void
setDescriptor(ServletDescriptor sd)
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
isDirty
protected volatile boolean isDirty
-
bundle
protected org.osgi.framework.Bundle bundle
-
app
protected ApplicationHost app
-
container
protected com.sun.jersey.spi.container.servlet.ServletContainer container
-
resourcesPrefix
protected String resourcesPrefix
-
-
Method Detail
-
setDescriptor
public void setDescriptor(ServletDescriptor sd)
- Specified by:
setDescriptor
in interfaceManagedServlet
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
- Specified by:
init
in interfacejavax.servlet.Servlet
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Servlet
- Overrides:
destroy
in classjavax.servlet.GenericServlet
-
reload
public void reload()
- Specified by:
reload
in interfaceReloadable
-
getRenderingEngine
public RenderingEngine 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:
service
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
containerService
protected void containerService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
- Throws:
javax.servlet.ServletException
IOException
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
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
public File getResourceFile(String key)
Description copied from interface:ResourceLocator
Get a file resource given a key- Specified by:
getResourceFile
in interfaceResourceLocator
-
getResourceURL
public URL getResourceURL(String key)
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
-
-