Search in sources :

Example 1 with EarClassLoader

use of org.glassfish.javaee.full.deployment.EarClassLoader in project Payara by payara.

the class HandlerChainHandler method getHandlerFileStream.

private InputStream getHandlerFileStream(AnnotationInfo annInfo, String relativePath, String handlerFile) {
    InputStream handlerFileStream = null;
    ClassLoader appCl = annInfo.getProcessingContext().getProcessingInput().getClassLoader();
    if (appCl instanceof EarClassLoader) {
        EarClassLoader earCl = (EarClassLoader) appCl;
        String moduleName = FileUtils.revertFriendlyFilenameExtension(annInfo.getProcessingContext().getArchive().getName());
        ClassLoader moduleCl = earCl.getModuleClassLoader(moduleName);
        handlerFileStream = moduleCl.getResourceAsStream(relativePath == null ? handlerFile : relativePath + "/" + handlerFile);
    }
    if (handlerFileStream == null) {
        handlerFileStream = appCl.getResourceAsStream(relativePath == null ? handlerFile : relativePath + "/" + handlerFile);
    }
    return handlerFileStream;
}
Also used : InputStream(java.io.InputStream) EarClassLoader(org.glassfish.javaee.full.deployment.EarClassLoader) EarClassLoader(org.glassfish.javaee.full.deployment.EarClassLoader)

Aggregations

InputStream (java.io.InputStream)1 EarClassLoader (org.glassfish.javaee.full.deployment.EarClassLoader)1