我有一个过滤器,我想在过滤器中获取api名称。 我怎么才能得到它。因此,在TestFilter中,我想要方法名称,即getUsers。
@Path("v1/path")
@Consumes({ APPLICATION_JSON })
@Produces({ APPLICATION_JSON })
public interface RestController {
@Path("/users")
@Get
@Produces({ APPLICATION_JSON })
public Response getUsers(@PathParam("User-Id") String userId);
}
public class RestImpl implements RestController{
@Override
public Response getUsers(String userId){
// some logic to fetch users details
}
}
public class TestFilter implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext,ContainerResponseContext responseContext){
// here I want to fetch the method name - getUsers
}
}