3
的如果我們有以下有沒有一種方法,以追加到結束@Path
@Path("/basepath")
public class YourBaseResource {
@Path("a/b")
@GET
public Responce method1(){
return Response.ok("blah blah").build();
}
@Path("a/b/c")
@GET
public Response method2(){
UriBuilder addressBuilder = uriInfo.getBaseUriBuilder();
addressBuilder.path("a/b");
return Response.seeOther(addressBuilder.build()).build();
}
}
那麼代碼以下兩個網址將提供
/basepath/a/b
/basepath/a/b/c/
我的問題是,如果我想追加/ X的所有網址的結尾,使客戶端能夠訪問它們作爲
/basepath/a/b/x
/basepath/a/b/c/x
然後從寫作相隔月底/ X每個方法上每個@GET的每個@Path註釋是否有一種方法可以指定它:a)只需在父項中指定一次,或者b)以某種方式將/ x綁定到變量,然後在每個@GET的路徑末尾使用它?
我看過你的帖子,但無法弄清楚答案。 我已經編輯了一些問題,如果你可以請再看一遍。 – kk1957