"Christopher Schultz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > MK, > > MK wrote: > | I have the following problem: > | My Web application needs to handle Lotus Notes URLs which use the scheme > | "notes". However, since Java does not know this protocol by default, > it throws a > | MalformedUrlException when I construct a java.net.URL from a notes:// > URL-string. > | > | So, I read up on custom URL handlers and as far as I understand, you > have to > | code a custom URLStreamHandler class and a custom URLConnection class. > > You really only need a custom URLStreamHandler... if there's a > URLConnection that you can re-use, you are welcome to do that. > > | Okay, no > | big deal. However, there are three ways to register your new handler: > | > | 1) put it in the sun.net.www.protocol.yourprotocol package > > Don't do that. You probably can't do it anyway, since the JAR defining > the package is likely to be sealed. > > | 2) put it in a custom package and declare that package to the JRE > using the > | java.protocol.handler.pkgs system property > > This is how I do it in my TestURLConnection package > (http://sourceforge.net/projects/tuc). > > | 3) register a custom URLStreamHandlerFactory using > URL.setUrlStreamHandlerFactory > > This might not work, since the javadoc says it may only be called once > for a given JVM -- and Tomcat (or something else) might have don it > before you get the chance to do so. >
Yes, TC registers one early on in the init phase to handle jndi://..... > | problem is, none of these approaches work in Tomcat 5.5. For 1), this > simply > | didn't have any effect for me. 2) neither, maybe Tomcat simply ignores > that > | property? > > How did you set the property? > > | 3) doesn't work because Tomcat already registers its own factory, and > | for some reason I can't quite put my hands on you are not allowed to > call that > | method twice per JVM instance. > > Yeah, that's not surprising at all. > > | This issue is also discussed on Sun's Java issue tracker: > | http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4648098 > | > | The ticket has been opened six years ago and still no fix! > > That is also not surprising. Bugs in Java seem to take forever to get > fixed, if they ever get fixed. It's a shame, really. > > | Does Tomcat meanwhile have some workaround for this? I mean, I don't > even need > | an actual URL connection, I just want to pass custom URL strings, > which should > | be perfectly fine if they are valid URLs, no?! > > Do you have the opportunity to intercept these URL objects, or are they > always handled somewhere that you can't inspect them. I'm wondering if > you can convert a notes:// URL into, say, an http:// URL before > attempting to call URL.openConnection. I don't know anything about > notes://, so maybe it isn't even HTTP-compatible. > > I'm sure there's a way around this. Give us some more information and > we'll see what we can do. > > - -chris > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.8 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAke+9tYACgkQ9CaO5/Lv0PCu+QCfZR8fi+RMARH22QPpcZDjl4/o > gUUAoL3sKYTDL6jznTmFu3QdOMZLX73N > =Moqk > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]