Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2007-02-16 06:02:23 +0000
committerSimon Kaegi2007-02-16 06:02:23 +0000
commitde58e7affdf9bcf7cbf232eb3b68fcdc46bbf701 (patch)
tree5bcd4490c5a681280165456cfd69ddc9b0e0c2bd /bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http
parentb01a909be007ebcf6f6344428b673469e79207c4 (diff)
downloadrt.equinox.bundles-de58e7affdf9bcf7cbf232eb3b68fcdc46bbf701.tar.gz
rt.equinox.bundles-de58e7affdf9bcf7cbf232eb3b68fcdc46bbf701.tar.xz
rt.equinox.bundles-de58e7affdf9bcf7cbf232eb3b68fcdc46bbf701.zip
correcting use of findEntries to parse separate path and file name from an incoming resource name.v20070219
Diffstat (limited to 'bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http')
-rw-r--r--bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java
index 3ba2c65e6..57b77cf8b 100644
--- a/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java
+++ b/bundles/org.eclipse.equinox.http.registry/src/org/eclipse/equinox/http/registry/internal/HttpContextManager.java
@@ -153,11 +153,18 @@ public class HttpContextManager implements Listener {
}
public URL getResource(String resourceName) {
- Enumeration entryPaths;
- if (bundlePath == null)
- entryPaths = bundle.findEntries(resourceName, null, false);
- else
- entryPaths = bundle.findEntries(bundlePath + resourceName, null, false);
+ if (bundlePath != null)
+ resourceName = bundlePath + resourceName;
+
+ int lastSlash = resourceName.lastIndexOf('/');
+ if (lastSlash == -1)
+ return null;
+
+ String path = resourceName.substring(0, lastSlash);
+ if (path.length() == 0)
+ path = "/"; //$NON-NLS-1$
+ String file = resourceName.substring(lastSlash + 1);
+ Enumeration entryPaths = bundle.findEntries(path, file, false);
if (entryPaths != null && entryPaths.hasMoreElements())
return (URL) entryPaths.nextElement();
@@ -166,12 +173,10 @@ public class HttpContextManager implements Listener {
}
public Set getResourcePaths(String path) {
- Enumeration entryPaths;
- if (bundlePath == null)
- entryPaths = bundle.findEntries(path, null, false);
- else
- entryPaths = bundle.findEntries(path, null, false);
+ if (bundlePath != null)
+ path = bundlePath + path;
+ Enumeration entryPaths = bundle.findEntries(path, null, false);
if (entryPaths == null)
return null;

Back to the top