ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
context.setConnectorNames(new String[] {connector.getName()});
addJettyHandlers(server, handlers);
CamelServlet camelServlet;
boolean jetty = endpoint.getUseContinuation() != null ? endpoint.getUseContinuation() : isUseContinuation();
if (jetty) {
// use Jetty continuations
CamelContinuationServlet jettyServlet = new CamelContinuationServlet();
// configure timeout and log it so end user know what we are using
Long timeout = endpoint.getContinuationTimeout() != null ? endpoint.getContinuationTimeout() : getContinuationTimeout();
if (timeout != null) {
LOG.info("Using Jetty continuation timeout: " + timeout + " millis for: " + endpoint);
jettyServlet.setContinuationTimeout(timeout);
} else {
LOG.info("Using default Jetty continuation timeout for: " + endpoint);
}
// use the jetty servlet
camelServlet = jettyServlet;
} else {
// do not use jetty so use a plain servlet
camelServlet = new CamelServlet();
LOG.info("Jetty continuation is disabled for: " + endpoint);
}
ServletHolder holder = new ServletHolder();
holder.setServlet(camelServlet);
context.addServlet(holder, "/*");
// use rest enabled resolver in case we use rest
camelServlet.setServletResolveConsumerStrategy(new JettyRestServletResolveConsumerStrategy());
return camelServlet;
}