use of org.glassfish.jersey.internal.ServiceFinder in project jersey by jersey.
the class ServiceFinderTest method createServiceFinder.
private ServiceFinder<?> createServiceFinder(final ClassLoader cl, final String serviceName) throws IOException {
final ClassLoader ocl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(cl);
try {
final Class<?> prc = cl.loadClass("org.glassfish.jersey.internal.ServiceFinder");
final Method m = prc.getMethod("find", String.class);
return (ServiceFinder<?>) m.invoke(null, serviceName);
// return new PackagesResourceConfig(packages);
} catch (final Exception e) {
throw new RuntimeException(e);
} finally {
Thread.currentThread().setContextClassLoader(ocl);
}
}
Aggregations