|
From: Chris S. <ch...@lo...> - 2003-05-04 12:57:47
|
Hi everyone, Juergen, I've just found a problem with the changes you made to XmlWebApplicationContext recently. When loading the bean config in getInputStreamForBeanFactory(), it delegates to the base class AbstractApplicationContext's getResourceAsStream() method. For a config location such as "/WEB-INF/test-servlet.xml", that method will try to load it using a URL, fail, catch the MalformedURLException, then see if the path is relative or absolute. If relative, it loads it using the overridden getResourceByRelativePath(). That all works fine on windows, but on unix, "/WEB-INF/test-servlet.xml" is considered an absolute path because it starts with a slash. The context fails to load because it tries to load it as a File rather than from the servlet context. The problem is that we can't tell whether a config location like "/WEB-INF/test-servlet.xml" is a path to a file or a resource in the servlet context. I couldn't find it in a brief flick through the servlet spec, but I didn't think servlets were allowed to access resources outside the servlet container. If that's the case, then XmlWebApplicationContext ought to override getResourceAsStream() with an implementation that always loads from the servlet context. Regards, Chris |