1 17 18 package org.apache.avalon.repository ; 19 20 import java.io.IOException ; 21 import java.net.URL ; 22 import java.net.URLConnection ; 23 import java.net.URLStreamHandler ; 24 25 28 public class ArtifactHandler extends URLStreamHandler 29 { 30 37 protected URLConnection openConnection( final URL url ) 38 throws IOException 39 { 40 return new ArtifactURLConnection( url ); 41 } 42 43 protected int getDefaultPort() 44 { 45 return 0; 46 } 47 48 protected String toExternalForm( URL url ) 49 { 50 StringBuffer result = new StringBuffer ( "artifact:" ); 51 if (url.getFile() != null ) 52 { 53 result.append(url.getFile()); 54 } 55 if (url.getRef() != null ) 56 { 57 result.append("#"); 58 result.append(url.getRef()); 59 } 60 return result.toString(); 61 } 62 63 } 64 | Popular Tags |