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();
}
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();
}
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);
}
Aggregations