You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Felix Meschberger <Fe...@day.com> on 2006/11/01 10:06:51 UTC
URL Handlers Service
Hi all,
I have a problem related to URL Handlers for which I could not find a
hint or solution. If anyone could shed some light on this, I would be
very grateful.
I am currently building an application which uses Felix to implement
the OSGi framework. This application is intended to run in servlet
container as part of a Web Application. It is also intended that
multiple such Web Applications may be registered with the same servlet
container. As each Web Application has its own class loader hierarchy,
each Felix instance will have its own URL Handler registry - but only
the first instance will be successfull registrating the global Java VM
URL Handler Factories. Even worse, if the application is running
inside an Application Server, which itself registers URL Handler
Factories, not even the first Felix instance will be able to register.
Consequently I will probably have to disable global URL Handler
Factory registration, which leaves me with no way of supporting custom
URL handlers. In the spec, I could not find a hint on what would
happen in such a situation.
How about having a per-framework URL Handler registry just like the
URLHandlers class which is registered as a service. This service could
serve URLs and content handlers by calling the system URL factory
first (after checking for the "bundle:" protocol) and then the locally
registered handlers.
What do you think ?
Thanks for any more or better ideas.
Regards
Felix
Re: URL Handlers Service
Posted by Felix Meschberger <Fe...@day.com>.
Hi Karl,
> Felix already does provide something like that. Have a look at:
Yes, I know and this is great. But this (1) class is package private,
hence not available from outside, and (2) if the Felix is instance
sets the framework.service.urlhandlers property to false the URL
handler support is disabled for that instance and (3) if the property
is true, at least one URLHandlers instance is created which calls the
URL.setURLStreamHandlerFactory() and
URLConnection.setContentHandlerFactory() methods. This fails if either
method has already been called.
Consequently, I am back to the start: What if the factories have
already been registered by a non-Felix application ? What if two Felix
instances run in two separate class loader hierarchies, which means,
they don't have access to each other ?
Regards,
Felix
Re: URL Handlers Service
Posted by Karl Pauls <ka...@gmail.com>.
Hi Felix,
> How about having a per-framework URL Handler registry just like the
> URLHandlers class which is registered as a service. This service could
> serve URLs and content handlers by calling the system URL factory
> first (after checking for the "bundle:" protocol) and then the locally
> registered handlers.
Felix already does provide something like that. Have a look at:
http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlers.java?view=markup
> Regards
> Felix
regards,
Karl
--
Karl Pauls
karlpauls@gmail.com