|
Handler |
|
1 package gate.util.protocols.classpath; 2 3 import java.net.*; 4 import java.io.*; 5 6 import gate.util.*; 7 import gate.*; 8 9 /** 10 * The handler for the "classpath://" URLs. 11 * All this class does is to transparently transform a "classpath://" URL into 12 * an URL of the according type and forward all requests through it. 13 */ 14 public class Handler extends URLStreamHandler { 15 16 protected URLConnection openConnection(URL u) throws java.io.IOException { 17 URL[] urls = Gate.getClassLoader().getURLs(); 18 for(int i = 0; i < urls.length; i++){ 19 Out.prln(urls[i].toExternalForm()); 20 } 21 URL actualURL = Gate.getClassLoader().getResource(u.getPath());// Handler.class.getResource(u.getPath()); 22 if(actualURL == null) throw new FileNotFoundException(u.toExternalForm()); 23 return actualURL.openConnection(); 24 } 25 } 26
|
Handler |
|