Mercurial Hosting > luan
comparison src/org/eclipse/jetty/server/handler/ContextHandler.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 | 0048a843297a |
comparison
equal
deleted
inserted
replaced
819:17bd0b170ed6 | 820:8e9db0bbf4f9 |
---|---|
77 import org.eclipse.jetty.util.StringUtil; | 77 import org.eclipse.jetty.util.StringUtil; |
78 import org.eclipse.jetty.util.TypeUtil; | 78 import org.eclipse.jetty.util.TypeUtil; |
79 import org.eclipse.jetty.util.URIUtil; | 79 import org.eclipse.jetty.util.URIUtil; |
80 import org.eclipse.jetty.util.component.AggregateLifeCycle; | 80 import org.eclipse.jetty.util.component.AggregateLifeCycle; |
81 import org.eclipse.jetty.util.component.Dumpable; | 81 import org.eclipse.jetty.util.component.Dumpable; |
82 import org.eclipse.jetty.util.log.Log; | 82 import org.slf4j.Logger; |
83 import org.eclipse.jetty.util.log.Logger; | 83 import org.slf4j.LoggerFactory; |
84 import org.eclipse.jetty.util.resource.Resource; | 84 import org.eclipse.jetty.util.resource.Resource; |
85 | 85 |
86 /* ------------------------------------------------------------ */ | 86 /* ------------------------------------------------------------ */ |
87 /** | 87 /** |
88 * ContextHandler. | 88 * ContextHandler. |
98 * | 98 * |
99 * @org.apache.xbean.XBean description="Creates a basic HTTP context" | 99 * @org.apache.xbean.XBean description="Creates a basic HTTP context" |
100 */ | 100 */ |
101 public class ContextHandler extends ScopedHandler implements Attributes, Server.Graceful | 101 public class ContextHandler extends ScopedHandler implements Attributes, Server.Graceful |
102 { | 102 { |
103 private static final Logger LOG = Log.getLogger(ContextHandler.class); | 103 private static final Logger LOG = LoggerFactory.getLogger(ContextHandler.class); |
104 | 104 |
105 private static final ThreadLocal<Context> __context = new ThreadLocal<Context>(); | 105 private static final ThreadLocal<Context> __context = new ThreadLocal<Context>(); |
106 | 106 |
107 /** | 107 /** |
108 * If a context attribute with this name is set, it is interpreted as a comma separated list of attribute name. Any other context attributes that are set | 108 * If a context attribute with this name is set, it is interpreted as a comma separated list of attribute name. Any other context attributes that are set |
473 classpath.append(file.getAbsolutePath()); | 473 classpath.append(file.getAbsolutePath()); |
474 } | 474 } |
475 } | 475 } |
476 catch (IOException e) | 476 catch (IOException e) |
477 { | 477 { |
478 LOG.debug(e); | 478 LOG.debug("",e); |
479 } | 479 } |
480 } | 480 } |
481 if (classpath.length() == 0) | 481 if (classpath.length() == 0) |
482 return null; | 482 return null; |
483 return classpath.toString(); | 483 return classpath.toString(); |
690 _availability = __STOPPED; | 690 _availability = __STOPPED; |
691 | 691 |
692 if (_contextPath == null) | 692 if (_contextPath == null) |
693 throw new IllegalStateException("Null contextPath"); | 693 throw new IllegalStateException("Null contextPath"); |
694 | 694 |
695 _logger = Log.getLogger(getDisplayName() == null?getContextPath():getDisplayName()); | 695 _logger = LoggerFactory.getLogger(getDisplayName() == null?getContextPath():getDisplayName()); |
696 ClassLoader old_classloader = null; | 696 ClassLoader old_classloader = null; |
697 Thread current_thread = null; | 697 Thread current_thread = null; |
698 Context old_context = null; | 698 Context old_context = null; |
699 | 699 |
700 try | 700 try |
1088 _handler.handle(target,baseRequest,request,response); | 1088 _handler.handle(target,baseRequest,request,response); |
1089 // end manual inline | 1089 // end manual inline |
1090 } | 1090 } |
1091 catch (HttpException e) | 1091 catch (HttpException e) |
1092 { | 1092 { |
1093 LOG.debug(e); | 1093 LOG.debug("",e); |
1094 baseRequest.setHandled(true); | 1094 baseRequest.setHandled(true); |
1095 response.sendError(e.getStatus(),e.getReason()); | 1095 response.sendError(e.getStatus(),e.getReason()); |
1096 } | 1096 } |
1097 finally | 1097 finally |
1098 { | 1098 { |
1347 setBaseResource(newResource(resourceBase)); | 1347 setBaseResource(newResource(resourceBase)); |
1348 } | 1348 } |
1349 catch (Exception e) | 1349 catch (Exception e) |
1350 { | 1350 { |
1351 LOG.warn(e.toString()); | 1351 LOG.warn(e.toString()); |
1352 LOG.debug(e); | 1352 LOG.debug("",e); |
1353 throw new IllegalArgumentException(resourceBase); | 1353 throw new IllegalArgumentException(resourceBase); |
1354 } | 1354 } |
1355 } | 1355 } |
1356 | 1356 |
1357 /* ------------------------------------------------------------ */ | 1357 /* ------------------------------------------------------------ */ |
1584 return resource; | 1584 return resource; |
1585 return null; | 1585 return null; |
1586 } | 1586 } |
1587 catch (Exception e) | 1587 catch (Exception e) |
1588 { | 1588 { |
1589 LOG.ignore(e); | 1589 LOG.trace("",e); |
1590 } | 1590 } |
1591 | 1591 |
1592 return null; | 1592 return null; |
1593 } | 1593 } |
1594 | 1594 |
1666 } | 1666 } |
1667 } | 1667 } |
1668 } | 1668 } |
1669 catch (Exception e) | 1669 catch (Exception e) |
1670 { | 1670 { |
1671 LOG.ignore(e); | 1671 LOG.trace("",e); |
1672 } | 1672 } |
1673 return Collections.emptySet(); | 1673 return Collections.emptySet(); |
1674 } | 1674 } |
1675 | 1675 |
1676 /* ------------------------------------------------------------ */ | 1676 /* ------------------------------------------------------------ */ |
1894 return new Dispatcher(context,uri,pathInContext,query); | 1894 return new Dispatcher(context,uri,pathInContext,query); |
1895 } | 1895 } |
1896 } | 1896 } |
1897 catch (Exception e) | 1897 catch (Exception e) |
1898 { | 1898 { |
1899 LOG.ignore(e); | 1899 LOG.trace("",e); |
1900 } | 1900 } |
1901 return null; | 1901 return null; |
1902 } | 1902 } |
1903 | 1903 |
1904 /* ------------------------------------------------------------ */ | 1904 /* ------------------------------------------------------------ */ |
1925 return file.getCanonicalPath(); | 1925 return file.getCanonicalPath(); |
1926 } | 1926 } |
1927 } | 1927 } |
1928 catch (Exception e) | 1928 catch (Exception e) |
1929 { | 1929 { |
1930 LOG.ignore(e); | 1930 LOG.trace("",e); |
1931 } | 1931 } |
1932 | 1932 |
1933 return null; | 1933 return null; |
1934 } | 1934 } |
1935 | 1935 |
1958 Resource r = Resource.newResource(url); | 1958 Resource r = Resource.newResource(url); |
1959 return r.getInputStream(); | 1959 return r.getInputStream(); |
1960 } | 1960 } |
1961 catch (Exception e) | 1961 catch (Exception e) |
1962 { | 1962 { |
1963 LOG.ignore(e); | 1963 LOG.trace("",e); |
1964 return null; | 1964 return null; |
1965 } | 1965 } |
1966 } | 1966 } |
1967 | 1967 |
1968 /* ------------------------------------------------------------ */ | 1968 /* ------------------------------------------------------------ */ |