title: Embedded Jetty 9: How to create a request to pass to RequestDispatcher from scratch?
body: <p>I am trying to create and feed requests from code (server initialization) to JSPs using Jetty 9.2. This is mainly for warmup/precompilation but also other reasons. I do not have an ongoing request (this is happening at startup) and I would like to avoid the workarounds that actually send requests using the network.</p>
  
  <p>Problem I face right now is that the following line (83) in Jetty's Dispatcher.java fails with a null pointer exception:</p>
  
  <pre><code>Request baseRequest=(request instanceof Request)?((Request)request):HttpChannel.getCurrentHttpChannel().getRequest();
  </code></pre>
  
  <p>So, how does one properly feed requests code-created requests into embedded Jetty? Pleas help.</p>