title: Restrict Servlet access based on request origin with Jetty 6
body: <p>I have a Jetty 6 server configured programmatically (no XML), which has several Servlets.
  I would like to restrict the access of one of those Servlet to requests coming from "localhost". </p>
  
  <p>Is there a pre-existing Jetty filter I can use for this? </p>
  
  <p>If no, how can I create my own filter to do this?</p>
  
  <p>Current code:</p>
  
  <pre><code>Server server = new Server(httpPort);
  Context ctx = new Context(server, "/");
  ctx.addServlet(new ServletHolder(someHttpServlet), "/servlet1/*");
  ctx.addServlet(new ServletHolder(someOtherHttpServlet), "/servlet2/*");
  ctx.addFilter(new FilterHolder(myFilterHere), "/servlet2/*", Context.ALL);
  </code></pre>