map protocol instead of URLHandler to URL for builtin handlers to support handlers that handle more than one protocol.
@@ -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 URLStreamHandlerFactory, ContentHandlerFactory
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 URLStreamHandlerFactory, ContentHandlerFactory
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 URLStreamHandlerFactory, ContentHandlerFactory
m_streamHandlerFactory.getClass().getName())))
{
m_sm = null;
- m_handlerToURL.clear();
+ m_protocolToURL.clear();
m_builtIn.clear();
}
}
@@ -489,7 +487,7 @@ class URLHandlers implements URLStreamHandlerFactory, ContentHandlerFactory
// 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)));
}
/**
