if (_arrayBuffer!=null)
{
if (_async)
{
final AsyncContext async = request.startAsync();
out.setWriteListener(new WriteListener()
{
@Override
public void onWritePossible() throws IOException
{
_owp.incrementAndGet();
while (out.isReady())
{
Assert.assertTrue(out.isReady());
int len=_content.remaining();
if (len>_arrayBuffer.length)
len=_arrayBuffer.length;
if (len==0)
{
async.complete();
break;
}
_content.get(_arrayBuffer,0,len);
if (len==1)
out.write(_arrayBuffer[0]);
else
out.write(_arrayBuffer,0,len);
}
// Assert.assertFalse(out.isReady());
}
@Override
public void onError(Throwable t)
{
t.printStackTrace();
async.complete();
}
});
return;
}
while(BufferUtil.hasContent(_content))
{
int len=_content.remaining();
if (len>_arrayBuffer.length)
len=_arrayBuffer.length;
_content.get(_arrayBuffer,0,len);
if (len==1)
out.write(_arrayBuffer[0]);
else
out.write(_arrayBuffer,0,len);
}
return;
}
if (_byteBuffer!=null)
{
if (_async)
{
final AsyncContext async = request.startAsync();
out.setWriteListener(new WriteListener()
{
@Override
public void onWritePossible() throws IOException
{
_owp.incrementAndGet();