I created an eclipse maven project and added jetty dependency. Next I made a simple servlet and a class that starts the jetty server. Here is what i got so far:
package com.example.jetty;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
public class App {
public static void main(String[] args) throws Exception {
Server server = new Server(80);
ServletContextHandler servletContext = new ServletContextHandler(server, "/");
servletContext.addServlet(MyServlet.class, "/");
server.start();
}
}
My problem is that most tutorials I see have a web.xml to configure servlets and such. I can't find programmatic ways to do the some of these. Can I create a web.xml and still start my jetty programatically and somehow use that web.xml for configuration?
To be more specific i need to write true in web.xml. I did not find any way to do it programatically.