Hello,
After a couple of exchanges with Jakub
Podlesak<
http://blogs.sun.com/enterprisetechtips/entry/consuming_restful_web_services_with#author>
on
the Twitter RESTfull example, he suggested I post my suggestion here ...
Basically, it consists of using pojos to build the path and it's content
instead of building from path and map.
A high level example would look like this:
/* this would build the resulting
/widget&id=[myid]&color=[mycolor]&type=[mytype] */
@Path("/widget&id={id}&color={color}&type={type}")
public class Widget{
protected String id;
protected String color;
protected String type;
public @PathParam("id") String getId() {
return this.id;
}
public void setId(String aId) {
this.id = aId;
}
public @PathParam("color") String getColor() {
return this.color;
}
public void setColor(String aColor) {
this.color = aColor;
}
public @PathParam("type") String getType() {
return this.type;
}
public void setType(String aType) {
this.type = aType;
}
}
public class WidgetClient {
...
public WidgetBean getWidget(String aId, String aColor, String aType) {
Widget w = new Widget();
w.setId(aId);
w.setColor(aColor);
w.setType(aType);
return
wr.accept(MediaType.APPLICATION_XML_TYPE).post(WidgetBean.class, w);
}
...
}
I was wondering if such mechanism could be implemented or was planned (or
maybe it does already exist and I am not aware of it ) because it would
greatly enrich and ease the use of the client API ...
Thank you for your time ...
Patrick S.