Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
David Brossard
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Brossard
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic