337685 use abstract connector. more debugging output

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2927 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-03-30 03:43:33 +00:00
parent 804f8eef3e
commit 7ebc5c380b
5 changed files with 17 additions and 21 deletions

View File

@ -92,7 +92,7 @@ public class Ajp13Generator extends AbstractGenerator
private static final byte[] AJP13_MORE_CONTENT =
{ 'A', 'B', 0, 3, 6, 31, -7 };
private static String SERVER = "Server: Jetty(6.0.x)";
private static String SERVER = "Server: Jetty(7.x.x)";
public static void setServerVersion(String version)
{

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.http.HttpSchemes;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.LifeCycle;
@ -746,7 +747,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
if (dot > 0)
name = name.substring(dot + 1);
return name + "@" + (getHost() == null?"0.0.0.0":getHost()) + ":" + (getLocalPort() <= 0?getPort():getLocalPort());
return name + "@" + (getHost() == null?"0.0.0.0":getHost()) + ":" + (getLocalPort() <= 0?getPort():getLocalPort()) + " "+AbstractLifeCycle.getState(this);
}

View File

@ -283,7 +283,7 @@ public class Dispatcher implements RequestDispatcher
_contextHandler.handle(_path,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
if (baseRequest.getConnection().getResponse().isWriting())
if (baseRequest.getResponse().isWriting())
{
try {response.getWriter().close();}
catch(IllegalStateException e)

View File

@ -39,6 +39,7 @@ import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.http.HttpVersions;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.http.Parser;
import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.AsyncEndPoint;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.BufferCache.CachedBuffer;
@ -87,7 +88,7 @@ import org.eclipse.jetty.util.thread.Timeout;
* </p>
*
*/
public class HttpConnection /* TODO extends AbstractConnection*/ implements Connection
public class HttpConnection extends AbstractConnection implements Connection
{
private static final int UNKNOWN = -2;
private static final ThreadLocal<HttpConnection> __currentConnection = new ThreadLocal<HttpConnection>();
@ -142,9 +143,7 @@ public class HttpConnection /* TODO extends AbstractConnection*/ implements Conn
*/
public HttpConnection(Connector connector, EndPoint endpoint, Server server)
{
_endp=endpoint;
_timeStamp = System.currentTimeMillis();
super(endpoint);
_uri = StringUtil.__UTF8.equals(URIUtil.__CHARSET)?new HttpURI():new EncodedHttpURI(URIUtil.__CHARSET);
_connector = connector;
HttpBuffers ab = (HttpBuffers)_connector;
@ -162,8 +161,7 @@ public class HttpConnection /* TODO extends AbstractConnection*/ implements Conn
protected HttpConnection(Connector connector, EndPoint endpoint, Server server,
Parser parser, Generator generator, Request request)
{
_endp=endpoint;
_timeStamp = System.currentTimeMillis();
super(endpoint);
_uri = URIUtil.__CHARSET.equals(StringUtil.__UTF8)?new HttpURI():new EncodedHttpURI(URIUtil.__CHARSET);
_connector = connector;
@ -1282,16 +1280,4 @@ public class HttpConnection /* TODO extends AbstractConnection*/ implements Conn
}
// TODO remove and use AbstractConnection for 7.4
private final long _timeStamp;
protected final EndPoint _endp;
public long getTimeStamp()
{
return _timeStamp;
}
public EndPoint getEndPoint()
{
return _endp;
}
}

View File

@ -145,6 +145,15 @@ public abstract class AbstractLifeCycle implements LifeCycle
}
return null;
}
public static String getState(LifeCycle lc)
{
if (lc.isStarting()) return STARTING;
if (lc.isStarted()) return STARTED;
if (lc.isStopping()) return STOPPING;
if (lc.isStopped()) return STOPPED;
return FAILED;
}
private void setStarted()
{