Search in sources :

Example 1 with SessionCleanupFilter

use of org.nuxeo.ecm.webengine.jaxrs.session.SessionCleanupFilter in project nuxeo-filesystem-connectors by nuxeo.

the class WebDavServerFeature method setUpTomcat.

protected void setUpTomcat() throws Exception {
    tomcat = new Tomcat();
    // for tmp dir
    tomcat.setBaseDir(".");
    tomcat.setHostname(HOST);
    tomcat.setPort(PORT);
    ProtocolHandler p = tomcat.getConnector().getProtocolHandler();
    AbstractEndpoint<?> endpoint = (AbstractEndpoint<?>) getFieldValue(p, "endpoint");
    // vital for clean shutdown
    endpoint.setMaxKeepAliveRequests(1);
    File docBase = new File(".");
    Context context = tomcat.addContext(CONTEXT, docBase.getAbsolutePath());
    Application app = new org.nuxeo.ecm.webdav.Application();
    ApplicationAdapter conf = new ApplicationAdapter(app);
    conf.getFeatures().put(ResourceConfig.FEATURE_MATCH_MATRIX_PARAMS, Boolean.TRUE);
    String servletName = "testServlet";
    Servlet servlet = new ServletContainer(conf);
    tomcat.addServlet(CONTEXT, servletName, servlet);
    context.addServletMappingDecoded("/*", servletName);
    addFilter(context, servletName, "RequestContextFilter", new RequestContextFilter());
    addFilter(context, servletName, "SessionCleanupFilter", new SessionCleanupFilter());
    addFilter(context, servletName, "NuxeoAuthenticationFilter", new NuxeoAuthenticationFilter());
    addFilter(context, servletName, "WebEngineFilter", new WebEngineFilter());
    tomcat.start();
}
Also used : Context(org.apache.catalina.Context) AbstractEndpoint(org.apache.tomcat.util.net.AbstractEndpoint) Tomcat(org.apache.catalina.startup.Tomcat) RequestContextFilter(org.nuxeo.ecm.webengine.jaxrs.context.RequestContextFilter) SessionCleanupFilter(org.nuxeo.ecm.webengine.jaxrs.session.SessionCleanupFilter) WebEngineFilter(org.nuxeo.ecm.webengine.app.WebEngineFilter) ProtocolHandler(org.apache.coyote.ProtocolHandler) ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) Servlet(javax.servlet.Servlet) ApplicationAdapter(com.sun.jersey.api.core.ApplicationAdapter) NuxeoAuthenticationFilter(org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter) File(java.io.File) Application(javax.ws.rs.core.Application)

Aggregations

ApplicationAdapter (com.sun.jersey.api.core.ApplicationAdapter)1 ServletContainer (com.sun.jersey.spi.container.servlet.ServletContainer)1 File (java.io.File)1 Servlet (javax.servlet.Servlet)1 Application (javax.ws.rs.core.Application)1 Context (org.apache.catalina.Context)1 Tomcat (org.apache.catalina.startup.Tomcat)1 ProtocolHandler (org.apache.coyote.ProtocolHandler)1 AbstractEndpoint (org.apache.tomcat.util.net.AbstractEndpoint)1 NuxeoAuthenticationFilter (org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter)1 WebEngineFilter (org.nuxeo.ecm.webengine.app.WebEngineFilter)1 RequestContextFilter (org.nuxeo.ecm.webengine.jaxrs.context.RequestContextFilter)1 SessionCleanupFilter (org.nuxeo.ecm.webengine.jaxrs.session.SessionCleanupFilter)1