Search in sources :

Example 1 with AppClassLoader

use of org.glassfish.jersey.examples.reload.compiler.AppClassLoader in project jersey by jersey.

the class App method createResourceConfig.

private static ResourceConfig createResourceConfig(File configFile) {
    final ResourceConfig rc = new ResourceConfig();
    try {
        final AppClassLoader appClassLoader = new AppClassLoader(Thread.currentThread().getContextClassLoader());
        final List<JavaFile> javaFiles = getJavaFiles(configFile);
        Compiler.compile(appClassLoader, javaFiles);
        for (JavaFile javaFile : javaFiles) {
            try {
                rc.registerClasses(appClassLoader.loadClass(javaFile.getClassName()));
            } catch (final ClassNotFoundException ex) {
                LOGGER.info(String.format(" ! class %s not found.\n", javaFile.getClassName()));
            }
        }
    } catch (final Exception ex) {
        Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rc;
}
Also used : AppClassLoader(org.glassfish.jersey.examples.reload.compiler.AppClassLoader) JavaFile(org.glassfish.jersey.examples.reload.compiler.JavaFile) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 AppClassLoader (org.glassfish.jersey.examples.reload.compiler.AppClassLoader)1 JavaFile (org.glassfish.jersey.examples.reload.compiler.JavaFile)1 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)1