Forums Register Login

Accessing the GET parameters of a URL in a RESTful service using Apache CXF REST HTTP binding

+Pie Number of slices to send: Send
Hi,

I am using the example provided in Apache CXF 2.3.3 whereby a service interface and implementation are defined to have the following method:



I was wondering how I could access the get parameters that might be sent in the implementation of the method? Is there a standardized, clean way, of doing it?

Example GET request URL could be: http://localhost:8080/customers/123?color=blue&size=M

where 123 is the customer id and color as well as size are the get parameters.

In addition, I do not understand how the GetCustomer object gets constructed...

Any help would be welcome.

Cheers,
David.
+Pie Number of slices to send: Send
Here is a solution, but is it the way to go? It almost feels like I am breaking some REST principle here...


In the implementation, write:



In my case, the type of the object is in fact org.eclipse.jetty.server.Request since I use Jetty. A bit of googling shows that (of course) org.eclipse.jetty.server.Request implements javax.servlet.http.HttpServletRequest (http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/Request.html)
He does not suffer fools gladly. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 6250 times.
Similar Threads
How to return nicely?
indexed=true attribute in [html:text]
How to submit JSON data as request body in Apache CXF jax-rs (REST)
Response xml in Apache CXF using JAX-RS
contract first web service
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:23:45.