[
https://issues.jboss.org/browse/AS7-1562?page=com.atlassian.jira.plugin.s...
]
David Lloyd commented on AS7-1562:
----------------------------------
In AS7, this is just a question of calling
{{org.jboss.modules.Module#registerURLStreamHandlerFactoryModule()}} with the name of the
module containing the handler factory for your protocol, and ensuring that that module has
a {{META-INF/services/java.net.URLStreamHandler}} file in it. Alternatively, you can
specify the module name in the {{jboss.protocol.handler.modules}} system property, which
works similarly to {{java.protocol.handler.pkgs}} except rather than accepting a list of
package names from the application class path, it accepts a list of module names from the
boot module loader.
It is important to remember that each time you add such a handler, you create a
*permanent* static reference to it. This means that if your handler is in a deployment,
the handler (and thus the deployment) class loader hangs around *forever*, even if you try
to undeploy it. This can appear as a leak if you repeatedly redeploy a module with such a
handler in it which registers itself upon deployment. Thus it is recommended that any
custom URL handlers be registered from static modules. In addition, if there is a URL
protocol type that should be made available by default, then it should be noted so that it
can be added to the AS 7 bootstrap.
Note that at first blush, a URL scheme of "classpath" seems a poor fit in a
modular environment though.
Ability to add custom java url protocol handler
-----------------------------------------------
Key: AS7-1562
URL:
https://issues.jboss.org/browse/AS7-1562
Project: Application Server 7
Issue Type: Feature Request
Components: Server
Environment: JBoss EAP 5.1
Reporter: Brad Maxwell
Labels: URLStreamHandlerFactory, custom, handler, java, url
Looking in the source code for org.jboss.system.server.ServerImpl [1]
- this class is setting the URLStreamHandlerFactory and also calling preload and
specifying the java.protocol.hanlder.pkgs.
URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
// Preload JBoss URL handlers
URLStreamHandlerFactory.preload()
...
System.setProperty("java.protocol.handler.pkgs", handlerPkgs);
So it looks like there isn't a way to change the URLStreamHandlerFactory that is used
and the instance of URLStreamHandlerFactory created is not accessible to add new
protocols.
Is there anything I'm missing, it looks like this should be a feature, I've found
a few posts on the net mentioning other app servers allow you to specify the Factory class
to use.
The exception is:
java.net.MalformedURLException: unknown protocol: classpath
[1]
http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_4_3_0_GA_CP08/system/s...
[2]
http://anonsvn.jboss.org/repos/common/common-core/tags/jboss-common-core-...
[3]
http://community.jboss.org/message/288238?tstart=0
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira