COMETD-46 reset ContentExchange response content on resend
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1155 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
caf4735792
commit
87c21752a0
|
@ -5,6 +5,7 @@ jetty-7.0.2-SNAPSHOT
|
|||
+ 297421 Hide server/system classes from WebAppClassLoader.getResources
|
||||
+ JETTY-1156 SSL blocking close with JVM Bug busy key fix
|
||||
+ JETTY-1157 Don't hold array passed in write(byte[])
|
||||
+ COMETD-46 reset ContentExchange response content on resend
|
||||
|
||||
jetty-7.0.1.v20091125 25 November 2009
|
||||
+ 274251 DefaultServlet supports exact match mode.
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.jetty.util.StringUtil;
|
|||
*/
|
||||
public class ContentExchange extends CachedExchange
|
||||
{
|
||||
private int _contentLength = 1024;
|
||||
private int _bufferSize = 4096;
|
||||
private String _encoding = "utf-8";
|
||||
private ByteArrayOutputStream _responseContent;
|
||||
private File _fileForUpload;
|
||||
|
@ -59,6 +59,14 @@ public class ContentExchange extends CachedExchange
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException
|
||||
{
|
||||
if (_responseContent!=null)
|
||||
_responseContent.reset();
|
||||
super.onResponseStatus(version,status,reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResponseHeader(Buffer name, Buffer value) throws IOException
|
||||
{
|
||||
|
@ -67,7 +75,7 @@ public class ContentExchange extends CachedExchange
|
|||
switch (header)
|
||||
{
|
||||
case HttpHeaders.CONTENT_LENGTH_ORDINAL:
|
||||
_contentLength = BufferUtil.toInt(value);
|
||||
_bufferSize = BufferUtil.toInt(value);
|
||||
break;
|
||||
case HttpHeaders.CONTENT_TYPE_ORDINAL:
|
||||
String mime = StringUtil.asciiToLowerCase(value.toString());
|
||||
|
@ -83,7 +91,7 @@ public class ContentExchange extends CachedExchange
|
|||
{
|
||||
super.onResponseContent(content);
|
||||
if (_responseContent == null)
|
||||
_responseContent = new ByteArrayOutputStream(_contentLength);
|
||||
_responseContent = new ByteArrayOutputStream(_bufferSize);
|
||||
content.writeTo(_responseContent);
|
||||
}
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@ public class HttpExchange
|
|||
switch (newStatus)
|
||||
{
|
||||
case STATUS_START:
|
||||
case STATUS_EXCEPTED:
|
||||
set=_status.compareAndSet(oldStatus,newStatus);
|
||||
break;
|
||||
case STATUS_CANCELLING:
|
||||
|
|
Loading…
Reference in New Issue