comparison src/org/eclipse/jetty/server/AbstractHttpConnection.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 292f2e31ab41
comparison
equal deleted inserted replaced
819:17bd0b170ed6 820:8e9db0bbf4f9
60 import org.eclipse.jetty.server.nio.NIOConnector; 60 import org.eclipse.jetty.server.nio.NIOConnector;
61 import org.eclipse.jetty.server.ssl.SslConnector; 61 import org.eclipse.jetty.server.ssl.SslConnector;
62 import org.eclipse.jetty.util.QuotedStringTokenizer; 62 import org.eclipse.jetty.util.QuotedStringTokenizer;
63 import org.eclipse.jetty.util.StringUtil; 63 import org.eclipse.jetty.util.StringUtil;
64 import org.eclipse.jetty.util.URIUtil; 64 import org.eclipse.jetty.util.URIUtil;
65 import org.eclipse.jetty.util.log.Log; 65 import org.slf4j.Logger;
66 import org.eclipse.jetty.util.log.Logger; 66 import org.slf4j.LoggerFactory;
67 import org.eclipse.jetty.util.resource.Resource; 67 import org.eclipse.jetty.util.resource.Resource;
68 68
69 /** 69 /**
70 * <p>A HttpConnection represents the connection of a HTTP client to the server 70 * <p>A HttpConnection represents the connection of a HTTP client to the server
71 * and is created by an instance of a {@link Connector}. It's prime function is 71 * and is created by an instance of a {@link Connector}. It's prime function is
97 * </p> 97 * </p>
98 * 98 *
99 */ 99 */
100 public abstract class AbstractHttpConnection extends AbstractConnection 100 public abstract class AbstractHttpConnection extends AbstractConnection
101 { 101 {
102 private static final Logger LOG = Log.getLogger(AbstractHttpConnection.class); 102 private static final Logger LOG = LoggerFactory.getLogger(AbstractHttpConnection.class);
103 103
104 private static final int UNKNOWN = -2; 104 private static final int UNKNOWN = -2;
105 private static final ThreadLocal<AbstractHttpConnection> __currentConnection = new ThreadLocal<AbstractHttpConnection>(); 105 private static final ThreadLocal<AbstractHttpConnection> __currentConnection = new ThreadLocal<AbstractHttpConnection>();
106 106
107 private int _requests; 107 private int _requests;
465 path = _uri.getDecodedPath(); 465 path = _uri.getDecodedPath();
466 } 466 }
467 catch (Exception e) 467 catch (Exception e)
468 { 468 {
469 LOG.warn("Failed UTF-8 decode for request path, trying ISO-8859-1"); 469 LOG.warn("Failed UTF-8 decode for request path, trying ISO-8859-1");
470 LOG.ignore(e); 470 LOG.trace("",e);
471 path = _uri.getDecodedPath(StringUtil.__ISO_8859_1); 471 path = _uri.getDecodedPath(StringUtil.__ISO_8859_1);
472 } 472 }
473 473
474 info=URIUtil.canonicalPath(path); 474 info=URIUtil.canonicalPath(path);
475 if (info==null && !_request.getMethod().equals(HttpMethods.CONNECT)) 475 if (info==null && !_request.getMethod().equals(HttpMethods.CONNECT))
519 server.handleAsync(this); 519 server.handleAsync(this);
520 } 520 }
521 } 521 }
522 catch (ContinuationThrowable e) 522 catch (ContinuationThrowable e)
523 { 523 {
524 LOG.ignore(e); 524 LOG.trace("",e);
525 } 525 }
526 catch (EofException e) 526 catch (EofException e)
527 { 527 {
528 async_exception=e; 528 async_exception=e;
529 LOG.debug(e); 529 LOG.debug("",e);
530 error=true; 530 error=true;
531 _request.setHandled(true); 531 _request.setHandled(true);
532 if (!_response.isCommitted()) 532 if (!_response.isCommitted())
533 _generator.sendError(500, null, null, true); 533 _generator.sendError(500, null, null, true);
534 } 534 }
535 catch (RuntimeIOException e) 535 catch (RuntimeIOException e)
536 { 536 {
537 async_exception=e; 537 async_exception=e;
538 LOG.debug(e); 538 LOG.debug("",e);
539 error=true; 539 error=true;
540 _request.setHandled(true); 540 _request.setHandled(true);
541 } 541 }
542 catch (HttpException e) 542 catch (HttpException e)
543 { 543 {
544 LOG.debug(e); 544 LOG.debug("",e);
545 error=true; 545 error=true;
546 _request.setHandled(true); 546 _request.setHandled(true);
547 _response.sendError(e.getStatus(), e.getReason()); 547 _response.sendError(e.getStatus(), e.getReason());
548 } 548 }
549 catch (Throwable e) 549 catch (Throwable e)
661 _generator.completeHeader(_responseFields, Generator.LAST); 661 _generator.completeHeader(_responseFields, Generator.LAST);
662 } 662 }
663 catch(RuntimeException e) 663 catch(RuntimeException e)
664 { 664 {
665 LOG.warn("header full: "+e); 665 LOG.warn("header full: "+e);
666 LOG.debug(e); 666 LOG.debug("",e);
667 667
668 _response.reset(); 668 _response.reset();
669 _generator.reset(); 669 _generator.reset();
670 _generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null); 670 _generator.setResponse(HttpStatus.INTERNAL_SERVER_ERROR_500,null);
671 _generator.completeHeader(_responseFields,Generator.LAST); 671 _generator.completeHeader(_responseFields,Generator.LAST);
821 _request.setProtocol(version.toString()); 821 _request.setProtocol(version.toString());
822 } 822 }
823 } 823 }
824 catch (Exception e) 824 catch (Exception e)
825 { 825 {
826 LOG.debug(e); 826 LOG.debug("",e);
827 if (e instanceof HttpException) 827 if (e instanceof HttpException)
828 throw (HttpException)e; 828 throw (HttpException)e;
829 throw new HttpException(HttpStatus.BAD_REQUEST_400,null,e); 829 throw new HttpException(HttpStatus.BAD_REQUEST_400,null,e);
830 } 830 }
831 } 831 }