changeset 1001:39154cfa58e4

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 22 Oct 2016 20:56:41 -0600
parents 32d4b569567c
children 35d04ac3fd0b
files src/org/eclipse/jetty/http/HttpParser.java src/org/eclipse/jetty/io/AbstractConnection.java src/org/eclipse/jetty/server/AbstractHttpConnection.java src/org/eclipse/jetty/server/Connector.java src/org/eclipse/jetty/server/Request.java src/org/eclipse/jetty/server/Server.java src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java src/org/eclipse/jetty/server/nio/SelectChannelConnector.java src/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java
diffstat 9 files changed, 30 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/http/HttpParser.java
--- a/src/org/eclipse/jetty/http/HttpParser.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Sat Oct 22 20:56:41 2016 -0600
@@ -148,7 +148,7 @@
 	 */
 	public boolean parseAvailable() throws IOException
 	{
-		boolean progress=parseNext()>0;
+		boolean progress = parseNext() > 0;
 
 		// continue parsing
 		while (!isComplete() && _buffer!=null && _buffer.length()>0 && !_contentView.hasContent())
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/io/AbstractConnection.java
--- a/src/org/eclipse/jetty/io/AbstractConnection.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractConnection.java	Sat Oct 22 20:56:41 2016 -0600
@@ -28,15 +28,10 @@
 {
 	private static final Logger LOG = LoggerFactory.getLogger(AbstractConnection.class);
 
-	protected final EndPoint _endp;
+	public final EndPoint _endp;
 
 	protected AbstractConnection(EndPoint endp)
 	{
 		_endp = endp;
 	}
-
-	public final EndPoint getEndPoint()
-	{
-		return _endp;
-	}
 }
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/server/AbstractHttpConnection.java
--- a/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Sat Oct 22 20:56:41 2016 -0600
@@ -92,15 +92,13 @@
 {
 	private static final Logger LOG = LoggerFactory.getLogger(AbstractHttpConnection.class);
 
-	private int _requests;
-
 	private final Connector _connector;
 	private final Server _server;
 	protected final HttpURI _uri = StringUtil.__UTF8.equals(URIUtil.__CHARSET)?new HttpURI():new EncodedHttpURI(URIUtil.__CHARSET);
 
 	protected final HttpParser _parser;
 	protected final HttpFields _requestFields = new HttpFields();
-	private final Request _request;
+	public final Request _request;
 	private volatile ServletInputStream _in;
 
 	protected final HttpGenerator _generator;
@@ -289,7 +287,7 @@
 				if (_out!=null)
 					_out.reopen();
 
-				_connector.customize(_endp, _request);
+				_connector.customize(this);
 				_server.handle(this);
 			}
 			catch (EofException e)
@@ -443,11 +441,10 @@
 	@Override
 	public String toString()
 	{
-		return String.format("%s,g=%s,p=%s,r=%d",
+		return String.format("%s,g=%s,p=%s",
 				super.toString(),
 				_generator,
-				_parser,
-				_requests);
+				_parser);
 	}
 
 	private void startRequest(Buffer method, Buffer uri, Buffer version) throws IOException
@@ -574,7 +571,6 @@
 			return;
 		}
 		
