retrieving resources via class loader I first posted my question on the IO forum, but I now realize its more of a app server question.
Created May 8, 2012
Steve Pruitt The following code is from the ActionServlet-class from Struts , method
protected void parseModuleConfigFile(Digester digester, String path)
that loads /WEB-INF/struts-config.xml: (Variable path contains "/WEB-INF/struts-config.xml"
URL url = getServletContext().getResource(path); // If the config isn't in the servlet context, try the class loader // which allows the config files to be stored in a jar if (url == null) { url = getClass().getResource(path); } if (url == null) { String msg = internal.getMessage("configMissing", path); log.error(msg); throw new UnavailableException(msg); } InputSource is = new InputSource(url.toExternalForm()); input = url.openStream(); is.setByteStream(input); ...You now have an InputSream for the XML-file