Learner
Learner

Reputation: 1313

Embedded Jetty 9: How to create a request to pass to RequestDispatcher from scratch?

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.

Problem I face right now is that the following line (83) in Jetty's Dispatcher.java fails with a null pointer exception:

Request baseRequest=(request instanceof Request)?((Request)request):HttpChannel.getCurrentHttpChannel().getRequest();

So, how does one properly feed requests code-created requests into embedded Jetty? Pleas help.

Upvotes: 0

Views: 220

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49515

Dispatcher requires a valid request.

As the dispatched call requires a bunch of information from the Request (such as method, headers, content encodings, what sort of response encodings are valid, uri, context path, sessions, cookies, security contexts, principals, etc. the list is long)

Upvotes: 0

Related Questions