Class URLHandlersStreamHandlerProxy
- java.lang.Object
-
- java.net.URLStreamHandler
-
- org.apache.felix.framework.URLHandlersStreamHandlerProxy
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
,URLStreamHandlerSetter
public class URLHandlersStreamHandlerProxy extends java.net.URLStreamHandler implements URLStreamHandlerSetter, java.lang.reflect.InvocationHandler
This class implements a stream handler proxy. When the stream handler proxy instance is created, it is associated with a particular protocol and will answer all future requests for handling of that stream type. It does not directly handle the stream handler requests, but delegates the requests to an underlying stream handler service.
The proxy instance for a particular protocol is used for all framework instances that may contain their own stream handler services. When performing a stream handler operation, the proxy retrieves the handler service from the framework instance associated with the current call stack and delegates the call to the handler service.
The proxy will create simple stream handler service trackers for each framework instance. The trackers will listen to service events in its respective framework instance to maintain a reference to the "best" stream handler service at any given time.
-
-
Constructor Summary
Constructors Constructor Description URLHandlersStreamHandlerProxy(java.lang.String protocol, SecureAction action, java.net.URLStreamHandler builtIn, java.net.URL builtInURL)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
equals(java.net.URL url1, java.net.URL url2)
protected int
getDefaultPort()
protected java.net.InetAddress
getHostAddress(java.net.URL url)
protected int
hashCode(java.net.URL url)
protected boolean
hostsEqual(java.net.URL url1, java.net.URL url2)
java.lang.Object
invoke(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] params)
protected java.net.URLConnection
openConnection(java.net.URL url)
protected java.net.URLConnection
openConnection(java.net.URL url, java.net.Proxy proxy)
protected void
parseURL(java.net.URL url, java.lang.String spec, int start, int limit)
protected boolean
sameFile(java.net.URL url1, java.net.URL url2)
void
setURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String file, java.lang.String ref)
void
setURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String authority, java.lang.String userInfo, java.lang.String path, java.lang.String query, java.lang.String ref)
protected java.lang.String
toExternalForm(java.net.URL url)
-
-
-
Constructor Detail
-
URLHandlersStreamHandlerProxy
public URLHandlersStreamHandlerProxy(java.lang.String protocol, SecureAction action, java.net.URLStreamHandler builtIn, java.net.URL builtInURL)
-
-
Method Detail
-
equals
protected boolean equals(java.net.URL url1, java.net.URL url2)
- Overrides:
equals
in classjava.net.URLStreamHandler
-
getDefaultPort
protected int getDefaultPort()
- Overrides:
getDefaultPort
in classjava.net.URLStreamHandler
-
getHostAddress
protected java.net.InetAddress getHostAddress(java.net.URL url)
- Overrides:
getHostAddress
in classjava.net.URLStreamHandler
-
hashCode
protected int hashCode(java.net.URL url)
- Overrides:
hashCode
in classjava.net.URLStreamHandler
-
hostsEqual
protected boolean hostsEqual(java.net.URL url1, java.net.URL url2)
- Overrides:
hostsEqual
in classjava.net.URLStreamHandler
-
openConnection
protected java.net.URLConnection openConnection(java.net.URL url) throws java.io.IOException
- Specified by:
openConnection
in classjava.net.URLStreamHandler
- Throws:
java.io.IOException
-
openConnection
protected java.net.URLConnection openConnection(java.net.URL url, java.net.Proxy proxy) throws java.io.IOException
- Overrides:
openConnection
in classjava.net.URLStreamHandler
- Throws:
java.io.IOException
-
parseURL
protected void parseURL(java.net.URL url, java.lang.String spec, int start, int limit)
- Overrides:
parseURL
in classjava.net.URLStreamHandler
-
sameFile
protected boolean sameFile(java.net.URL url1, java.net.URL url2)
- Overrides:
sameFile
in classjava.net.URLStreamHandler
-
setURL
public void setURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String authority, java.lang.String userInfo, java.lang.String path, java.lang.String query, java.lang.String ref)
- Specified by:
setURL
in interfaceURLStreamHandlerSetter
- Overrides:
setURL
in classjava.net.URLStreamHandler
- See Also:
- "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
-
setURL
public void setURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String file, java.lang.String ref)
- Specified by:
setURL
in interfaceURLStreamHandlerSetter
- Overrides:
setURL
in classjava.net.URLStreamHandler
- See Also:
- "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"
-
toExternalForm
protected java.lang.String toExternalForm(java.net.URL url)
- Overrides:
toExternalForm
in classjava.net.URLStreamHandler
-
invoke
public java.lang.Object invoke(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] params) throws java.lang.Throwable
- Specified by:
invoke
in interfacejava.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
-
-