Trying to simplify the WS infrastructure, I'm playing with JAX-WS for implementing REStful WS. The client side is easy enough, but it seems that the server-side isn't widely explored (or at the least not publicly written about). In particular, I'm looking for a way to have a URL like
automatically routed to a method that's declared to handle the operation "doTheRestThing", and pass the parameters "ulf" and "42" to it. Mapping the operation is the easy part, but how are parameters handled? Does anyone have an example? Is this really as simple as it gets?
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
I did some playing around with the service end of REST. Rather than mapping the request to a method, I mapped the request to a class - using an XML configuration file. Each class had its own doGet( request, response ) so taking apart the parameters was delegated to the class.
After much wheel-spin with class loaders I got it to where I could add a new class to the configuration without restarting the server thus making the debug cycle much faster.
FYI: Currently wadl2java only supports client side stubs. So for interest sake I whipped together a WADL:
and generated the code
This resulted in four files: package-info.java, UserDetailsType.java, ObjectFactory.java and Endpoint.java package-info.java
UserDetailsType.java
ObjectFactory.java
Endpoint.java
I think things may become a bit clearer once wadl2java supports the generation of server-side skeletons - however the handling of the link elements in the WADL could prove interesting.
[ UD: added a few linebreaks to preserve the layout ] [ November 26, 2007: Message edited by: Ulf Dittmer ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.