From e140fd63013794203d7d0ef5d2e1656ac367bce1 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 9 Jul 2003 18:44:52 +0000 Subject: [PATCH] Use the AttachableURLFactory. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2696 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/resource/Handler.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/java/com/threerings/resource/Handler.java b/src/java/com/threerings/resource/Handler.java index a7fcfd9f9..637cf5807 100644 --- a/src/java/com/threerings/resource/Handler.java +++ b/src/java/com/threerings/resource/Handler.java @@ -1,5 +1,5 @@ // -// $Id: Handler.java,v 1.4 2003/05/07 05:31:09 mdb Exp $ +// $Id: Handler.java,v 1.5 2003/07/09 18:44:52 ray Exp $ package com.threerings.resource; @@ -9,7 +9,8 @@ import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; -import java.net.URLStreamHandlerFactory; + +import com.samskivert.net.AttachableURLFactory; /** * This class is not used directly, except by a registering ResourceManager @@ -35,18 +36,10 @@ public class Handler extends URLStreamHandler // There are two ways to do this. // Method 1, which is the only one that seems to work under - // Java Web Start, is to register a factory. This is kind of - // scary because there can only be one factory. - URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() { - public URLStreamHandler createURLStreamHandler (String protocol) - { - if (protocol.equalsIgnoreCase("resource")) { - return new Handler(); - } - return null; - } - }); - + // Java Web Start, is to register a factory. + // This *used* to be scary to me, because you could only have one + // factory, but now we have the attachable factory! + AttachableURLFactory.attachHandler("resource", Handler.class); // Method 2 seems like a better idea but doesn't work under // Java Web Start. We add on a property that registers this