Search in sources :

Example 1 with AbstractEndpoint

use of org.apache.tomcat.util.net.AbstractEndpoint 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)

Example 2 with AbstractEndpoint

use of org.apache.tomcat.util.net.AbstractEndpoint in project tomcat70 by apache.

the class InternalNioInputBuffer method init.

// ------------------------------------------------------ Protected Methods
@Override
protected void init(SocketWrapper<NioChannel> socketWrapper, AbstractEndpoint<NioChannel> endpoint) throws IOException {
    socket = socketWrapper.getSocket();
    socketReadBufferSize = socket.getBufHandler().getReadBuffer().capacity();
    int bufLength = headerBufferSize + socketReadBufferSize;
    if (buf == null || buf.length < bufLength) {
        buf = new byte[bufLength];
    }
    pool = ((NioEndpoint) endpoint).getSelectorPool();
}
Also used : NioEndpoint(org.apache.tomcat.util.net.NioEndpoint) AbstractEndpoint(org.apache.tomcat.util.net.AbstractEndpoint)

Example 3 with AbstractEndpoint

use of org.apache.tomcat.util.net.AbstractEndpoint in project spring-boot by spring-projects.

the class ServerPropertiesTests method tomcatMaxKeepAliveRequestsDefault.

@Test
void tomcatMaxKeepAliveRequestsDefault() throws Exception {
    AbstractEndpoint<?, ?> endpoint = (AbstractEndpoint<?, ?>) ReflectionTestUtils.getField(getDefaultProtocol(), "endpoint");
    int defaultMaxKeepAliveRequests = (int) ReflectionTestUtils.getField(endpoint, "maxKeepAliveRequests");
    assertThat(this.properties.getTomcat().getMaxKeepAliveRequests()).isEqualTo(defaultMaxKeepAliveRequests);
}
Also used : AbstractEndpoint(org.apache.tomcat.util.net.AbstractEndpoint) AbstractEndpoint(org.apache.tomcat.util.net.AbstractEndpoint) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractEndpoint (org.apache.tomcat.util.net.AbstractEndpoint)3 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 NioEndpoint (org.apache.tomcat.util.net.NioEndpoint)1 Test (org.junit.jupiter.api.Test)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