users@glassfish.java.net

How do I register a new URLStreamHandler for a servlet?

From: <glassfish_at_javadesktop.org>
Date: Tue, 16 Jun 2009 15:05:14 PDT

I have an library which uses a couple of custom URLStreamHandlers in order to handle parsing of custom URL protocols. The app, standalone, works fine by modifying the system property java.protocol.handler.pkgs. However, once that code is embedded in a servlet, I get MalformedURLException every time I try to create a URL with the custom protocols. Specifying the property in the admin console doesn't have any effect, although it isn't clear where I would need to do that.

How do I go about installing custom stream handlers in glassfish so that my servlet is able to open the same URLs that it could do standalone? A few hours of searching the documentation hasn't turned up an obvious fix. I don't really care about which servlet container I use, but Glassfish came with Netbeans so I was hoping it would be easy to use.
[Message sent by forum member 'carlburke' (carlburke)]

http://forums.java.net/jive/thread.jspa?messageID=351518