title: Jetty: declare servlets in java in stead of web.xml when using maven
body: <p>Is it possible to use the embedded java code to add servlets:</p>
  
  <pre><code>Server server = new Server(8080);
  ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("/");
  server.setHandler(context);
  context.getInitParams().put("useFileMappedBuffer", "false");
  context.addServlet(new ServletHolder(new MyServlet()), "/myurl");
  ....
  server.start();
  server.join();
  </code></pre>
  
  <p>in stead of the lengthy web.xml way:</p>
  
  <pre><code>&lt;servlet&gt;
    &lt;servlet-name&gt;MyServlet&lt;/servlet-name&gt;
    &lt;servlet-class&gt;package.MyServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;MyServlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/myurl&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>I know this is posible in a non-maven project, but it seems the Maven Jetty plugin requires this web.xml method.</p>