-		_requests++;
 		_generator.setVersion(_version);
 		switch (_version)
 		{
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/server/Connector.java
--- a/src/org/eclipse/jetty/server/Connector.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/server/Connector.java	Sat Oct 22 20:56:41 2016 -0600
@@ -117,12 +117,6 @@
 	 * @param maxIdleTime
 	 *            The maxIdleTime to set.
 	 */
-/*
-	public void setMaxIdleTime(int maxIdleTime)
-	{
-		_maxIdleTime = maxIdleTime;
-	}
-*/
 
 	public final int getSoLingerTime()
 	{
@@ -180,7 +174,7 @@
 			socket.setSoLinger(false,0);
 	}
 
-	public abstract void customize(EndPoint endpoint, Request request) throws IOException;
+	public abstract void customize(AbstractHttpConnection con) throws IOException;
 
 	public boolean isConfidential()
 	{
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/server/Request.java
--- a/src/org/eclipse/jetty/server/Request.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/server/Request.java	Sat Oct 22 20:56:41 2016 -0600
@@ -155,7 +155,7 @@
 	public Request(AbstractHttpConnection connection)
 	{
 		_connection = connection;
-		_endp = connection.getEndPoint();
+		_endp = connection._endp;
 	}
 
 	/* ------------------------------------------------------------ */
@@ -903,8 +903,7 @@
 	/*
 	 * Set a request attribute. if the attribute name is "org.eclipse.jetty.server.server.Request.queryEncoding" then the value is also passed in a call to
 	 * {@link #setQueryEncoding}. <p> if the attribute name is "org.eclipse.jetty.server.server.ResponseBuffer", then the response buffer is flushed with @{link
-	 * #flushResponseBuffer} <p> if the attribute name is "org.eclipse.jetty.io.EndPoint.maxIdleTime", then the value is passed to the associated {@link
-	 * EndPoint#setMaxIdleTime}.
+	 * #flushResponseBuffer}.
 	 *
 	 * @see javax.servlet.ServletRequest#setAttribute(java.lang.String, java.lang.Object)
 	 */
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/server/Server.java
--- a/src/org/eclipse/jetty/server/Server.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/server/Server.java	Sat Oct 22 20:56:41 2016 -0600
@@ -69,8 +69,8 @@
 	public Server(int port)
 	{
 		setServer(this);
-//		new SelectChannelConnector(this,port);
-		new BlockingChannelConnector(this,port);
+		new SelectChannelConnector(this,port);
+//		new BlockingChannelConnector(this,port);
 	}
 
 	@Override
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java
--- a/src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	Sat Oct 22 20:56:41 2016 -0600
@@ -38,6 +38,7 @@
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.AbstractHttpConnection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -123,21 +124,21 @@
 		Socket socket = channel.socket();
 		configure(socket);
 
-		BlockingChannelEndPoint connection = new BlockingChannelEndPoint(channel);
+		BlockingChannelEndPoint endp = new BlockingChannelEndPoint(channel);
 		try {
-			server.threadPool.execute(connection);
+			server.threadPool.execute(endp);
 		} catch(RejectedExecutionException e) {
-			LOG.warn("dispatch failed for  {}",connection._connection);
-			connection.close();
+			LOG.warn("dispatch failed for  {}",endp._connection);
+			endp.close();
 		}
 	}
 
 	@Override
-	public void customize(EndPoint endpoint, Request request)
+	public void customize(AbstractHttpConnection con)
 		throws IOException
 	{
-		endpoint.setMaxIdleTime(_maxIdleTime);
-		configure(endpoint.getChannel().socket());
+		con._endp.setMaxIdleTime(_maxIdleTime);
+		configure(con._endp.getChannel().socket());
 	}
 
 
@@ -202,7 +203,6 @@
 				{
 					_idleTimestamp = System.currentTimeMillis();
 					_connection.handle();
-
 				}
 			}
 			catch (EofException e)
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/server/nio/SelectChannelConnector.java
--- a/src/org/eclipse/jetty/server/nio/SelectChannelConnector.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/server/nio/SelectChannelConnector.java	Sat Oct 22 20:56:41 2016 -0600
@@ -34,6 +34,7 @@
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.AbstractHttpConnection;
 
 /* ------------------------------------------------------------------------------- */
 /**
@@ -78,10 +79,9 @@
 	}
 
 	@Override
-	public void customize(EndPoint endpoint, Request request) throws IOException
+	public void customize(AbstractHttpConnection con) throws IOException
 	{
-		request.setTimeStamp(System.currentTimeMillis());
-		endpoint.setMaxIdleTime(_maxIdleTime);
+		con._endp.setMaxIdleTime(_maxIdleTime);
 	}
 
 	@Override
diff -r 32d4b569567c -r 39154cfa58e4 src/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java
--- a/src/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java	Wed Oct 19 04:22:51 2016 -0600
+++ b/src/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java	Sat Oct 22 20:56:41 2016 -0600
@@ -38,6 +38,7 @@
 import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.AbstractHttpConnection;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
 import org.eclipse.jetty.util.component.AggregateLifeCycle;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
@@ -101,16 +102,16 @@
 	 *                HttpRequest to be customised.
 	 */
 	@Override
-	public void customize(EndPoint endpoint, Request request) throws IOException
+	public void customize(AbstractHttpConnection con) throws IOException
 	{
-		request.setScheme(HttpSchemes.HTTPS);
-		super.customize(endpoint,request);
+		con._request.setScheme(HttpSchemes.HTTPS);
+		super.customize(con);
 
-		SslConnection.SslEndPoint sslEndpoint=(SslConnection.SslEndPoint)endpoint;
-		SSLEngine sslEngine=sslEndpoint.getSslEngine();
-		SSLSession sslSession=sslEngine.getSession();
+		SslConnection.SslEndPoint sslEndpoint=(SslConnection.SslEndPoint)con._endp;
+		SSLEngine sslEngine = sslEndpoint.getSslEngine();
+		SSLSession sslSession = sslEngine.getSession();
 
-		SslCertificates.customize(sslSession,endpoint,request);
+		SslCertificates.customize(sslSession,con._endp,con._request);
 	}
 
 	/* ------------------------------------------------------------ */