【发布时间】:2017-04-27 15:45:25
【问题描述】:
我需要从路径(“/api/webservice/cursos/sugeridos/java-para-desenvolvimento-web”)获取(“/api/webservice/cursos/”)。
我有课:
@Path("/webservice/cursos")
public class Resource {
@GET
@Path("/sugeridos/{uri: [\\w+\\-]*}")
.........
public Response getCourseByURI(@PathParam("uri") String uri, @Context UriInfo uriInfo) {
String baseUrl = uriInfo.getAbsolutePath().getPath();
}
}
uriInfo.getAbsolutePath().getPath() 返回:
"/api/webservice/cursos/sugeridos/java-para-desenvolvimento-web"
我只需要:
"/api/webservice/cursos/"
【问题讨论】:
标签: java web-services url path uri