1 package org.sapia.soto.util; 2 3 import java.io.IOException ; 4 import java.io.InputStream ; 5 6 import java.net.URL ; 7 8 9 22 public class UrlResourceHandler implements ResourceHandler { 23 26 public UrlResourceHandler() { 27 super(); 28 } 29 30 33 public Resource getResourceObject(String uri) throws IOException { 34 return new UrlResource(new URL (uri)); 35 } 36 37 40 public InputStream getResource(String uri) throws IOException { 41 return getResourceObject(uri).getInputStream(); 42 } 43 44 47 public boolean accepts(String uri) { 48 String scheme = Utils.getScheme(uri); 49 if(scheme == null || scheme.length() == 0){ 50 return false; 51 } 52 return true; 53 } 54 55 } 56 | Popular Tags |