use of org.eclipse.jetty.servlet.ServletHolder in project jetty.project by eclipse.
the class ChatServletTest method setUp.
@Before
public void setUp() throws Exception {
tester.setContextPath("/");
ServletHolder dispatch = tester.addServlet(ChatServlet.class, "/chat/*");
dispatch.setInitParameter("asyncTimeout", "500");
tester.start();
}
use of org.eclipse.jetty.servlet.ServletHolder in project elastic-job by dangdangdotcom.
the class RestfulServer method getServletHolder.
private ServletHolder getServletHolder(final String packages) {
ServletHolder result = new ServletHolder(ServletContainer.class);
result.setInitParameter(PackagesResourceConfig.PROPERTY_PACKAGES, Joiner.on(",").join(RestfulServer.class.getPackage().getName(), packages));
result.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", PackagesResourceConfig.class.getName());
result.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", Boolean.TRUE.toString());
result.setInitParameter("resteasy.scan.providers", Boolean.TRUE.toString());
result.setInitParameter("resteasy.use.builtin.providers", Boolean.FALSE.toString());
return result;
}
use of org.eclipse.jetty.servlet.ServletHolder in project jetty.project by eclipse.
the class MultiPartConfigAnnotationHandler method getServletHolderForClass.
private ServletHolder getServletHolderForClass(Class clazz) {
ServletHolder holder = null;
ServletHolder[] holders = _context.getServletHandler().getServlets();
if (holders != null) {
for (ServletHolder h : holders) {
if (h.getClassName() != null && h.getClassName().equals(clazz.getName())) {
holder = h;
}
}
}
return holder;
}
use of org.eclipse.jetty.servlet.ServletHolder in project jetty.project by eclipse.
the class WebSocketServer method main.
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
// Add the echo socket servlet to the /echo path map
context.addServlet(new ServletHolder(EchoServlet.class), "/echo");
server.start();
context.dumpStdErr();
server.join();
}
use of org.eclipse.jetty.servlet.ServletHolder in project jetty.project by eclipse.
the class JarServer method main.
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler();
Resource.setDefaultUseCaches(true);
Resource base = Resource.newResource("jar:file:src/main/resources/content.jar!/");
context.setBaseResource(base);
context.addServlet(new ServletHolder(new DefaultServlet()), "/");
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { context, new DefaultHandler() });
server.setHandler(handlers);
server.start();
server.join();
}
Aggregations