336691 handle Views passed into flush
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2771 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
5b7e63510a
commit
5d2c3eee1b
|
@ -230,10 +230,46 @@ public class ChannelEndPoint implements EndPoint
|
||||||
header!=null && header.length()!=0 && buf0 instanceof NIOBuffer &&
|
header!=null && header.length()!=0 && buf0 instanceof NIOBuffer &&
|
||||||
buffer!=null && buffer.length()!=0 && buf1 instanceof NIOBuffer)
|
buffer!=null && buffer.length()!=0 && buf1 instanceof NIOBuffer)
|
||||||
{
|
{
|
||||||
final NIOBuffer nbuf0 = (NIOBuffer)buf0;
|
length = gatheringFlush(header,((NIOBuffer)buf0).getByteBuffer(),buffer,((NIOBuffer)buf1).getByteBuffer());
|
||||||
final ByteBuffer bbuf0=nbuf0.getByteBuffer();
|
}
|
||||||
final NIOBuffer nbuf1 = (NIOBuffer)buf1;
|
else
|
||||||
final ByteBuffer bbuf1=nbuf1.getByteBuffer();
|
{
|
||||||
|
if (header!=null)
|
||||||
|
{
|
||||||
|
if (buffer!=null && buffer.length()>0 && header.space()>buffer.length())
|
||||||
|
{
|
||||||
|
header.put(buffer);
|
||||||
|
buffer.clear();
|
||||||
|
}
|
||||||
|
if (trailer!=null && trailer.length()>0 && header.space()>trailer.length())
|
||||||
|
{
|
||||||
|
header.put(trailer);
|
||||||
|
trailer.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// flush header
|
||||||
|
if (header!=null && header.length()>0)
|
||||||
|
length=flush(header);
|
||||||
|
|
||||||
|
// flush buffer
|
||||||
|
if ((header==null || header.length()==0) &&
|
||||||
|
buffer!=null && buffer.length()>0)
|
||||||
|
length+=flush(buffer);
|
||||||
|
|
||||||
|
// flush trailer
|
||||||
|
if ((header==null || header.length()==0) &&
|
||||||
|
(buffer==null || buffer.length()==0) &&
|
||||||
|
trailer!=null && trailer.length()>0)
|
||||||
|
length+=flush(trailer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int gatheringFlush(Buffer header, ByteBuffer bbuf0, Buffer buffer, ByteBuffer bbuf1) throws IOException
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
|
||||||
synchronized(this)
|
synchronized(this)
|
||||||
{
|
{
|
||||||
|
@ -285,39 +321,6 @@ public class ChannelEndPoint implements EndPoint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (header!=null)
|
|
||||||
{
|
|
||||||
if (buffer!=null && buffer.length()>0 && header.space()>buffer.length())
|
|
||||||
{
|
|
||||||
header.put(buffer);
|
|
||||||
buffer.clear();
|
|
||||||
}
|
|
||||||
if (trailer!=null && trailer.length()>0 && header.space()>trailer.length())
|
|
||||||
{
|
|
||||||
header.put(trailer);
|
|
||||||
trailer.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// flush header
|
|
||||||
if (header!=null && header.length()>0)
|
|
||||||
length=flush(header);
|
|
||||||
|
|
||||||
// flush buffer
|
|
||||||
if ((header==null || header.length()==0) &&
|
|
||||||
buffer!=null && buffer.length()>0)
|
|
||||||
length+=flush(buffer);
|
|
||||||
|
|
||||||
// flush trailer
|
|
||||||
if ((header==null || header.length()==0) &&
|
|
||||||
(buffer==null || buffer.length()==0) &&
|
|
||||||
trailer!=null && trailer.length()>0)
|
|
||||||
length+=flush(trailer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.nio.channels.SelectionKey;
|
||||||
import java.nio.channels.ServerSocketChannel;
|
import java.nio.channels.ServerSocketChannel;
|
||||||
import java.nio.channels.SocketChannel;
|
import java.nio.channels.SocketChannel;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.continuation.Continuation;
|
import org.eclipse.jetty.continuation.Continuation;
|
||||||
import org.eclipse.jetty.io.ConnectedEndPoint;
|
import org.eclipse.jetty.io.ConnectedEndPoint;
|
||||||
|
@ -281,6 +280,11 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
return new SelectChannelEndPoint(channel,selectSet,key, SelectChannelConnector.this._maxIdleTime);
|
return new SelectChannelEndPoint(channel,selectSet,key, SelectChannelConnector.this._maxIdleTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void endPointClosed(SelectChannelEndPoint endpoint)
|
||||||
|
{
|
||||||
|
connectionClosed(endpoint.getConnection());
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
protected Connection newConnection(SocketChannel channel,final SelectChannelEndPoint endpoint)
|
protected Connection newConnection(SocketChannel channel,final SelectChannelEndPoint endpoint)
|
||||||
{
|
{
|
||||||
|
@ -327,7 +331,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
@Override
|
@Override
|
||||||
protected void endPointClosed(final SelectChannelEndPoint endpoint)
|
protected void endPointClosed(final SelectChannelEndPoint endpoint)
|
||||||
{
|
{
|
||||||
connectionClosed(endpoint.getConnection());
|
SelectChannelConnector.this.endPointClosed(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue