In the case of (server-side) Application
configuration, we can easily scan packages for JAX-RS resource classes with
ResourceConfig rCfg = new ResourceConfig();
rCfg.packages("com.my.package", ...);
and then initializing the application using the ResourceConfig
as the Application
object.
Using the client-side though, it is not clear how to perform package scanning.
We can do
Resource.from(SomeResourceClass.class);
to get resources if we know the class name. In my case we don't know the class names, and we'd like to get the classes based on their @Path
. If we knew all of the class names up front, we could use repeated calls to Resource.from()
to get all the resources, then index them by path, then lookup the paths as necessary.
But we don't know all the class names up front. Is there some way to get all of the Resource
in a particular package, or even better scan the entire classpath for them - all without initializing a (server-side) Application
?