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?
get() method. Using the params property we can pass parameters to the HTTP get request. Either we can pass HttpParams or an object which contains key value pairs of parameters.
GET parameters (also called URL parameters or query strings) are used when a client, such as a browser, requests a particular resource from a web server using the HTTP protocol. These parameters are usually name-value pairs, separated by an equals sign = .
The Jetty Server is the plumbing between a collection of Connectors that accept HTTP connections, and a collection of Handlers that service requests from the connections and produce responses, with the work being done by threads taken from a thread pool.
This is the API for ServletRequest. You should use:
request.getParameter("name");
request.getParameter("value");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With