I'm trying to create an embedded jetty server with both a custom servlet that serves some dynamic data, and default servlet that will serve some images. I have the custom servlet working, but I can't figure out how to add a default servlet to serve the image files.
This is what I have...
private void setUpServer(ServerOptions options){
s = new Server(options.getPort());
this.options = options;
context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
s.setHandler(context);
context.addServlet(new ServletHolder(new DataServlet()), "/data/*");
context.addServlet(new ServletHolder(new DefaultServlet()), "/pictures/*");
}
I can't figure out how to configure the DefaultServlet to work as a file server and still have the custom DataServelet still work.
Does anyone have any ideas?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…