0
TLDR:多Pathparameters和端点与扬鞭扬鞭,端点和Pathparameters
我想做些什么来为某些API端点这样的:
/foo/{id}/bar
现在据我所知foo
或第一个节点的路径正在定义端点以及资源到aqcuire。因此生成一个FooApiServiceImpl。
生成ProjectsApiService存根看起来像这样ATM:
@GET
@Path("/{id}/bars")
...
public Response getBarsByFooId(@ApiParam(value = "The id of the foo with the bars",required=true) @PathParam("id") String id)
throws NotFoundException {
return delegate.getBarByFooId(id);
}
现在我希望的行为将是让那些connectted到Foo
与给定{id}
所有Bar
资源。有点像相反的顺序。这是否有可能?
如果这是不可能的...那么还想问一下,我怎么能得到没有定义为{xxx}
参数在括号中的url节点(富,酒吧)?
事情是这样的:从它
@Context
private UriInfo uriInfo;
,然后调用UriInfo.getPathSegments()
:
public Response getBarsByFooId(String foo, String id, String bar)
throws NotFoundException {
return delegate.getBarByFooId(id);
}