jellyfish
jellyfish

Reputation: 7998

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?

Upvotes: 7

Views: 14239

Answers (3)

DaveH
DaveH

Reputation: 7335

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

Upvotes: 3

Sebastien Lorber
Sebastien Lorber

Reputation: 92210

This is the API for ServletRequest. You should use:

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

Upvotes: 14

kalyan
kalyan

Reputation: 3106

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

Upvotes: 6

Related Questions