|
From: Jason W. S. <jso...@co...> - 2006-07-17 00:20:43
|
Method getResourceByPath in FileSystemXmlApplicationContext strips leading "/" from paths before loading the resource (in this case the context file). The java docs explain this behavior as follows: "Note: Even if a given path starts with a slash, it will get interpreted as relative to the current VM working directory. This is consistent with the semantics in a Servlet container." Shouldn't servlet specific semantics be implemented by servlet specific classes? (Note that the WebApplicationContexts do not appear to extend FileSystemXmlApplicationContext [anymore?]). As a consequence of this behavior, Unix paths beginning with "/" become relative, but Windows paths beginning in "C:\" remain absolute. We have temporarily gotten around this by inserting an extra "/" in front of every path that we use to configure the FileSystemXmlApplicationContext, but this seems like a horrible hack. Thanks to Spring's wonderful design, we can easily create our own subclass that avoids this behavior, but shouldn't the servlet specific functionality be removed from this method altogether? Thanks, JWS |