0
C'est ce que je suis en train de faire:Comment acheminer conditionnellement la requête JAX-RS, en fonction du suffixe?
@Path("/finder")
public class Finder {
@Path("/{name}")
public Proxy find(@PathParam("name") String name) {
Object found = /* some object found by name */
return new Proxy(found);
}
}
public class Proxy {
private Object obj;
public Proxy(Object found) {
this.obj = found;
}
@GET
@Path("/")
public String info() {
return /* some meta-information about the object */
}
@Path("/")
public Object passthru() {
return this.obj;
}
}
Je suis en train de permettre:
GET /finder/alpha -> Proxy.info()
GET /finder/alpha/something -> obj.something()
Vais-je le droit chemin? Pendant ce temps, Jersey dit:
WARNING: A sub-resource method, public final java.lang.String com.XXX.Proxy.info(),
with URI template, "/", is treated as a resource method