This bundle implements the standard OSGi URL Handlers service. To
perform its function, it listens for stream and content handler
services to be registered and then adds them to its list of handlers,
which will then be use to service URL requests.
This bundle is also useful when working with legacy libraries that perform resource loading using methods like Class.getResource(). In many cases, legacy libraries convert the returned URLs into strings and this result in errors when trying to interpret the URL. This is because resources loaded from a bundle will have a URL that something like this:
The bundle: protocol requires a special stream handler for interpretation, where the 7.0 is the bundle identifier and the remainder is the path to the resource inside the bundle. Oscar automatically attaches the appropriate stream handler to the URL instance returned by methods like Class.getResource(), but if this URL is converted to a string and then later converted back into a URL, then it loses its special stream handler. To deal with this situation, the URL Handlers service for Oscar registers a stream handler for the bundle: protocol, so that string URLs can be converted back into URL instances and correctly interpreted. You will want to make sure that the URL Handlers bundle is in a start level lower than your legacy bundle.
Of course, Oscar could have been implemented to behave this way by default, but there are two reasons why it does not:
Since providing bundle: protocol support is a security concern, it is possible to disable it in the URL Handlers service by using the property specified below.
Stephane Chomat (email@example.com)
Richard S. Hall (firstname.lastname@example.org)
Only one configuration property is availabe:
Properties can be configured using the standard bundle.properties file as described in the usage document.