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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Methodprivate static final Methodprivate static final Methodprivate static final Methodprivate static final Methodprivate final SecureActionprivate final URLStreamHandlerprivate final URLprivate static final ThreadLocalprivate final Stringprivate final Objectprivate static final Methodprivate static final Methodprivate static final Methodprivate static final Class[]private static final Methodprivate static final Class[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateURLHandlersStreamHandlerProxy(Object service, SecureAction action) URLHandlersStreamHandlerProxy(String protocol, SecureAction action, URLStreamHandler builtIn, URL builtInURL) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected intprotected InetAddressgetHostAddress(URL url) private ObjectPrivate method to retrieve the stream handler service from the framework instance associated with the current call stack.protected intprotected booleanhostsEqual(URL url1, URL url2) protected URLConnectionopenConnection(URL url) protected URLConnectionopenConnection(URL url, Proxy proxy) protected voidprotected booleanvoidvoidsetURL(URL url, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref) protected StringtoExternalForm(URL url) private StringtoExternalForm(URL url, Object svc)
-
Field Details
-
URL_PROXY_CLASS
-
STRING_TYPES
-
EQUALS
-
GET_DEFAULT_PORT
-
GET_HOST_ADDRESS
-
HASH_CODE
-
HOSTS_EQUAL
-
OPEN_CONNECTION
-
OPEN_CONNECTION_PROXY
-
SAME_FILE
-
TO_EXTERNAL_FORM
-
m_service
-
m_action
-
m_builtIn
-
m_builtInURL
-
m_protocol
-
m_loopCheck
-
-
Constructor Details
-
URLHandlersStreamHandlerProxy
public URLHandlersStreamHandlerProxy(String protocol, SecureAction action, URLStreamHandler builtIn, URL builtInURL) -
URLHandlersStreamHandlerProxy
-
-
Method Details
-
equals
- Overrides:
equalsin classURLStreamHandler
-
getDefaultPort
protected int getDefaultPort()- Overrides:
getDefaultPortin classURLStreamHandler
-
getHostAddress
- Overrides:
getHostAddressin classURLStreamHandler
-
hashCode
- Overrides:
hashCodein classURLStreamHandler
-
hostsEqual
- Overrides:
hostsEqualin classURLStreamHandler
-
openConnection
- Specified by:
openConnectionin classURLStreamHandler- Throws:
IOException
-
openConnection
- Overrides:
openConnectionin classURLStreamHandler- Throws:
IOException
-
parseURL
- Overrides:
parseURLin classURLStreamHandler
-
sameFile
- Overrides:
sameFilein classURLStreamHandler
-
setURL
-
setURL
- Specified by:
setURLin interfaceURLStreamHandlerSetter- Overrides:
setURLin classURLStreamHandler- See Also:
-
toExternalForm
- Overrides:
toExternalFormin classURLStreamHandler
-
toExternalForm
-
getStreamHandlerService
Private method to retrieve the stream handler service from the framework instance associated with the current call stack. A simple service tracker is created and cached for the associated framework instance when this method is called.
- Returns:
- the stream handler service from the framework instance associated with the current call stack or null is no service is available.
-
invoke
-