作者:夜沙 | 来源:互联网 | 2023-02-04 21:41
DoesJerseyprovideanywaytolistalloftheresourcesitexposes?Thatis,giventheresourcecla
Does Jersey provide any way to list all of the resources it exposes? That is, given the resource class:
泽西岛是否提供任何方式来列出它所暴露的所有资源?也就是说,给定资源类:
package com.zoo.resource
@Path("/animals")
public class AnimalResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("dog")
public Dog getDog(){
...
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("cat")
public Cat getCat(){
...
}
}
Does Jersey provide any way for me to get the information:
泽西岛是否为我提供了获取信息的方式:
(And furthermore, does it provide a way for me to know that AnimalResource is a resource?)
(此外,它是否为我提供了一种了解AnimalResource是资源的方法?)
I would like to have this information available to me in a unit test so that I can check that every resource I expose conforms to what an external system expects. I know that there is automagic that exposes the application.wadl, but I don't see that showing me return types and I don't know how to access it from within my tests.
我希望在单元测试中可以获得这些信息,以便我可以检查我公开的每个资源是否符合外部系统的预期。我知道有一些自动化暴露了application.wadl,但是我没有看到向我显示返回类型,我不知道如何从我的测试中访问它。
1 个解决方案