Protected HttpParser from multiple entry.
This commit is contained in:
parent
75c4ec733d
commit
0e284f78f5
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.ajp;
|
package org.eclipse.jetty.ajp;
|
||||||
|
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
|
|
||||||
public class Ajp13Request extends Request
|
public class Ajp13Request extends Request
|
||||||
|
@ -24,7 +24,7 @@ public class Ajp13Request extends Request
|
||||||
protected boolean _sslSecure;
|
protected boolean _sslSecure;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public Ajp13Request(HttpConnection connection)
|
public Ajp13Request(AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
super(connection);
|
super(connection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.jetty.io.Buffers;
|
||||||
import org.eclipse.jetty.io.ByteArrayBuffer;
|
import org.eclipse.jetty.io.ByteArrayBuffer;
|
||||||
import org.eclipse.jetty.io.Connection;
|
import org.eclipse.jetty.io.Connection;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
|
import org.eclipse.jetty.io.EofException;
|
||||||
import org.eclipse.jetty.io.View;
|
import org.eclipse.jetty.io.View;
|
||||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||||
import org.eclipse.jetty.util.component.Dumpable;
|
import org.eclipse.jetty.util.component.Dumpable;
|
||||||
|
@ -394,7 +395,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen
|
||||||
String exch= exchange.toString();
|
String exch= exchange.toString();
|
||||||
String reason = _endp.isOpen()?(_endp.isInputShutdown()?"half closed: ":"local close: "):"closed: ";
|
String reason = _endp.isOpen()?(_endp.isInputShutdown()?"half closed: ":"local close: "):"closed: ";
|
||||||
exchange.setStatus(HttpExchange.STATUS_EXCEPTED);
|
exchange.setStatus(HttpExchange.STATUS_EXCEPTED);
|
||||||
exchange.getEventListener().onException(new EOFException(reason+exch));
|
exchange.getEventListener().onException(new EofException(reason+exch));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,13 +58,14 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
|
||||||
|
|
||||||
if (exchange == null)
|
if (exchange == null)
|
||||||
{
|
{
|
||||||
long filled = _parser.fill();
|
// TODO long filled = _parser.fill();
|
||||||
|
long filled = -1;
|
||||||
if (filled < 0)
|
if (filled < 0)
|
||||||
close();
|
close();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Hopefully just space?
|
// Hopefully just space?
|
||||||
_parser.skipCRLF();
|
// TODO _parser.skipCRLF();
|
||||||
if (_parser.isMoreInBuffer())
|
if (_parser.isMoreInBuffer())
|
||||||
{
|
{
|
||||||
LOG.warn("Unexpected data received but no request sent");
|
LOG.warn("Unexpected data received but no request sent");
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.io.Buffer;
|
import org.eclipse.jetty.io.Buffer;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
|
@ -320,7 +320,7 @@ public abstract class AbstractHttpExchangeCancelTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(true);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(true);
|
||||||
TestHttpExchange exchange = new TestHttpExchange();
|
TestHttpExchange exchange = new TestHttpExchange();
|
||||||
exchange.setAddress(newAddress());
|
exchange.setAddress(newAddress());
|
||||||
exchange.setRequestURI("/?action=throw");
|
exchange.setRequestURI("/?action=throw");
|
||||||
|
@ -335,7 +335,7 @@ public abstract class AbstractHttpExchangeCancelTest
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(false);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,12 +22,6 @@ public interface AsyncEndPoint extends EndPoint
|
||||||
*/
|
*/
|
||||||
public void asyncDispatch();
|
public void asyncDispatch();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if this endpoint can accept a dispatch. False if the
|
|
||||||
* endpoint cannot accept a dispatched (eg is suspended or already dispatched)
|
|
||||||
*/
|
|
||||||
public boolean isReadyForDispatch();
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/** Schedule a write dispatch.
|
/** Schedule a write dispatch.
|
||||||
* Set the endpoint to not be writable and schedule a dispatch when
|
* Set the endpoint to not be writable and schedule a dispatch when
|
||||||
|
|
|
@ -15,6 +15,13 @@ package org.eclipse.jetty.io;
|
||||||
|
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
/** A Jetty specialization of EOFException.
|
||||||
|
* <p> This is thrown by Jetty to distinguish between EOF received from
|
||||||
|
* the connection, vs and EOF thrown by some application talking to some other file/socket etc.
|
||||||
|
* The only difference in handling is that Jetty EOFs are logged less verbosely.
|
||||||
|
*/
|
||||||
public class EofException extends EOFException
|
public class EofException extends EOFException
|
||||||
{
|
{
|
||||||
public EofException()
|
public EofException()
|
||||||
|
|
|
@ -168,14 +168,6 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise if we are still dispatched
|
|
||||||
if (!isReadyForDispatch())
|
|
||||||
{
|
|
||||||
// we are not interested in further selecting
|
|
||||||
_key.interestOps(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove writeable op
|
// Remove writeable op
|
||||||
if ((_key.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE && (_key.interestOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE)
|
if ((_key.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE && (_key.interestOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE)
|
||||||
{
|
{
|
||||||
|
@ -336,16 +328,6 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public boolean isReadyForDispatch()
|
|
||||||
{
|
|
||||||
synchronized (this)
|
|
||||||
{
|
|
||||||
// Ready if not dispatched and not suspended
|
|
||||||
return !(_dispatched || getConnection().isSuspended());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/*
|
/*
|
||||||
* Allows thread to block waiting for further events.
|
* Allows thread to block waiting for further events.
|
||||||
|
@ -467,9 +449,11 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
||||||
{
|
{
|
||||||
if (getChannel().isOpen())
|
if (getChannel().isOpen())
|
||||||
{
|
{
|
||||||
|
boolean read_interest = _readBlocked || (!_dispatched && !_connection.isSuspended());
|
||||||
|
boolean write_interest= _writeBlocked || (!_dispatched && !_writable);
|
||||||
_interestOps =
|
_interestOps =
|
||||||
((!_socket.isInputShutdown() && (!_dispatched || _readBlocked)) ? SelectionKey.OP_READ : 0)
|
((!_socket.isInputShutdown() && read_interest ) ? SelectionKey.OP_READ : 0)
|
||||||
| ((!_socket.isOutputShutdown()&& (!_writable || _writeBlocked)) ? SelectionKey.OP_WRITE : 0);
|
| ((!_socket.isOutputShutdown()&& write_interest) ? SelectionKey.OP_WRITE : 0);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
current_ops = ((_key!=null && _key.isValid())?_key.interestOps():-1);
|
current_ops = ((_key!=null && _key.isValid())?_key.interestOps():-1);
|
||||||
|
@ -488,6 +472,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
||||||
_selectSet.wakeup();
|
_selectSet.wakeup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
import org.eclipse.jetty.http.PathMap;
|
import org.eclipse.jetty.http.PathMap;
|
||||||
import org.eclipse.jetty.http.security.Constraint;
|
import org.eclipse.jetty.http.security.Constraint;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Response;
|
import org.eclipse.jetty.server.Response;
|
||||||
import org.eclipse.jetty.server.UserIdentity;
|
import org.eclipse.jetty.server.UserIdentity;
|
||||||
|
@ -351,7 +351,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
HttpConnection connection = HttpConnection.getCurrentConnection();
|
AbstractHttpConnection connection = AbstractHttpConnection.getCurrentConnection();
|
||||||
Connector connector = connection.getConnector();
|
Connector connector = connection.getConnector();
|
||||||
|
|
||||||
if (dataConstraint == UserDataConstraint.Integral)
|
if (dataConstraint == UserDataConstraint.Integral)
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.jetty.security.ServerAuthException;
|
||||||
import org.eclipse.jetty.security.UserAuthentication;
|
import org.eclipse.jetty.security.UserAuthentication;
|
||||||
import org.eclipse.jetty.server.Authentication;
|
import org.eclipse.jetty.server.Authentication;
|
||||||
import org.eclipse.jetty.server.Authentication.User;
|
import org.eclipse.jetty.server.Authentication.User;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.UserIdentity;
|
import org.eclipse.jetty.server.UserIdentity;
|
||||||
import org.eclipse.jetty.util.MultiMap;
|
import org.eclipse.jetty.util.MultiMap;
|
||||||
|
@ -259,7 +259,7 @@ public class FormAuthenticator extends LoginAuthenticator
|
||||||
// so restore method and parameters
|
// so restore method and parameters
|
||||||
|
|
||||||
session.removeAttribute(__J_POST);
|
session.removeAttribute(__J_POST);
|
||||||
Request base_request = (req instanceof Request)?(Request)req:HttpConnection.getCurrentConnection().getRequest();
|
Request base_request = (req instanceof Request)?(Request)req:AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
base_request.setMethod(HttpMethods.POST);
|
base_request.setMethod(HttpMethods.POST);
|
||||||
base_request.setParameters(j_post);
|
base_request.setParameters(j_post);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ public class FormAuthenticator extends LoginAuthenticator
|
||||||
|
|
||||||
if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(req.getContentType()) && HttpMethods.POST.equals(request.getMethod()))
|
if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(req.getContentType()) && HttpMethods.POST.equals(request.getMethod()))
|
||||||
{
|
{
|
||||||
Request base_request = (req instanceof Request)?(Request)req:HttpConnection.getCurrentConnection().getRequest();
|
Request base_request = (req instanceof Request)?(Request)req:AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
base_request.extractParameters();
|
base_request.extractParameters();
|
||||||
session.setAttribute(__J_POST, new MultiMap<String>(base_request.getParameters()));
|
session.setAttribute(__J_POST, new MultiMap<String>(base_request.getParameters()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected void connectionUpgraded(Connection oldConnection, Connection newConnection)
|
protected void connectionUpgraded(Connection oldConnection, Connection newConnection)
|
||||||
{
|
{
|
||||||
_requestStats.set((oldConnection instanceof HttpConnection)?((HttpConnection)oldConnection).getRequests():0);
|
_requestStats.set((oldConnection instanceof AbstractHttpConnection)?((AbstractHttpConnection)oldConnection).getRequests():0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -1051,7 +1051,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||||
return;
|
return;
|
||||||
|
|
||||||
long duration = System.currentTimeMillis() - connection.getTimeStamp();
|
long duration = System.currentTimeMillis() - connection.getTimeStamp();
|
||||||
int requests = (connection instanceof HttpConnection)?((HttpConnection)connection).getRequests():0;
|
int requests = (connection instanceof AbstractHttpConnection)?((AbstractHttpConnection)connection).getRequests():0;
|
||||||
_requestStats.set(requests);
|
_requestStats.set(requests);
|
||||||
_connectionStats.decrement();
|
_connectionStats.decrement();
|
||||||
_connectionDurationStats.set(duration);
|
_connectionDurationStats.set(duration);
|
||||||
|
|
|
@ -88,12 +88,12 @@ import org.eclipse.jetty.util.thread.Timeout;
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class HttpConnection extends AbstractConnection
|
public abstract class AbstractHttpConnection extends AbstractConnection
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(HttpConnection.class);
|
private static final Logger LOG = Log.getLogger(AbstractHttpConnection.class);
|
||||||
|
|
||||||
private static final int UNKNOWN = -2;
|
private static final int UNKNOWN = -2;
|
||||||
private static final ThreadLocal<HttpConnection> __currentConnection = new ThreadLocal<HttpConnection>();
|
private static final ThreadLocal<AbstractHttpConnection> __currentConnection = new ThreadLocal<AbstractHttpConnection>();
|
||||||
|
|
||||||
private int _requests;
|
private int _requests;
|
||||||
|
|
||||||
|
@ -127,13 +127,13 @@ public abstract class HttpConnection extends AbstractConnection
|
||||||
private boolean _delayedHandling=false;
|
private boolean _delayedHandling=false;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public static HttpConnection getCurrentConnection()
|
public static AbstractHttpConnection getCurrentConnection()
|
||||||
{
|
{
|
||||||
return __currentConnection.get();
|
return __currentConnection.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected static void setCurrentConnection(HttpConnection connection)
|
protected static void setCurrentConnection(AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
__currentConnection.set(connection);
|
__currentConnection.set(connection);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ public abstract class HttpConnection extends AbstractConnection
|
||||||
/** Constructor
|
/** Constructor
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public HttpConnection(Connector connector, EndPoint endpoint, Server server)
|
public AbstractHttpConnection(Connector connector, EndPoint endpoint, Server server)
|
||||||
{
|
{
|
||||||
super(endpoint);
|
super(endpoint);
|
||||||
_uri = StringUtil.__UTF8.equals(URIUtil.__CHARSET)?new HttpURI():new EncodedHttpURI(URIUtil.__CHARSET);
|
_uri = StringUtil.__UTF8.equals(URIUtil.__CHARSET)?new HttpURI():new EncodedHttpURI(URIUtil.__CHARSET);
|
||||||
|
@ -159,7 +159,7 @@ public abstract class HttpConnection extends AbstractConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected HttpConnection(Connector connector, EndPoint endpoint, Server server,
|
protected AbstractHttpConnection(Connector connector, EndPoint endpoint, Server server,
|
||||||
Parser parser, Generator generator, Request request)
|
Parser parser, Generator generator, Request request)
|
||||||
{
|
{
|
||||||
super(endpoint);
|
super(endpoint);
|
||||||
|
@ -326,7 +326,7 @@ public abstract class HttpConnection extends AbstractConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_in == null)
|
if (_in == null)
|
||||||
_in = new HttpInput(HttpConnection.this);
|
_in = new HttpInput(AbstractHttpConnection.this);
|
||||||
return _in;
|
return _in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,6 +841,12 @@ public abstract class HttpConnection extends AbstractConnection
|
||||||
_responseFields.add(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.KEEP_ALIVE_BUFFER);
|
_responseFields.add(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.KEEP_ALIVE_BUFFER);
|
||||||
_generator.setPersistent(true);
|
_generator.setPersistent(true);
|
||||||
}
|
}
|
||||||
|
else if (HttpMethods.CONNECT.equals(_request.getMethod()))
|
||||||
|
{
|
||||||
|
_generator.setPersistent(true);
|
||||||
|
_parser.setPersistent(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (_server.getSendDateHeader())
|
if (_server.getSendDateHeader())
|
||||||
_generator.setDate(_request.getTimeStampBuffer());
|
_generator.setDate(_request.getTimeStampBuffer());
|
||||||
break;
|
break;
|
||||||
|
@ -943,7 +949,7 @@ public abstract class HttpConnection extends AbstractConnection
|
||||||
{
|
{
|
||||||
Output()
|
Output()
|
||||||
{
|
{
|
||||||
super(HttpConnection.this);
|
super(AbstractHttpConnection.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -1113,7 +1119,7 @@ public abstract class HttpConnection extends AbstractConnection
|
||||||
{
|
{
|
||||||
OutputWriter()
|
OutputWriter()
|
||||||
{
|
{
|
||||||
super(HttpConnection.this._out);
|
super(AbstractHttpConnection.this._out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected HttpConnection _connection;
|
protected AbstractHttpConnection _connection;
|
||||||
private List<ContinuationListener> _continuationListeners;
|
private List<ContinuationListener> _continuationListeners;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -90,7 +90,7 @@ public class AsyncContinuation implements AsyncContext, Continuation
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected void setConnection(final HttpConnection connection)
|
protected void setConnection(final AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
synchronized(this)
|
synchronized(this)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
|
||||||
public class AsyncHttpConnection extends HttpConnection implements AsyncConnection
|
public class AsyncHttpConnection extends AbstractHttpConnection implements AsyncConnection
|
||||||
{
|
{
|
||||||
private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",100);
|
private final static int NO_PROGRESS_INFO = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_INFO",100);
|
||||||
private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",200);
|
private final static int NO_PROGRESS_CLOSE = Integer.getInteger("org.mortbay.jetty.NO_PROGRESS_CLOSE",200);
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
|
||||||
public class BlockingHttpConnection extends HttpConnection
|
public class BlockingHttpConnection extends AbstractHttpConnection
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(BlockingHttpConnection.class);
|
private static final Logger LOG = Log.getLogger(BlockingHttpConnection.class);
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class Dispatcher implements RequestDispatcher
|
||||||
*/
|
*/
|
||||||
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException
|
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException
|
||||||
{
|
{
|
||||||
Request baseRequest=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
|
Request baseRequest=(request instanceof Request)?((Request)request):AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
request.removeAttribute(__JSP_FILE); // TODO remove when glassfish 1044 is fixed
|
request.removeAttribute(__JSP_FILE); // TODO remove when glassfish 1044 is fixed
|
||||||
|
|
||||||
if (!(request instanceof HttpServletRequest))
|
if (!(request instanceof HttpServletRequest))
|
||||||
|
@ -211,7 +211,7 @@ public class Dispatcher implements RequestDispatcher
|
||||||
*/
|
*/
|
||||||
protected void forward(ServletRequest request, ServletResponse response, DispatcherType dispatch) throws ServletException, IOException
|
protected void forward(ServletRequest request, ServletResponse response, DispatcherType dispatch) throws ServletException, IOException
|
||||||
{
|
{
|
||||||
Request baseRequest=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
|
Request baseRequest=(request instanceof Request)?((Request)request):AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
Response base_response=baseRequest.getResponse();
|
Response base_response=baseRequest.getResponse();
|
||||||
response.resetBuffer();
|
response.resetBuffer();
|
||||||
base_response.fwdReset();
|
base_response.fwdReset();
|
||||||
|
|
|
@ -47,10 +47,10 @@ public interface Handler extends LifeCycle, Destroyable
|
||||||
* @param target The target of the request - either a URI or a name.
|
* @param target The target of the request - either a URI or a name.
|
||||||
* @param baseRequest The original unwrapped request object.
|
* @param baseRequest The original unwrapped request object.
|
||||||
* @param request The request either as the {@link Request}
|
* @param request The request either as the {@link Request}
|
||||||
* object or a wrapper of that request. The {@link HttpConnection#getCurrentConnection()}
|
* object or a wrapper of that request. The {@link AbstractHttpConnection#getCurrentConnection()}
|
||||||
* method can be used access the Request object if required.
|
* method can be used access the Request object if required.
|
||||||
* @param response The response as the {@link Response}
|
* @param response The response as the {@link Response}
|
||||||
* object or a wrapper of that request. The {@link HttpConnection#getCurrentConnection()}
|
* object or a wrapper of that request. The {@link AbstractHttpConnection#getCurrentConnection()}
|
||||||
* method can be used access the Response object if required.
|
* method can be used access the Response object if required.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
|
|
|
@ -22,11 +22,11 @@ import org.eclipse.jetty.io.Buffer;
|
||||||
|
|
||||||
public class HttpInput extends ServletInputStream
|
public class HttpInput extends ServletInputStream
|
||||||
{
|
{
|
||||||
protected final HttpConnection _connection;
|
protected final AbstractHttpConnection _connection;
|
||||||
protected final HttpParser _parser;
|
protected final HttpParser _parser;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public HttpInput(HttpConnection connection)
|
public HttpInput(AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
_connection=connection;
|
_connection=connection;
|
||||||
_parser=(HttpParser)connection.getParser();
|
_parser=(HttpParser)connection.getParser();
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.jetty.util.ByteArrayOutputStream2;
|
||||||
*/
|
*/
|
||||||
public class HttpOutput extends ServletOutputStream
|
public class HttpOutput extends ServletOutputStream
|
||||||
{
|
{
|
||||||
protected final HttpConnection _connection;
|
protected final AbstractHttpConnection _connection;
|
||||||
protected final AbstractGenerator _generator;
|
protected final AbstractGenerator _generator;
|
||||||
private boolean _closed;
|
private boolean _closed;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class HttpOutput extends ServletOutputStream
|
||||||
ByteArrayOutputStream2 _bytes;
|
ByteArrayOutputStream2 _bytes;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public HttpOutput(HttpConnection connection)
|
public HttpOutput(AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
_connection=connection;
|
_connection=connection;
|
||||||
_generator=(AbstractGenerator)connection.getGenerator();
|
_generator=(AbstractGenerator)connection.getGenerator();
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class LocalConnector extends AbstractConnector
|
||||||
};
|
};
|
||||||
|
|
||||||
endPoint.setGrowOutput(true);
|
endPoint.setGrowOutput(true);
|
||||||
HttpConnection connection = new BlockingHttpConnection(LocalConnector.this, endPoint, getServer());
|
AbstractHttpConnection connection = new BlockingHttpConnection(LocalConnector.this, endPoint, getServer());
|
||||||
endPoint.setConnection(connection);
|
endPoint.setConnection(connection);
|
||||||
connectionOpened(connection);
|
connectionOpened(connection);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
* against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.</li>
|
* against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* A request instance is created for each {@link HttpConnection} accepted by the server
|
* A request instance is created for each {@link AbstractHttpConnection} accepted by the server
|
||||||
* and recycled for each HTTP request received via that connection. An effort is made
|
* and recycled for each HTTP request received via that connection. An effort is made
|
||||||
* to avoid reparsing headers and cookies that are likely to be the same for
|
* to avoid reparsing headers and cookies that are likely to be the same for
|
||||||
* requests from the same connection.
|
* requests from the same connection.
|
||||||
|
@ -116,7 +116,7 @@ public class Request implements HttpServletRequest
|
||||||
if (request instanceof Request)
|
if (request instanceof Request)
|
||||||
return (Request) request;
|
return (Request) request;
|
||||||
|
|
||||||
return HttpConnection.getCurrentConnection().getRequest();
|
return AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
}
|
}
|
||||||
protected final AsyncContinuation _async = new AsyncContinuation();
|
protected final AsyncContinuation _async = new AsyncContinuation();
|
||||||
private boolean _asyncSupported=true;
|
private boolean _asyncSupported=true;
|
||||||
|
@ -124,7 +124,7 @@ public class Request implements HttpServletRequest
|
||||||
private Authentication _authentication;
|
private Authentication _authentication;
|
||||||
private MultiMap<String> _baseParameters;
|
private MultiMap<String> _baseParameters;
|
||||||
private String _characterEncoding;
|
private String _characterEncoding;
|
||||||
protected HttpConnection _connection;
|
protected AbstractHttpConnection _connection;
|
||||||
private ContextHandler.Context _context;
|
private ContextHandler.Context _context;
|
||||||
private boolean _newContext;
|
private boolean _newContext;
|
||||||
private String _contextPath;
|
private String _contextPath;
|
||||||
|
@ -170,7 +170,7 @@ public class Request implements HttpServletRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public Request(HttpConnection connection)
|
public Request(AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
setConnection(connection);
|
setConnection(connection);
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ public class Request implements HttpServletRequest
|
||||||
/**
|
/**
|
||||||
* @return Returns the connection.
|
* @return Returns the connection.
|
||||||
*/
|
*/
|
||||||
public HttpConnection getConnection()
|
public AbstractHttpConnection getConnection()
|
||||||
{
|
{
|
||||||
return _connection;
|
return _connection;
|
||||||
}
|
}
|
||||||
|
@ -1466,7 +1466,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((HttpConnection.Output)getServletResponse().getOutputStream()).sendContent(value);
|
((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendContent(value);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
@ -1483,7 +1483,7 @@ public class Request implements HttpServletRequest
|
||||||
NIOBuffer buffer = byteBuffer.isDirect()
|
NIOBuffer buffer = byteBuffer.isDirect()
|
||||||
?new DirectNIOBuffer(byteBuffer,true)
|
?new DirectNIOBuffer(byteBuffer,true)
|
||||||
:new IndirectNIOBuffer(byteBuffer,true);
|
:new IndirectNIOBuffer(byteBuffer,true);
|
||||||
((HttpConnection.Output)getServletResponse().getOutputStream()).sendResponse(buffer);
|
((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendResponse(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
@ -1579,7 +1579,7 @@ public class Request implements HttpServletRequest
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
//final so we can safely call this from constructor
|
//final so we can safely call this from constructor
|
||||||
protected final void setConnection(HttpConnection connection)
|
protected final void setConnection(AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
_connection=connection;
|
_connection=connection;
|
||||||
_async.setConnection(connection);
|
_async.setConnection(connection);
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class Response implements HttpServletResponse
|
||||||
*/
|
*/
|
||||||
public final static String SET_INCLUDE_HEADER_PREFIX = "org.eclipse.jetty.server.include.";
|
public final static String SET_INCLUDE_HEADER_PREFIX = "org.eclipse.jetty.server.include.";
|
||||||
|
|
||||||
private final HttpConnection _connection;
|
private final AbstractHttpConnection _connection;
|
||||||
private int _status=SC_OK;
|
private int _status=SC_OK;
|
||||||
private String _reason;
|
private String _reason;
|
||||||
private Locale _locale;
|
private Locale _locale;
|
||||||
|
@ -81,7 +81,7 @@ public class Response implements HttpServletResponse
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public Response(HttpConnection connection)
|
public Response(AbstractHttpConnection connection)
|
||||||
{
|
{
|
||||||
_connection=connection;
|
_connection=connection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,7 +333,7 @@ public class Server extends HandlerWrapper implements Attributes
|
||||||
* or after the entire request has been received (for short requests of known length), or
|
* or after the entire request has been received (for short requests of known length), or
|
||||||
* on the dispatch of an async request.
|
* on the dispatch of an async request.
|
||||||
*/
|
*/
|
||||||
public void handle(HttpConnection connection) throws IOException, ServletException
|
public void handle(AbstractHttpConnection connection) throws IOException, ServletException
|
||||||
{
|
{
|
||||||
final String target=connection.getRequest().getPathInfo();
|
final String target=connection.getRequest().getPathInfo();
|
||||||
final Request request=connection.getRequest();
|
final Request request=connection.getRequest();
|
||||||
|
@ -355,7 +355,7 @@ public class Server extends HandlerWrapper implements Attributes
|
||||||
* or after the entire request has been received (for short requests of known length), or
|
* or after the entire request has been received (for short requests of known length), or
|
||||||
* on the dispatch of an async request.
|
* on the dispatch of an async request.
|
||||||
*/
|
*/
|
||||||
public void handleAsync(HttpConnection connection) throws IOException, ServletException
|
public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
|
||||||
{
|
{
|
||||||
final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
|
final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
|
||||||
final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
|
final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.eclipse.jetty.io.EofException;
|
||||||
import org.eclipse.jetty.io.bio.SocketEndPoint;
|
import org.eclipse.jetty.io.bio.SocketEndPoint;
|
||||||
import org.eclipse.jetty.server.AbstractConnector;
|
import org.eclipse.jetty.server.AbstractConnector;
|
||||||
import org.eclipse.jetty.server.BlockingHttpConnection;
|
import org.eclipse.jetty.server.BlockingHttpConnection;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
@ -219,8 +219,8 @@ public class SocketConnector extends AbstractConnector
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException
|
public void close() throws IOException
|
||||||
{
|
{
|
||||||
if (_connection instanceof HttpConnection)
|
if (_connection instanceof AbstractHttpConnection)
|
||||||
((HttpConnection)_connection).getRequest().getAsyncContinuation().cancel();
|
((AbstractHttpConnection)_connection).getRequest().getAsyncContinuation().cancel();
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.jetty.io.nio.IndirectNIOBuffer;
|
||||||
import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
|
import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
|
||||||
import org.eclipse.jetty.io.nio.SelectorManager;
|
import org.eclipse.jetty.io.nio.SelectorManager;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.util.HostMap;
|
import org.eclipse.jetty.util.HostMap;
|
||||||
|
@ -232,7 +232,7 @@ public class ConnectHandler extends HandlerWrapper
|
||||||
// 1. when this unread data is written and the server replies before the clientToProxy
|
// 1. when this unread data is written and the server replies before the clientToProxy
|
||||||
// connection is installed (it is only installed after returning from this method)
|
// connection is installed (it is only installed after returning from this method)
|
||||||
// 2. when the client sends data before this unread data has been written.
|
// 2. when the client sends data before this unread data has been written.
|
||||||
HttpConnection httpConnection = HttpConnection.getCurrentConnection();
|
AbstractHttpConnection httpConnection = AbstractHttpConnection.getCurrentConnection();
|
||||||
Buffer headerBuffer = ((HttpParser)httpConnection.getParser()).getHeaderBuffer();
|
Buffer headerBuffer = ((HttpParser)httpConnection.getParser()).getHeaderBuffer();
|
||||||
Buffer bodyBuffer = ((HttpParser)httpConnection.getParser()).getBodyBuffer();
|
Buffer bodyBuffer = ((HttpParser)httpConnection.getParser()).getBodyBuffer();
|
||||||
int length = headerBuffer == null ? 0 : headerBuffer.length();
|
int length = headerBuffer == null ? 0 : headerBuffer.length();
|
||||||
|
@ -272,7 +272,7 @@ public class ConnectHandler extends HandlerWrapper
|
||||||
|
|
||||||
private ClientToProxyConnection prepareConnections(ConcurrentMap<String, Object> context, SocketChannel channel, Buffer buffer)
|
private ClientToProxyConnection prepareConnections(ConcurrentMap<String, Object> context, SocketChannel channel, Buffer buffer)
|
||||||
{
|
{
|
||||||
HttpConnection httpConnection = HttpConnection.getCurrentConnection();
|
AbstractHttpConnection httpConnection = AbstractHttpConnection.getCurrentConnection();
|
||||||
ProxyToServerConnection proxyToServer = newProxyToServerConnection(context, buffer);
|
ProxyToServerConnection proxyToServer = newProxyToServerConnection(context, buffer);
|
||||||
ClientToProxyConnection clientToProxy = newClientToProxyConnection(context, channel, httpConnection.getEndPoint(), httpConnection.getTimeStamp());
|
ClientToProxyConnection clientToProxy = newClientToProxyConnection(context, channel, httpConnection.getEndPoint(), httpConnection.getTimeStamp());
|
||||||
clientToProxy.setConnection(proxyToServer);
|
clientToProxy.setConnection(proxyToServer);
|
||||||
|
|
|
@ -52,7 +52,7 @@ import org.eclipse.jetty.server.Dispatcher;
|
||||||
import org.eclipse.jetty.server.DispatcherType;
|
import org.eclipse.jetty.server.DispatcherType;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.HandlerContainer;
|
import org.eclipse.jetty.server.HandlerContainer;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.util.Attributes;
|
import org.eclipse.jetty.util.Attributes;
|
||||||
|
@ -754,7 +754,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
||||||
// Check the connector
|
// Check the connector
|
||||||
if (_connectors != null && _connectors.size() > 0)
|
if (_connectors != null && _connectors.size() > 0)
|
||||||
{
|
{
|
||||||
String connector = HttpConnection.getCurrentConnection().getConnector().getName();
|
String connector = AbstractHttpConnection.getCurrentConnection().getConnector().getName();
|
||||||
if (connector == null || !_connectors.contains(connector))
|
if (connector == null || !_connectors.contains(connector))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.jetty.http.HttpHeaders;
|
||||||
import org.eclipse.jetty.http.HttpMethods;
|
import org.eclipse.jetty.http.HttpMethods;
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
import org.eclipse.jetty.http.HttpStatus;
|
||||||
import org.eclipse.jetty.http.MimeTypes;
|
import org.eclipse.jetty.http.MimeTypes;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.util.ByteArrayISO8859Writer;
|
import org.eclipse.jetty.util.ByteArrayISO8859Writer;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ErrorHandler extends AbstractHandler
|
||||||
*/
|
*/
|
||||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||||
{
|
{
|
||||||
HttpConnection connection = HttpConnection.getCurrentConnection();
|
AbstractHttpConnection connection = AbstractHttpConnection.getCurrentConnection();
|
||||||
connection.getRequest().setHandled(true);
|
connection.getRequest().setHandled(true);
|
||||||
String method = request.getMethod();
|
String method = request.getMethod();
|
||||||
if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST) && !method.equals(HttpMethods.HEAD))
|
if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST) && !method.equals(HttpMethods.HEAD))
|
||||||
|
|
|
@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
import org.eclipse.jetty.http.HttpStatus;
|
||||||
import org.eclipse.jetty.http.PathMap;
|
import org.eclipse.jetty.http.PathMap;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.util.IPAddressMap;
|
import org.eclipse.jetty.util.IPAddressMap;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
|
@ -179,7 +179,7 @@ public class IPAccessHandler extends HandlerWrapper
|
||||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||||
{
|
{
|
||||||
// Get the real remote IP (not the one set by the forwarded headers (which may be forged))
|
// Get the real remote IP (not the one set by the forwarded headers (which may be forged))
|
||||||
HttpConnection connection = baseRequest.getConnection();
|
AbstractHttpConnection connection = baseRequest.getConnection();
|
||||||
if (connection!=null)
|
if (connection!=null)
|
||||||
{
|
{
|
||||||
EndPoint endp=connection.getEndPoint();
|
EndPoint endp=connection.getEndPoint();
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.jetty.io.Buffer;
|
||||||
import org.eclipse.jetty.io.ByteArrayBuffer;
|
import org.eclipse.jetty.io.ByteArrayBuffer;
|
||||||
import org.eclipse.jetty.io.WriterOutputStream;
|
import org.eclipse.jetty.io.WriterOutputStream;
|
||||||
import org.eclipse.jetty.server.Dispatcher;
|
import org.eclipse.jetty.server.Dispatcher;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Response;
|
import org.eclipse.jetty.server.Response;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler.Context;
|
import org.eclipse.jetty.server.handler.ContextHandler.Context;
|
||||||
|
@ -432,10 +432,10 @@ public class ResourceHandler extends AbstractHandler
|
||||||
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
|
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
|
||||||
|
|
||||||
// See if a short direct method can be used?
|
// See if a short direct method can be used?
|
||||||
if (out instanceof HttpConnection.Output)
|
if (out instanceof AbstractHttpConnection.Output)
|
||||||
{
|
{
|
||||||
// TODO file mapped buffers
|
// TODO file mapped buffers
|
||||||
((HttpConnection.Output)out).sendContent(resource.getInputStream());
|
((AbstractHttpConnection.Output)out).sendContent(resource.getInputStream());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.junit.Test;
|
||||||
/**
|
/**
|
||||||
* @version $Revision: 889 $ $Date: 2009-09-14 14:52:16 +1000 (Mon, 14 Sep 2009) $
|
* @version $Revision: 889 $ $Date: 2009-09-14 14:52:16 +1000 (Mon, 14 Sep 2009) $
|
||||||
*/
|
*/
|
||||||
public class AsyncUploadTest
|
public class AsyncRequestReadTest
|
||||||
{
|
{
|
||||||
private static Server server;
|
private static Server server;
|
||||||
private static Connector connector;
|
private static Connector connector;
|
||||||
|
@ -71,7 +71,6 @@ public class AsyncUploadTest
|
||||||
byte[] content = new byte[16*4096];
|
byte[] content = new byte[16*4096];
|
||||||
Arrays.fill(content, (byte)120);
|
Arrays.fill(content, (byte)120);
|
||||||
|
|
||||||
long start = System.nanoTime();
|
|
||||||
OutputStream out = socket.getOutputStream();
|
OutputStream out = socket.getOutputStream();
|
||||||
out.write("POST / HTTP/1.1\r\n".getBytes());
|
out.write("POST / HTTP/1.1\r\n".getBytes());
|
||||||
out.write("Host: localhost\r\n".getBytes());
|
out.write("Host: localhost\r\n".getBytes());
|
||||||
|
@ -93,7 +92,6 @@ public class AsyncUploadTest
|
||||||
String response = IO.toString(in);
|
String response = IO.toString(in);
|
||||||
assertTrue(response.indexOf("200 OK")>0);
|
assertTrue(response.indexOf("200 OK")>0);
|
||||||
|
|
||||||
long end = System.nanoTime();
|
|
||||||
assertEquals(content.length, total);
|
assertEquals(content.length, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +110,6 @@ public class AsyncUploadTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Thread.sleep(100);
|
|
||||||
InputStream in = request.getInputStream();
|
InputStream in = request.getInputStream();
|
||||||
byte[] b = new byte[4*4096];
|
byte[] b = new byte[4*4096];
|
||||||
int read;
|
int read;
|
|
@ -154,7 +154,7 @@ public class HttpConnectionTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(true);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(true);
|
||||||
|
|
||||||
String response;
|
String response;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public class HttpConnectionTest
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(false);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ public class HttpConnectionTest
|
||||||
Logger logger=null;
|
Logger logger=null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(true);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(true);
|
||||||
response=connector.getResponses(requests);
|
response=connector.getResponses(requests);
|
||||||
offset = checkContains(response,offset,"HTTP/1.1 500");
|
offset = checkContains(response,offset,"HTTP/1.1 500");
|
||||||
offset = checkContains(response,offset,"Connection: close");
|
offset = checkContains(response,offset,"Connection: close");
|
||||||
|
@ -343,7 +343,7 @@ public class HttpConnectionTest
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(false);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -931,7 +931,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
||||||
Socket client=newSocket(HOST,_connector.getLocalPort());
|
Socket client=newSocket(HOST,_connector.getLocalPort());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(true);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(true);
|
||||||
OutputStream os=client.getOutputStream();
|
OutputStream os=client.getOutputStream();
|
||||||
InputStream is=client.getInputStream();
|
InputStream is=client.getInputStream();
|
||||||
|
|
||||||
|
@ -959,7 +959,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLogger(HttpConnection.class)).setHideStacks(false);
|
((StdErrLog)Log.getLogger(AbstractHttpConnection.class)).setHideStacks(false);
|
||||||
|
|
||||||
if (!client.isClosed())
|
if (!client.isClosed())
|
||||||
client.close();
|
client.close();
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class HttpWriterTest
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpConnection connection = new HttpConnection(null,endp,new Server(),null,generator,null)
|
AbstractHttpConnection connection = new AbstractHttpConnection(null,endp,new Server(),null,generator,null)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Connection handle() throws IOException
|
public Connection handle() throws IOException
|
||||||
|
@ -169,7 +169,7 @@ public class HttpWriterTest
|
||||||
|
|
||||||
hb.setResponse(200,"OK");
|
hb.setResponse(200,"OK");
|
||||||
|
|
||||||
HttpConnection connection = new HttpConnection(null,endp,new Server(),null,hb,null)
|
AbstractHttpConnection connection = new AbstractHttpConnection(null,endp,new Server(),null,hb,null)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Connection handle() throws IOException
|
public Connection handle() throws IOException
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class ResponseTest
|
||||||
@Test
|
@Test
|
||||||
public void testContentType() throws Exception
|
public void testContentType() throws Exception
|
||||||
{
|
{
|
||||||
HttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
AbstractHttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
||||||
Response response = connection.getResponse();
|
Response response = connection.getResponse();
|
||||||
|
|
||||||
assertEquals(null,response.getContentType());
|
assertEquals(null,response.getContentType());
|
||||||
|
@ -134,7 +134,7 @@ public class ResponseTest
|
||||||
public void testLocale() throws Exception
|
public void testLocale() throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
HttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
AbstractHttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
||||||
Request request = connection.getRequest();
|
Request request = connection.getRequest();
|
||||||
Response response = connection.getResponse();
|
Response response = connection.getResponse();
|
||||||
ContextHandler context = new ContextHandler();
|
ContextHandler context = new ContextHandler();
|
||||||
|
@ -158,7 +158,7 @@ public class ResponseTest
|
||||||
@Test
|
@Test
|
||||||
public void testContentTypeCharacterEncoding() throws Exception
|
public void testContentTypeCharacterEncoding() throws Exception
|
||||||
{
|
{
|
||||||
HttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
AbstractHttpConnection connection = new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
||||||
|
|
||||||
Request request = connection.getRequest();
|
Request request = connection.getRequest();
|
||||||
Response response = connection.getResponse();
|
Response response = connection.getResponse();
|
||||||
|
@ -332,7 +332,7 @@ public class ResponseTest
|
||||||
public void testEncodeRedirect()
|
public void testEncodeRedirect()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
HttpConnection connection=new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
AbstractHttpConnection connection=new TestHttpConnection(connector,new ByteArrayEndPoint(), connector.getServer());
|
||||||
Response response = new Response(connection);
|
Response response = new Response(connection);
|
||||||
Request request = connection.getRequest();
|
Request request = connection.getRequest();
|
||||||
request.setServerName("myhost");
|
request.setServerName("myhost");
|
||||||
|
@ -397,7 +397,7 @@ public class ResponseTest
|
||||||
for (int i=1;i<tests.length;i++)
|
for (int i=1;i<tests.length;i++)
|
||||||
{
|
{
|
||||||
ByteArrayEndPoint out=new ByteArrayEndPoint(new byte[]{},4096);
|
ByteArrayEndPoint out=new ByteArrayEndPoint(new byte[]{},4096);
|
||||||
HttpConnection connection=new TestHttpConnection(connector,out, connector.getServer());
|
AbstractHttpConnection connection=new TestHttpConnection(connector,out, connector.getServer());
|
||||||
Response response = new Response(connection);
|
Response response = new Response(connection);
|
||||||
Request request = connection.getRequest();
|
Request request = connection.getRequest();
|
||||||
request.setServerName("myhost");
|
request.setServerName("myhost");
|
||||||
|
@ -491,9 +491,9 @@ public class ResponseTest
|
||||||
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
|
||||||
endPoint.setOut(new ByteArrayBuffer(1024));
|
endPoint.setOut(new ByteArrayBuffer(1024));
|
||||||
endPoint.setGrowOutput(true);
|
endPoint.setGrowOutput(true);
|
||||||
HttpConnection connection=new TestHttpConnection(connector, endPoint, connector.getServer());
|
AbstractHttpConnection connection=new TestHttpConnection(connector, endPoint, connector.getServer());
|
||||||
connection.getGenerator().reset();
|
connection.getGenerator().reset();
|
||||||
HttpConnection.setCurrentConnection(connection);
|
AbstractHttpConnection.setCurrentConnection(connection);
|
||||||
Response response = connection.getResponse();
|
Response response = connection.getResponse();
|
||||||
connection.getRequest().setRequestURI("/test");
|
connection.getRequest().setRequestURI("/test");
|
||||||
return response;
|
return response;
|
||||||
|
@ -593,7 +593,7 @@ public class ResponseTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class TestHttpConnection extends HttpConnection
|
static class TestHttpConnection extends AbstractHttpConnection
|
||||||
{
|
{
|
||||||
|
|
||||||
public TestHttpConnection(Connector connector, EndPoint endpoint, Server server)
|
public TestHttpConnection(Connector connector, EndPoint endpoint, Server server)
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.eclipse.jetty.io.ByteArrayBuffer;
|
||||||
import org.eclipse.jetty.io.WriterOutputStream;
|
import org.eclipse.jetty.io.WriterOutputStream;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
import org.eclipse.jetty.server.Dispatcher;
|
import org.eclipse.jetty.server.Dispatcher;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.HttpOutput;
|
import org.eclipse.jetty.server.HttpOutput;
|
||||||
import org.eclipse.jetty.server.InclusiveByteRange;
|
import org.eclipse.jetty.server.InclusiveByteRange;
|
||||||
import org.eclipse.jetty.server.ResourceCache;
|
import org.eclipse.jetty.server.ResourceCache;
|
||||||
|
@ -771,7 +771,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Connector connector = HttpConnection.getCurrentConnection().getConnector();
|
Connector connector = AbstractHttpConnection.getCurrentConnection().getConnector();
|
||||||
direct=connector instanceof NIOConnector && ((NIOConnector)connector).getUseDirectBuffers() && !(connector instanceof SslConnector);
|
direct=connector instanceof NIOConnector && ((NIOConnector)connector).getUseDirectBuffers() && !(connector instanceof SslConnector);
|
||||||
content_length=content.getContentLength();
|
content_length=content.getContentLength();
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
|
||||||
// has a filter already written to the response?
|
// has a filter already written to the response?
|
||||||
written = out instanceof HttpOutput
|
written = out instanceof HttpOutput
|
||||||
? ((HttpOutput)out).isWritten()
|
? ((HttpOutput)out).isWritten()
|
||||||
: HttpConnection.getCurrentConnection().getGenerator().isWritten();
|
: AbstractHttpConnection.getCurrentConnection().getGenerator().isWritten();
|
||||||
}
|
}
|
||||||
catch(IllegalStateException e)
|
catch(IllegalStateException e)
|
||||||
{
|
{
|
||||||
|
@ -810,7 +810,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
|
||||||
if (response instanceof Response)
|
if (response instanceof Response)
|
||||||
{
|
{
|
||||||
writeOptionHeaders(((Response)response).getHttpFields());
|
writeOptionHeaders(((Response)response).getHttpFields());
|
||||||
((HttpConnection.Output)out).sendContent(content);
|
((AbstractHttpConnection.Output)out).sendContent(content);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -818,7 +818,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
|
||||||
if (buffer!=null)
|
if (buffer!=null)
|
||||||
{
|
{
|
||||||
writeHeaders(response,content,content_length);
|
writeHeaders(response,content,content_length);
|
||||||
((HttpConnection.Output)out).sendContent(buffer);
|
((AbstractHttpConnection.Output)out).sendContent(buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpMethods;
|
import org.eclipse.jetty.http.HttpMethods;
|
||||||
import org.eclipse.jetty.server.Dispatcher;
|
import org.eclipse.jetty.server.Dispatcher;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||||
import org.eclipse.jetty.server.handler.ErrorHandler;
|
import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||||
|
@ -64,7 +64,7 @@ public class ErrorPageErrorHandler extends ErrorHandler
|
||||||
String method = request.getMethod();
|
String method = request.getMethod();
|
||||||
if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST) && !method.equals(HttpMethods.HEAD))
|
if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST) && !method.equals(HttpMethods.HEAD))
|
||||||
{
|
{
|
||||||
HttpConnection.getCurrentConnection().getRequest().setHandled(true);
|
AbstractHttpConnection.getCurrentConnection().getRequest().setHandled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_errorPages!=null)
|
if (_errorPages!=null)
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.server.Dispatcher;
|
import org.eclipse.jetty.server.Dispatcher;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||||
import org.eclipse.jetty.server.handler.HandlerWrapper;
|
import org.eclipse.jetty.server.handler.HandlerWrapper;
|
||||||
|
@ -219,7 +219,7 @@ public class Invoker extends HttpServlet
|
||||||
|
|
||||||
if (holder!=null)
|
if (holder!=null)
|
||||||
{
|
{
|
||||||
final Request baseRequest=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
|
final Request baseRequest=(request instanceof Request)?((Request)request):AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
holder.handle(baseRequest,
|
holder.handle(baseRequest,
|
||||||
new InvokedRequest(request,included,servlet,servlet_path,path_info),
|
new InvokedRequest(request,included,servlet,servlet_path,path_info),
|
||||||
response);
|
response);
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.eclipse.jetty.security.IdentityService;
|
||||||
import org.eclipse.jetty.security.SecurityHandler;
|
import org.eclipse.jetty.security.SecurityHandler;
|
||||||
import org.eclipse.jetty.server.Dispatcher;
|
import org.eclipse.jetty.server.Dispatcher;
|
||||||
import org.eclipse.jetty.server.DispatcherType;
|
import org.eclipse.jetty.server.DispatcherType;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.ServletRequestHttpWrapper;
|
import org.eclipse.jetty.server.ServletRequestHttpWrapper;
|
||||||
|
@ -1328,7 +1328,7 @@ public class ServletHandler extends ScopedHandler
|
||||||
filter.doFilter(request, response, _next);
|
filter.doFilter(request, response, _next);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final Request baseRequest=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
|
final Request baseRequest=(request instanceof Request)?((Request)request):AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
final boolean suspendable=baseRequest.isAsyncSupported();
|
final boolean suspendable=baseRequest.isAsyncSupported();
|
||||||
if (suspendable)
|
if (suspendable)
|
||||||
{
|
{
|
||||||
|
@ -1353,7 +1353,7 @@ public class ServletHandler extends ScopedHandler
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("call servlet " + _servletHolder);
|
LOG.debug("call servlet " + _servletHolder);
|
||||||
final Request baseRequest=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
|
final Request baseRequest=(request instanceof Request)?((Request)request):AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
_servletHolder.handle(baseRequest,request, response);
|
_servletHolder.handle(baseRequest,request, response);
|
||||||
}
|
}
|
||||||
else // Not found
|
else // Not found
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
@ -37,7 +37,7 @@ public class CloseableDoSFilter extends DoSFilter
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Request base_request=(request instanceof Request)?(Request)request:HttpConnection.getCurrentConnection().getRequest();
|
Request base_request=(request instanceof Request)?(Request)request:AbstractHttpConnection.getCurrentConnection().getRequest();
|
||||||
base_request.getConnection().getEndPoint().close();
|
base_request.getConnection().getEndPoint().close();
|
||||||
}
|
}
|
||||||
catch(IOException e)
|
catch(IOException e)
|
||||||
|
|
|
@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.eclipse.jetty.http.HttpException;
|
import org.eclipse.jetty.http.HttpException;
|
||||||
import org.eclipse.jetty.http.HttpParser;
|
import org.eclipse.jetty.http.HttpParser;
|
||||||
import org.eclipse.jetty.io.ConnectedEndPoint;
|
import org.eclipse.jetty.io.ConnectedEndPoint;
|
||||||
import org.eclipse.jetty.server.HttpConnection;
|
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||||
import org.eclipse.jetty.util.QuotedStringTokenizer;
|
import org.eclipse.jetty.util.QuotedStringTokenizer;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
@ -194,7 +194,7 @@ public class WebSocketFactory
|
||||||
int draft = request.getIntHeader("Sec-WebSocket-Version");
|
int draft = request.getIntHeader("Sec-WebSocket-Version");
|
||||||
if (draft < 0)
|
if (draft < 0)
|
||||||
draft = request.getIntHeader("Sec-WebSocket-Draft");
|
draft = request.getIntHeader("Sec-WebSocket-Draft");
|
||||||
HttpConnection http = HttpConnection.getCurrentConnection();
|
AbstractHttpConnection http = AbstractHttpConnection.getCurrentConnection();
|
||||||
ConnectedEndPoint endp = (ConnectedEndPoint)http.getEndPoint();
|
ConnectedEndPoint endp = (ConnectedEndPoint)http.getEndPoint();
|
||||||
|
|
||||||
List<String> extensions_requested = new ArrayList<String>();
|
List<String> extensions_requested = new ArrayList<String>();
|
||||||
|
|
Loading…
Reference in New Issue