Details
-
Type:
New Feature
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 6.1.0rc1
-
Fix Version/s: 6.1.0rc2
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
This patch includes a new class ClassPathResource to find resources by 1) relative classpath 2) system classpath. This patch also includes additional JUnit tests
Matthew,
I think I have implemented this without the new class. I have simply added more static methods on Resource
in the same way as we have getSystemResource (which is pretty much the same). Is this good enough?
checked into head.
/* ------------------------------------------------------------ */
{ return newClassPathResource(resource,true,false); }/** Find a classpath resource.
*/
public static Resource newClassPathResource(String resource)
/* ------------------------------------------------------------ */
/** Find a classpath resource.
method is used to lookup the resource. If it is not
method is used.
is used.
this method does not check for normal resources.
*/
public static Resource newClassPathResource(String name,boolean useCaches,boolean checkParents)
{
URL url=Resource.class.getResource(name);
if (url==null)
{ url=Loader.getResource(Resource.class,name,checkParents); }{
try
catch(ClassNotFoundException e)
{ url=ClassLoader.getSystemResource(name); }}
if (url==null)
return null;
return newResource(url,useCaches);
}