在JSF2中显示清单属性

Jan*_*Jan 2 java jsf

JSF2.0应用程序中访问Manifest属性(从/META-INF/Manifest.mf)的最佳方法是什么?

Jan*_*Jan 5

相对于上述麦克道威尔的建议,改进之处在于init()

@PostConstruct
public void init() {
    try {
        InputStream is = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/META-INF/MANIFEST.MF");
        manifest = new Manifest();
        manifest.read(is);
    } catch (IOException ioe) {
        logger.error("Unable to read the Manifest file from classpath.", ioe);
    }
}
Run Code Online (Sandbox Code Playgroud)