jellyfish jellyfish - 8 days ago 6
HTTP Question

Jetty Server - how to handle a GET request with parameters?

This must be awfully simple, but I didn't find an answer.

Here is an easy example on how to listen to a get request with a jetty server.

However, it doesn't cover the case that it's not just a "http://www.foo.com/bar" request, but something like "http://www.foo.com/bar?name=guy&value=1".

So how do I get the parameters in jetty?

Answer

This is the API for ServletRequest. You should use:

request.getParameter("name");
request.getParameter("value");