FELIX-382 ServletContext.getResource[AsStream] not working correctly
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@580478 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http.jetty/src/main/java/org/apache/felix/http/jetty/ServletContextGroup.java b/http.jetty/src/main/java/org/apache/felix/http/jetty/ServletContextGroup.java
index 260ec6a..069de1f 100644
--- a/http.jetty/src/main/java/org/apache/felix/http/jetty/ServletContextGroup.java
+++ b/http.jetty/src/main/java/org/apache/felix/http/jetty/ServletContextGroup.java
@@ -15,8 +15,8 @@
package org.apache.felix.http.jetty;
+import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.Dictionary;
import java.util.Enumeration;
@@ -178,7 +178,34 @@
public String getRealPath( String path )
{
- return m_hdlr.getServletContext().getRealPath( path );
+ // resources are contained in the bundle and thus are not
+ // available as normal files in the platform filesystem
+ return null;
+ }
+
+
+ public URL getResource( String path )
+ {
+ return m_osgiHttpContext.getResource( path );
+ }
+
+
+ public InputStream getResourceAsStream( String path )
+ {
+ URL res = getResource( path );
+ if ( res != null )
+ {
+ try
+ {
+ return res.openStream();
+ }
+ catch ( IOException ignore )
+ {
+ // might want to log, but actually don't care here
+ }
+ }
+
+ return null;
}
@@ -188,18 +215,6 @@
}
- public URL getResource( String path ) throws MalformedURLException
- {
- return m_hdlr.getServletContext().getResource( path );
- }
-
-
- public InputStream getResourceAsStream( String path )
- {
- return m_hdlr.getServletContext().getResourceAsStream( path );
- }
-
-
public String getServerInfo()
{
return m_hdlr.getServletContext().getServerInfo();