Author: chris.laprun(a)jboss.com
Date: 2010-04-14 07:58:38 -0400 (Wed, 14 Apr 2010)
New Revision: 2631
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java
Log:
- GTNWSRP-24: If content length is unknown, use a default value for buffer size.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java 2010-04-14
11:16:14 UTC (rev 2630)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java 2010-04-14
11:58:38 UTC (rev 2631)
@@ -28,6 +28,7 @@
import org.gatein.common.net.media.MediaType;
import org.gatein.common.net.media.TypeDef;
import org.gatein.common.util.MultiValuedPropertyMap;
+import org.gatein.common.util.Tools;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.ResourceInvocation;
@@ -116,6 +117,8 @@
}
int length = urlConnection.getContentLength();
+ // if length is not known, use a default value
+ length = (length > 0 ? length : Tools.DEFAULT_BUFFER_SIZE * 8);
byte[] bytes = IOTools.getBytes(urlConnection.getInputStream(), length);
ContentResponse result;
Show replies by date