Author: ron.sigal(a)jboss.com
Date: 2008-10-27 22:00:55 -0400 (Mon, 27 Oct 2008)
New Revision: 4628
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1046: Restored default behavior for InputStream == null and added optional behavior
when new variable unmarshalNullStream == false.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-25
06:40:19 UTC (rev 4627)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-28
02:00:55 UTC (rev 4628)
@@ -101,10 +101,17 @@
*/
public static final String NUMBER_OF_CALL_ATTEMPTS =
"numberOfCallAttempts";
+ /*
+ * Specifies whether useHttpURLConnection(), upon receiving a null InputStream or
ErrorStream,
+ * should call the UnMarshaller.
+ */
+ public static final String UNMARSHAL_NULL_STREAM = "unmarshalNullStream";
+
protected static final Logger log = Logger.getLogger(HTTPClientInvoker.class);
protected boolean noThrowOnError;
protected int numberOfCallAttempts = 1;
+ protected boolean unmarshalNullStream = true;
private Object timeoutThreadPoolLock = new Object();
private ThreadPool timeoutThreadPool;
@@ -354,7 +361,7 @@
metadata.put(HTTPMetadataConstants.RESPONSE_HEADERS, headers);
InputStream is = (responseCode < 400) ? conn.getInputStream() :
conn.getErrorStream();
- if (is != null)
+ if (is != null || unmarshalNullStream)
{
result = readResponse(metadata, headers, unmarshaller, is);
}
@@ -370,7 +377,7 @@
InputStream is = (SecurityUtility.getResponseCode(conn) < 400) ?
conn.getInputStream() : conn.getErrorStream();
Map headers = conn.getHeaderFields();
- if (is != null)
+ if (is != null || unmarshalNullStream)
{
result = readResponse(null, headers, unmarshaller, is);
}
@@ -1007,6 +1014,22 @@
val + " to an int value.");
}
}
+
+ val = configuration.get(UNMARSHAL_NULL_STREAM);
+ if (val != null)
+ {
+ try
+ {
+ unmarshalNullStream = Boolean.valueOf((String)val).booleanValue();
+ log.debug(this + " setting unmarshalNullStream to " +
unmarshalNullStream);
+ }
+ catch (Exception e)
+ {
+ log.warn(this + " could not convert " +
+ UNMARSHAL_NULL_STREAM + " value of " +
+ val + " to a boolean value.");
+ }
+ }
}
/**
Show replies by date