Class URLHandlersStreamHandlerProxy
- All Implemented Interfaces:
InvocationHandler
,URLStreamHandlerSetter
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
ConstructorsConstructorDescriptionURLHandlersStreamHandlerProxy
(String protocol, SecureAction action, URLStreamHandler builtIn, URL builtInURL) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected int
protected InetAddress
getHostAddress
(URL url) protected int
protected boolean
hostsEqual
(URL url1, URL url2) protected URLConnection
openConnection
(URL url) protected URLConnection
openConnection
(URL url, Proxy proxy) protected void
protected boolean
void
void
setURL
(URL url, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref) protected String
toExternalForm
(URL url)
-
Constructor Details
-
URLHandlersStreamHandlerProxy
public URLHandlersStreamHandlerProxy(String protocol, SecureAction action, URLStreamHandler builtIn, URL builtInURL)
-
-
Method Details
-
equals
- Overrides:
equals
in classURLStreamHandler
-
getDefaultPort
protected int getDefaultPort()- Overrides:
getDefaultPort
in classURLStreamHandler
-
getHostAddress
- Overrides:
getHostAddress
in classURLStreamHandler
-
hashCode
- Overrides:
hashCode
in classURLStreamHandler
-
hostsEqual
- Overrides:
hostsEqual
in classURLStreamHandler
-
openConnection
- Specified by:
openConnection
in classURLStreamHandler
- Throws:
IOException
-
openConnection
- Overrides:
openConnection
in classURLStreamHandler
- Throws:
IOException
-
parseURL
- Overrides:
parseURL
in classURLStreamHandler
-
sameFile
- Overrides:
sameFile
in classURLStreamHandler
-
setURL
public void setURL(URL url, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref) - Specified by:
setURL
in interfaceURLStreamHandlerSetter
- Overrides:
setURL
in classURLStreamHandler
- See Also:
-
setURL
- Specified by:
setURL
in interfaceURLStreamHandlerSetter
- Overrides:
setURL
in classURLStreamHandler
- See Also:
-
toExternalForm
- Overrides:
toExternalForm
in classURLStreamHandler
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-