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

12,840

Solution 1

This is the API for ServletRequest. You should use:

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

Solution 2

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

Solution 3

You can use request.getParameter("name") and request.getParameter("value") in the doGet method of your servlet.

Share:
12,840
jellyfish
Author by

jellyfish

Far, far away from my 10.000 hours, but I'm always willing to learn! :-) Atm working with Google Android.

Updated on June 18, 2022

Comments

  • jellyfish
    jellyfish almost 2 years

    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?