Class URLHandlersContentHandlerProxy

java.lang.Object
java.net.ContentHandler
org.apache.felix.framework.URLHandlersContentHandlerProxy

class URLHandlersContentHandlerProxy extends 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 Details

    • STRING_TYPES

      private static final Class[] STRING_TYPES
    • CONTENT_HANDLER_PACKAGE_PROP

      private static final String CONTENT_HANDLER_PACKAGE_PROP
      See Also:
    • DEFAULT_CONTENT_HANDLER_PACKAGE

      private static final String DEFAULT_CONTENT_HANDLER_PACKAGE
      See Also:
    • m_builtIn

      private static final Map m_builtIn
    • m_pkgs

      private static final String m_pkgs
    • m_factory

      private final ContentHandlerFactory m_factory
    • m_mimeType

      private final String m_mimeType
    • m_action

      private final SecureAction m_action
  • Constructor Details

  • Method Details

    • getContent

      public Object getContent(URLConnection urlc) throws IOException
      Specified by:
      getContent in class ContentHandler
      Throws:
      IOException
    • getContentHandlerService

      private 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 ContentHandler getBuiltIn()
    • addToCache

      private ContentHandler addToCache(String mimeType, ContentHandler handler)