Mercurial Hosting > luan
comparison src/org/eclipse/jetty/util/resource/FileResource.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 |
---|---|
31 import java.net.URLConnection; | 31 import java.net.URLConnection; |
32 import java.security.Permission; | 32 import java.security.Permission; |
33 | 33 |
34 import org.eclipse.jetty.util.IO; | 34 import org.eclipse.jetty.util.IO; |
35 import org.eclipse.jetty.util.URIUtil; | 35 import org.eclipse.jetty.util.URIUtil; |
36 import org.eclipse.jetty.util.log.Log; | 36 import org.slf4j.Logger; |
37 import org.eclipse.jetty.util.log.Logger; | 37 import org.slf4j.LoggerFactory; |
38 | 38 |
39 | 39 |
40 /* ------------------------------------------------------------ */ | 40 /* ------------------------------------------------------------ */ |
41 /** File Resource. | 41 /** File Resource. |
42 * | 42 * |
46 * by calling the static method @see FileResource#setCheckAliases(boolean) | 46 * by calling the static method @see FileResource#setCheckAliases(boolean) |
47 * | 47 * |
48 */ | 48 */ |
49 public class FileResource extends URLResource | 49 public class FileResource extends URLResource |
50 { | 50 { |
51 private static final Logger LOG = Log.getLogger(FileResource.class); | 51 private static final Logger LOG = LoggerFactory.getLogger(FileResource.class); |
52 private static boolean __checkAliases = true; | 52 private static boolean __checkAliases = true; |
53 | 53 |
54 /* ------------------------------------------------------------ */ | 54 /* ------------------------------------------------------------ */ |
55 private File _file; | 55 private File _file; |
56 private transient URL _alias=null; | 56 private transient URL _alias=null; |
89 { | 89 { |
90 throw e; | 90 throw e; |
91 } | 91 } |
92 catch (Exception e) | 92 catch (Exception e) |
93 { | 93 { |
94 LOG.ignore(e); | 94 LOG.trace("",e); |
95 try | 95 try |
96 { | 96 { |
97 // Assume that File.toURL produced unencoded chars. So try | 97 // Assume that File.toURL produced unencoded chars. So try |
98 // encoding them. | 98 // encoding them. |
99 String file_url="file:"+URIUtil.encodePath(url.toString().substring(5)); | 99 String file_url="file:"+URIUtil.encodePath(url.toString().substring(5)); |
103 else | 103 else |
104 _file = new File("//"+uri.getAuthority()+URIUtil.decodePath(url.getFile())); | 104 _file = new File("//"+uri.getAuthority()+URIUtil.decodePath(url.getFile())); |
105 } | 105 } |
106 catch (Exception e2) | 106 catch (Exception e2) |
107 { | 107 { |
108 LOG.ignore(e2); | 108 LOG.trace("",e2); |
109 | 109 |
110 // Still can't get the file. Doh! try good old hack! | 110 // Still can't get the file. Doh! try good old hack! |
111 checkConnection(); | 111 checkConnection(); |
112 Permission perm = _connection.getPermission(); | 112 Permission perm = _connection.getPermission(); |
113 _file = new File(perm==null?url.getFile():perm.getName()); | 113 _file = new File(perm==null?url.getFile():perm.getName()); |
205 LOG.debug("ALIAS can="+can); | 205 LOG.debug("ALIAS can="+can); |
206 } | 206 } |
207 } | 207 } |
208 catch(Exception e) | 208 catch(Exception e) |
209 { | 209 { |
210 LOG.warn(Log.EXCEPTION,e); | 210 LOG.warn("EXCEPTION",e); |
211 return getURL(); | 211 return getURL(); |
212 } | 212 } |
213 } | 213 } |
214 return _alias; | 214 return _alias; |
215 } | 215 } |