Fixes 310467 (Allow SocketConnector to create generic Connection objects).
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1561 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
fd9b4b8ae9
commit
53b2e8d6c1
|
@ -1,5 +1,4 @@
|
|||
|
||||
jetty-7.1-SNAPSHOT
|
||||
jetty-7.1.0-SNAPSHOT
|
||||
+ 294563 Websocket client connection
|
||||
+ 297104 Improve handling of CONNECT method
|
||||
+ 306349 ProxyServlet does not work unless deployed at /
|
||||
|
@ -7,7 +6,7 @@ jetty-7.1-SNAPSHOT
|
|||
+ 307847 Fixed combining mime type parameters
|
||||
+ 307898 Handle large/async websocket messages
|
||||
+ 308009 ObjectMBean incorrectly casts getTargetException() to Exception
|
||||
+ 308420 convert jetty-plus.xml to use DeploymentManager
|
||||
+ 308420 convert jetty-plus.xml to use DeploymentManager
|
||||
+ 308925 Protect the test webapp from remote access
|
||||
+ 309466 Removed synchronization from StdErrLog
|
||||
+ 309765 Added JSP module
|
||||
|
@ -18,6 +17,7 @@ jetty-7.1-SNAPSHOT
|
|||
+ JETTY-1202 Use platform default algorithm for SecureRandom
|
||||
+ Fix jetty-plus.xml reference to addLifeCycle
|
||||
+ Add AnnotationConfiguration to jetty-plus.xml
|
||||
+ 310467 Allow SocketConnector to create generic Connection objects
|
||||
|
||||
jetty-7.0.2.v20100331 31 March 2010
|
||||
+ 297552 Don't call Continuation timeouts from acceptor tick
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
// The Eclipse Public License is available at
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
|
||||
package org.eclipse.jetty.server.bio;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -39,21 +39,21 @@ import org.eclipse.jetty.util.log.Log;
|
|||
* This connector implements a traditional blocking IO and threading model.
|
||||
* Normal JRE sockets are used and a thread is allocated per connection.
|
||||
* Buffers are managed so that large buffers are only allocated to active connections.
|
||||
*
|
||||
*
|
||||
* This Connector should only be used if NIO is not available.
|
||||
*
|
||||
*
|
||||
* @org.apache.xbean.XBean element="bioConnector" description="Creates a BIO based socket connector"
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SocketConnector extends AbstractConnector
|
||||
{
|
||||
protected ServerSocket _serverSocket;
|
||||
protected final Set<EndPoint> _connections;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Constructor.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public SocketConnector()
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ public class SocketConnector extends AbstractConnector
|
|||
{
|
||||
return _serverSocket;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void open() throws IOException
|
||||
{
|
||||
|
@ -81,10 +81,10 @@ public class SocketConnector extends AbstractConnector
|
|||
ServerSocket ss= host==null?
|
||||
new ServerSocket(port,backlog):
|
||||
new ServerSocket(port,backlog,InetAddress.getByName(host));
|
||||
|
||||
|
||||
return ss;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void close() throws IOException
|
||||
{
|
||||
|
@ -97,10 +97,10 @@ public class SocketConnector extends AbstractConnector
|
|||
@Override
|
||||
public void accept(int acceptorID)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
{
|
||||
Socket socket = _serverSocket.accept();
|
||||
configure(socket);
|
||||
|
||||
|
||||
ConnectorEndPoint connection=new ConnectorEndPoint(socket);
|
||||
connection.dispatch();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class SocketConnector extends AbstractConnector
|
|||
/**
|
||||
* Allows subclass to override Conection if required.
|
||||
*/
|
||||
protected HttpConnection newHttpConnection(EndPoint endpoint)
|
||||
protected Connection newConnection(EndPoint endpoint)
|
||||
{
|
||||
return new HttpConnection(this, endpoint, getServer());
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class SocketConnector extends AbstractConnector
|
|||
connection._sotimeout=lrmit;
|
||||
((Socket)endpoint.getTransport()).setSoTimeout(lrmit);
|
||||
}
|
||||
|
||||
|
||||
super.customize(endpoint, request);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class SocketConnector extends AbstractConnector
|
|||
{
|
||||
set= new HashSet(_connections);
|
||||
}
|
||||
|
||||
|
||||
Iterator iter=set.iterator();
|
||||
while(iter.hasNext())
|
||||
{
|
||||
|
@ -175,11 +175,11 @@ public class SocketConnector extends AbstractConnector
|
|||
volatile Connection _connection;
|
||||
int _sotimeout;
|
||||
protected final Socket _socket;
|
||||
|
||||
|
||||
public ConnectorEndPoint(Socket socket) throws IOException
|
||||
{
|
||||
super(socket);
|
||||
_connection = newHttpConnection(this);
|
||||
_connection = newConnection(this);
|
||||
_sotimeout=socket.getSoTimeout();
|
||||
_socket=socket;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class SocketConnector extends AbstractConnector
|
|||
connectionUpgraded(_connection,connection);
|
||||
_connection=connection;
|
||||
}
|
||||
|
||||
|
||||
public void dispatch() throws IOException
|
||||
{
|
||||
if (getThreadPool()==null || !getThreadPool().dispatch(this))
|
||||
|
@ -204,7 +204,7 @@ public class SocketConnector extends AbstractConnector
|
|||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int fill(Buffer buffer) throws IOException
|
||||
{
|
||||
|
@ -212,8 +212,8 @@ public class SocketConnector extends AbstractConnector
|
|||
if (l<0)
|
||||
close();
|
||||
return l;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ public class SocketConnector extends AbstractConnector
|
|||
{
|
||||
_connections.add(this);
|
||||
}
|
||||
|
||||
|
||||
while (isStarted() && !isClosed())
|
||||
{
|
||||
if (_connection.isIdle())
|
||||
|
@ -245,7 +245,7 @@ public class SocketConnector extends AbstractConnector
|
|||
_socket.setSoTimeout(_sotimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_connection=_connection.handle();
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class SocketConnector extends AbstractConnector
|
|||
catch(IOException e2){Log.ignore(e2);}
|
||||
}
|
||||
finally
|
||||
{
|
||||
{
|
||||
connectionClosed(_connection);
|
||||
synchronized(_connections)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue