On 5/7/07, Steven E. Harris <[EMAIL PROTECTED]> wrote:
Jeremy Volkman <[EMAIL PROTECTED]> writes:

> As far as URLStreamHandlerService goes, I can see two problems you
> might be running into.
>
> 1. You're hitting a "built-in" protocol as determined by the
> implementation of the URL handling service's
> URLStreamHandlerFactory.  In the case of Equinox's, the system
> property "java.protocol.handler.pkgs" is checked for these
> built-ins.

With the consequence being that Equinox -- or any other
similarly-behaving implementation -- won't tolerate registration of a
duplicate handler?

Correct -- your registered handler will be ignored.


> 2. You aren't hitting a "built-in" known by the URL handling service's
> URLStreamHandlerFactory, but an "http" url is looked up before your
> custom URLStreamHandlerService is registered.

And in that case, my implementation would be skipped as well.

Is the solution to the first problem above to try to register my
handler as one of the "built-in" packages, shadowing Sun's handler, or
is that frowned upon.


It's probably not ideal, but extreme cases call for extreme measures.
;) You'd probably have to play around with the boot classpath or put
your handler in a fragment of the system bundle for URL to
successfully find it.

> There may be other possible problems, as I've just taken a cursory
> glance at the various players involved, but hopefully this will get
> you on the right track.

I may have read your message too pessimistically, but it sounds like
you're confirming my suspicion that it's not tenable to replace the
built-in HTTP URL handler, there being too many ways to lose out to
the default. Did I misread your intent?


I think that you might have a chance if you somehow ensure that your
HTTP URLStreamHandlerService is registered as a Service before the URL
handling service implementation is registered. Since URL's handler
cache is cleared when the handler factory is registered, any HTTP
handlers that had been cached out of your control during the initial
stages of the JVM would also be lost. In Equinox's case, I think the
handling service is part of the core framework, so this may not be
possible.

--
Steven E. Harris
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev


- Jeremy
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev

Reply via email to