1 17 package org.alfresco.config.source; 18 19 import java.io.BufferedInputStream ; 20 import java.io.InputStream ; 21 import java.net.URL ; 22 import java.util.Collections ; 23 import java.util.List ; 24 25 import org.apache.commons.logging.Log; 26 import org.apache.commons.logging.LogFactory; 27 28 33 public class HTTPConfigSource extends BaseConfigSource 34 { 35 private static Log logger = LogFactory.getLog(HTTPConfigSource.class); 36 37 44 public HTTPConfigSource(String url) 45 { 46 this(Collections.singletonList(url)); 47 } 48 49 54 public HTTPConfigSource(List <String > sourceStrings) 55 { 56 super(sourceStrings); 57 } 58 59 65 public InputStream getInputStream(String sourceString) 66 { 67 InputStream is = null; 68 69 try 70 { 71 URL url = new URL (sourceString); 72 is = new BufferedInputStream (url.openStream()); 73 } 74 catch (Throwable e) 75 { 76 if (logger.isDebugEnabled()) 77 { 78 logger.debug("Failed to obtain input stream to URL: " + sourceString, e); 79 } 80 } 81 82 return is; 83 } 84 } 85 | Popular Tags |