如何获取根 @Path 的 PathSegment
How can I get PathSegment for the root @Path
使用以下资源 class、
@Path("/cities")
public class CitiesResource {
public Response read(
@PathParam("???") final PathSegment path) {
// ...
}
}
如何为根 @Path("/cities")
获取 PathSegment
?
您可以从 UriInfo.getPathSegments()
中获取所有 PathSegment
@GET
public String read(@Context UriInfo info) {
List<PathSegment> segments = info.getPathSegments();
}
使用以下资源 class、
@Path("/cities")
public class CitiesResource {
public Response read(
@PathParam("???") final PathSegment path) {
// ...
}
}
如何为根 @Path("/cities")
获取 PathSegment
?
您可以从 UriInfo.getPathSegments()
PathSegment
@GET
public String read(@Context UriInfo info) {
List<PathSegment> segments = info.getPathSegments();
}