Author: rickhall
Date: Thu Oct 25 20:50:29 2007
New Revision: 588499
URL: http://svn.apache.org/viewvc?rev=588499&view=rev
Log:
Added support for "/" bundle resources as requested in FELIX-383. Not
super useful, but...
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java?rev=588499&r1=588498&r2=588499&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
Thu Oct 25 20:50:29 2007
@@ -130,8 +130,15 @@
{
URL url = null;
- // Remove leading slash, if present.
- if (name.startsWith("/"))
+ // Remove leading slash, if present, but special case
+ // "/" so that it returns a root URL...this isn't very
+ // clean or meaninful, but the Spring guys want it.
+ if (name.equals("/"))
+ {
+ // Just pick a class path index since it doesn't really matter.
+ url = getURLPolicy().createURL(1, name);
+ }
+ else if (name.startsWith("/"))
{
name = name.substring(1);
}
@@ -154,22 +161,35 @@
{
Vector v = new Vector();
- // Remove leading slash, if present.
- if (name.startsWith("/"))
+ // Special case "/" so that it returns a root URLs for
+ // each bundle class path entry...this isn't very
+ // clean or meaninful, but the Spring guys want it.
+ if (name.equals("/"))
{
- name = name.substring(1);
+ for (int i = 0; i < getClassPath().length; i++)
+ {
+ v.addElement(getURLPolicy().createURL(i + 1, name));
+ }
}
-
- // Check the module class path.
- for (int i = 0; i < getClassPath().length; i++)
+ else
{
- if (getClassPath()[i].hasEntry(name))
+ // Remove leading slash, if present.
+ if (name.startsWith("/"))
{
- // Use the class path index + 1 for creating the path so
- // that we can differentiate between module content URLs
- // (where the path will start with 0) and module class
- // path URLs.
- v.addElement(getURLPolicy().createURL(i + 1, name));
+ name = name.substring(1);
+ }
+
+ // Check the module class path.
+ for (int i = 0; i < getClassPath().length; i++)
+ {
+ if (getClassPath()[i].hasEntry(name))
+ {
+ // Use the class path index + 1 for creating the path so
+ // that we can differentiate between module content URLs
+ // (where the path will start with 0) and module class
+ // path URLs.
+ v.addElement(getURLPolicy().createURL(i + 1, name));
+ }
}
}