0
的GET響應觸發與以下URI我將如何配置REST URI向這個URI
/PathA/SomePathA以下
@Path("/PathA")
public class SubscriptionEntry
{
@Path("{PathA}")
public SomeType SomeMethod(@PathParam("parA") String userip)
{
//This is called!!! with /PathA/SomePathA
return new SomeResource(uriInfo,request,userip,httpreq);
}
}
其中SomeResource是這樣
public class SomeResource
{
@GET
public Type AnotherMethod
{
.....
.....
}
@Path({"What is suppose to be here???? since this class has no name??}")
public MyType MyMethod()
{....
}
}
我的問題是我該如何調整上面的類(路徑中需要什麼),這樣MyMethod就會觸發像uris一樣的觸發器,如
/PathA/SomePathA /測試
或
/PathA/SomePathA/SomePathB /測試
我試圖做類似以下,但它不工作
@Path("/Test")
public MyType MyMethod() {}
任何建議我怎麼能做這項工作或我失蹤?
你編碼什麼行不通:澤西島將掃描註釋只有一次,只定義一次映射URL <->方法。所以當方法被調用時,URL-to-method映射已經發生。您重新路由方法調用,但Jersey網址已被修復。 – 2012-04-13 07:12:53