When a forward is made using RequestDispatcher.forward(), Jetty merges parameters in existing request with parameters of forward (i.e. those that are specified in a query string of path used to obtain a RequestDispatcher).
If the same parameter is both in existing request and in forward path, both parameter instances remain in the query string after the forward.
Let's assume we have two servlets, one of them is SourceServlet, bound to /source context, another is TargetServlet, bound to /target context.
It forwards to TargetServlet using a query string 'name=forwardValue'.
After deploying webapp with these two servlets to Jetty and going to the following path:
we see the following in the output:
So, both values are in the resulting query string after the forward.
But the Servlet specification says:
"Parameters specified in the query string used to create the RequestDispatcher
take precedence over other parameters of the same name passed to the included
(servlet-2_4-fr-spec.pdf, page 64, section 'SRV.8.1.1 Query Strings in Request Dispatcher Paths')
So it seems that when parameter with the same name is encountered in initial request and in forward path, the latter should take precedence and the former should be eliminated.
When repeating steps described here in Tomcat, I see the following output:
I.e. in Tomcat parameter from forward path takes precedence.
What do you think about all this? Could this be a bug in Jetty?