Mercurial Hosting > luan
comparison src/org/eclipse/jetty/util/resource/URLResource.java @ 820:8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Tue, 13 Sep 2016 23:13:06 -0600 |
| parents | 3428c60d7cfc |
| children |
comparison
equal
deleted
inserted
replaced
| 819:17bd0b170ed6 | 820:8e9db0bbf4f9 |
|---|---|
| 26 import java.net.URL; | 26 import java.net.URL; |
| 27 import java.net.URLConnection; | 27 import java.net.URLConnection; |
| 28 import java.security.Permission; | 28 import java.security.Permission; |
| 29 | 29 |
| 30 import org.eclipse.jetty.util.URIUtil; | 30 import org.eclipse.jetty.util.URIUtil; |
| 31 import org.eclipse.jetty.util.log.Log; | 31 import org.slf4j.Logger; |
| 32 import org.eclipse.jetty.util.log.Logger; | 32 import org.slf4j.LoggerFactory; |
| 33 | 33 |
| 34 /* ------------------------------------------------------------ */ | 34 /* ------------------------------------------------------------ */ |
| 35 /** Abstract resource class. | 35 /** Abstract resource class. |
| 36 */ | 36 */ |
| 37 public class URLResource extends Resource | 37 public class URLResource extends Resource |
| 38 { | 38 { |
| 39 private static final Logger LOG = Log.getLogger(URLResource.class); | 39 private static final Logger LOG = LoggerFactory.getLogger(URLResource.class); |
| 40 protected URL _url; | 40 protected URL _url; |
| 41 protected String _urlString; | 41 protected String _urlString; |
| 42 | 42 |
| 43 protected URLConnection _connection; | 43 protected URLConnection _connection; |
| 44 protected InputStream _in=null; | 44 protected InputStream _in=null; |
| 68 _connection=_url.openConnection(); | 68 _connection=_url.openConnection(); |
| 69 _connection.setUseCaches(_useCaches); | 69 _connection.setUseCaches(_useCaches); |
| 70 } | 70 } |
| 71 catch(IOException e) | 71 catch(IOException e) |
| 72 { | 72 { |
| 73 LOG.ignore(e); | 73 LOG.trace("",e); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 return _connection!=null; | 76 return _connection!=null; |
| 77 } | 77 } |
| 78 | 78 |
| 82 @Override | 82 @Override |
| 83 public synchronized void release() | 83 public synchronized void release() |
| 84 { | 84 { |
| 85 if (_in!=null) | 85 if (_in!=null) |
| 86 { | 86 { |
| 87 try{_in.close();}catch(IOException e){LOG.ignore(e);} | 87 try{_in.close();}catch(IOException e){LOG.trace("",e);} |
| 88 _in=null; | 88 _in=null; |
| 89 } | 89 } |
| 90 | 90 |
| 91 if (_connection!=null) | 91 if (_connection!=null) |
| 92 _connection=null; | 92 _connection=null; |
| 107 _in = _connection.getInputStream(); | 107 _in = _connection.getInputStream(); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 catch (IOException e) | 110 catch (IOException e) |
| 111 { | 111 { |
| 112 LOG.ignore(e); | 112 LOG.trace("",e); |
| 113 } | 113 } |
| 114 return _in!=null; | 114 return _in!=null; |
| 115 } | 115 } |
| 116 | 116 |
| 117 /* ------------------------------------------------------------ */ | 117 /* ------------------------------------------------------------ */ |
| 179 return new File(perm.getName()); | 179 return new File(perm.getName()); |
| 180 } | 180 } |
| 181 | 181 |
| 182 // Try the URL file arg | 182 // Try the URL file arg |
| 183 try {return new File(_url.getFile());} | 183 try {return new File(_url.getFile());} |
| 184 catch(Exception e) {LOG.ignore(e);} | 184 catch(Exception e) {LOG.trace("",e);} |
| 185 | 185 |
| 186 // Don't know the file | 186 // Don't know the file |
| 187 return null; | 187 return null; |
| 188 } | 188 } |
| 189 | 189 |
