Class URLHandlersContentHandlerProxy
- java.lang.Object
-
- java.net.ContentHandler
-
- org.apache.felix.framework.URLHandlersContentHandlerProxy
-
class URLHandlersContentHandlerProxy extends java.net.ContentHandler
This class implements a content handler proxy. When the content handler proxy instance is created, it is associated with a particular mime type and will answer all future requests for content of that type. It does not directly handle the content requests, but delegates the requests to an underlying content handler service.
The proxy for a particular mime type is used for all framework instances that may contain their own content handler services. When performing a content 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 content 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" content handler service at any given time.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
CONTENT_HANDLER_PACKAGE_PROP
private static java.lang.String
DEFAULT_CONTENT_HANDLER_PACKAGE
private SecureAction
m_action
private static java.util.Map
m_builtIn
private java.net.ContentHandlerFactory
m_factory
private java.lang.String
m_mimeType
private static java.lang.String
m_pkgs
private static java.lang.Class[]
STRING_TYPES
-
Constructor Summary
Constructors Constructor Description URLHandlersContentHandlerProxy(java.lang.String mimeType, SecureAction action, java.net.ContentHandlerFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.net.ContentHandler
addToCache(java.lang.String mimeType, java.net.ContentHandler handler)
private java.net.ContentHandler
getBuiltIn()
java.lang.Object
getContent(java.net.URLConnection urlc)
private java.net.ContentHandler
getContentHandlerService()
Private method to retrieve the content handler service from the framework instance associated with the current call stack.
-
-
-
Field Detail
-
STRING_TYPES
private static final java.lang.Class[] STRING_TYPES
-
CONTENT_HANDLER_PACKAGE_PROP
private static final java.lang.String CONTENT_HANDLER_PACKAGE_PROP
- See Also:
- Constant Field Values
-
DEFAULT_CONTENT_HANDLER_PACKAGE
private static final java.lang.String DEFAULT_CONTENT_HANDLER_PACKAGE
- See Also:
- Constant Field Values
-
m_builtIn
private static final java.util.Map m_builtIn
-
m_pkgs
private static final java.lang.String m_pkgs
-
m_factory
private final java.net.ContentHandlerFactory m_factory
-
m_mimeType
private final java.lang.String m_mimeType
-
m_action
private final SecureAction m_action
-
-
Constructor Detail
-
URLHandlersContentHandlerProxy
public URLHandlersContentHandlerProxy(java.lang.String mimeType, SecureAction action, java.net.ContentHandlerFactory factory)
-
-
Method Detail
-
getContent
public java.lang.Object getContent(java.net.URLConnection urlc) throws java.io.IOException
- Specified by:
getContent
in classjava.net.ContentHandler
- Throws:
java.io.IOException
-
getContentHandlerService
private java.net.ContentHandler getContentHandlerService()
Private method to retrieve the content 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 content handler service from the framework instance associated with the current call stack or null is no service is available.
-
getBuiltIn
private java.net.ContentHandler getBuiltIn()
-
addToCache
private java.net.ContentHandler addToCache(java.lang.String mimeType, java.net.ContentHandler handler)
-
-