Merge remote-tracking branch 'origin/master' into jetty-9.1

Conflicts:
	jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java
This commit is contained in:
Greg Wilkins 2013-10-28 10:22:16 +11:00
commit 4b87c4683d
1 changed files with 5 additions and 2 deletions

View File

@ -441,12 +441,14 @@ public class HttpOutput extends ServletOutputStream implements Runnable
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Blocking send of content. /** Blocking send of content.
* @param content The content to send * @param content The content to send.
* @throws IOException * @throws IOException
*/ */
public void sendContent(ByteBuffer content) throws IOException public void sendContent(ByteBuffer content) throws IOException
{ {
final BlockingCallback callback =_channel.getWriteBlockingCallback(); final BlockingCallback callback =_channel.getWriteBlockingCallback();
if (content.hasArray()&&content.limit()<content.capacity())
content=content.asReadOnlyBuffer();
_channel.write(content,true,callback); _channel.write(content,true,callback);
callback.block(); callback.block();
} }
@ -488,7 +490,6 @@ public class HttpOutput extends ServletOutputStream implements Runnable
callback.block(); callback.block();
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Asynchronous send of content. /** Asynchronous send of content.
* @param content The content to send * @param content The content to send
@ -496,6 +497,8 @@ public class HttpOutput extends ServletOutputStream implements Runnable
*/ */
public void sendContent(ByteBuffer content, final Callback callback) public void sendContent(ByteBuffer content, final Callback callback)
{ {
if (content.hasArray()&&content.limit()<content.capacity())
content=content.asReadOnlyBuffer();
_channel.write(content,true,new Callback() _channel.write(content,true,new Callback()
{ {
@Override @Override