wood burning stoves 2.0*
The moose likes Web Services and the fly likes Accessing the GET parameters of a URL in a RESTful service using Apache CXF REST HTTP binding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Accessing the GET parameters of a URL in a RESTful service using Apache CXF REST HTTP binding" Watch "Accessing the GET parameters of a URL in a RESTful service using Apache CXF REST HTTP binding" New topic
Author

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

David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 107
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.


No matter what they say in Ohio, we're still first in flight!
David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 107
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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing the GET parameters of a URL in a RESTful service using Apache CXF REST HTTP binding
 
Similar Threads
How to return nicely?
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
indexed=true attribute in [html:text]