Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes setting URLStreamHandlerFactory from webapp in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "setting URLStreamHandlerFactory from webapp in Tomcat" Watch "setting URLStreamHandlerFactory from webapp in Tomcat" New topic
Author

setting URLStreamHandlerFactory from webapp in Tomcat

Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
We want to set an URLStreamHandlerFactory from our web application running in Tomcat. Well, in fact we just want to support an additional protocol, and this seems to be the only way to do that.

Problem is that the factory is only allowed to be set once per JVM via URL.setURLStreamHandlerFactory, and Tomcat seems to already set one. We have no idea what to do - our hope is that Tomcat might provide a workaround for that limitation, but didn't find anything googling. (What did the Sun developers think when they designed it that way??? )


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
Is it really necessary to change the factory - wouldn't registering the protocol handler class be sufficient?
[ April 24, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Ulf Dittmer:
Is it really necessary to change the factory - wouldn't registering the protocol handler class be sufficient?


It probably will. Thanks for the pointer!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
It probably *would* work, if our protocol wouldn't be called "class", which is not a valid java identifier and therefore cannot be used as part of a package name.

We will now try to do it via a dirty reflection hack...
 
 
subject: setting URLStreamHandlerFactory from webapp in Tomcat
 
Similar Threads
Why has RMI in FORTE apparently been dropped
5.5.20 context.xml -- how to show multiple apps?
No result set from stored proc??
Convert HTML content into PDF format using Java
How do you know the version of Java .class file?