title: how to set connection/request timeout for jetty server?
body: <p>I'm running an embedded jetty server (jetty 6.1.24) inside my application like this:</p>
  
  <pre><code>    Handler handler=new AbstractHandler()
      {
          @Override
          public void handle(String target, HttpServletRequest request,
                  HttpServletResponse response, int dispatch)
                  throws IOException, ServletException {
                //this can take a long time
                doSomething();  
          }
      };
  
  
      Server server = new Server(8080);
      Connector connector = new org.mortbay.jetty.nio.SelectChannelConnector();      
      server.addConnector(connector);
  
      server.setHandler(handler);
      server.start();
  </code></pre>
  
  <p>I would like to set a timeout value (2 seconds) so that if handler.handle() method takes more than 2 seconds, jetty server will timeout and response to the client with 408 http code (request timeout). </p>
  
  <p>This is to guarantee that my application will not hold the client request for a long time and always response within 2 seconds.</p>
  
  <p>I did some research and tested it with "connector.setMaxIdleTime(2000);" but it doesn't work.</p>