假设我设置了以下 Jersey 资源:
@Path("/blah")
public class BlahResource {
@GET
@Path("/")
public String printRelativeUrlPath()
{
System.out.println("I want to print the relative path that lands us in this method");
System.out.println("For Ex: /do/1/then/2");
System.out.println("For Ex: /wait/3/then/4");
System.out.println("For Ex: /done/5/done/6");
}
}
我希望能够打印出到达此方法的相对 url 路径,例如:
- GET
http://somehost/blah/do/1/then/2
应该打印/do/1/then/2
- GET
http://somehost/blah/wait/3/then/4
应该打印/wait/3/then/4
- GET
http://somehost/blah/done/5/done/6
应该打印/done/5/done/6
使用泽西岛时如何获取此信息?