You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2017/12/07 23:27:16 UTC
svn commit: r1817441 -
/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java
Author: pauls
Date: Thu Dec 7 23:27:16 2017
New Revision: 1817441
URL: http://svn.apache.org/viewvc?rev=1817441&view=rev
Log:
FELIX-5759: map protocol instead of URLHandler to URL for builtin handlers to support handlers that handle more than one protocol.
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java?rev=1817441&r1=1817440&r2=1817441&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java Thu Dec 7 23:27:16 2017
@@ -24,9 +24,7 @@ import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -98,7 +96,7 @@ class URLHandlers implements URLStreamHa
private static final ConcurrentHashMap<String, ContentHandler> m_contentHandlerCache = new ConcurrentHashMap<String, ContentHandler>();
private static final ConcurrentHashMap<String, URLStreamHandler> m_streamHandlerCache = new ConcurrentHashMap<String, URLStreamHandler>();
- private static final ConcurrentHashMap<URLStreamHandler, URL> m_handlerToURL = new ConcurrentHashMap<URLStreamHandler, URL>();
+ private static final ConcurrentHashMap<String, URL> m_protocolToURL = new ConcurrentHashMap<String, URL>();
private static volatile URLStreamHandlerFactory m_streamHandlerFactory;
private static volatile ContentHandlerFactory m_contentHandlerFactory;
@@ -128,7 +126,7 @@ class URLHandlers implements URLStreamHa
if (handler != null)
{
URL url = new URL(protocol, null, -1, "", handler);
- addToCache(m_handlerToURL, handler, url);
+ addToCache(m_protocolToURL, protocol, url);
}
}
catch (Throwable ex)
@@ -287,7 +285,7 @@ class URLHandlers implements URLStreamHa
m_streamHandlerFactory.getClass().getName())))
{
m_sm = null;
- m_handlerToURL.clear();
+ m_protocolToURL.clear();
m_builtIn.clear();
}
}
@@ -489,7 +487,7 @@ class URLHandlers implements URLStreamHa
// If built-in content handler, then create a proxy handler.
return addToCache(m_streamHandlerCache, protocol,
new URLHandlersStreamHandlerProxy(protocol, m_secureAction,
- handler, getFromCache(m_handlerToURL,handler)));
+ handler, getFromCache(m_protocolToURL, protocol)));
}
/**