On May 16, 2013, at 10:00 AM, Bill Burke <bburke_at_redhat.com> wrote:
> Does @Default on a @PathParam even make sense?
It's a good question. I suppose a method can be matched in different ways as follows:
@Path("widgets")
public class WidgetsResource {
@Path("{id}")
public WidgetResource findWidget(@PathParam("id") String id) {
return new WidgetResource(id);
}
}
@Path("boxed-widgets/{box}")
public class WidgetsBoxResource {
@Path("{id}")
public WidgetResource findWidget(@PathParam("id") String id) {
return new WidgetResource(id);
}
}
public class WidgetResource {
public WidgetResource(String id) {...}
@GET
public Widget getDetails(@Default("no-box") @PathParam("box") String box) {...}
}
and the URLs,
/widgets/25
/boxed-widgets/box1/25
Does that make sense?
-- Santiago