aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 109
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: 109
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)
 
 
subject: Accessing the GET parameters of a URL in a RESTful service using Apache CXF REST HTTP binding