Author: ron.sigal(a)jboss.com
Date: 2010-12-24 19:11:21 -0500 (Fri, 24 Dec 2010)
New Revision: 6193
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1248: Added ignoreErrorResponseMessage variable.
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 2010-12-24
19:26:38 UTC (rev 6192)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2010-12-25
00:11:21 UTC (rev 6193)
@@ -110,12 +110,19 @@
*/
public static final String UNMARSHAL_NULL_STREAM = "unmarshalNullStream";
+ /**
+ * Specifies whether useHttpURLConnection() should try to get a response message and
response
+ * code in the event of an exception.
+ */
+ public static final String IGNORE_ERROR_RESPONSE_MESSAGE =
"ignoreErrorResponseMessage";
+
protected static final Logger log = Logger.getLogger(HTTPClientInvoker.class);
protected boolean noThrowOnError;
protected int numberOfCallAttempts = 1;
protected boolean unmarshalNullStream = true;
protected boolean useRemotingContentType = false;
+ protected boolean ignoreErrorResponseMessage = false;
private Object timeoutThreadPoolLock = new Object();
private ThreadPool timeoutThreadPool;
@@ -414,17 +421,20 @@
String message = "Can not connect http client invoker.";
if (e.getMessage() != null)
message += " " + e.getMessage() + ".";
-
- try
+
+ if (!ignoreErrorResponseMessage)
{
- String responseMessage = getResponseMessage(conn);
- int code = getResponseCode(conn);
- message += " Response: " + responseMessage + "/" + code +
".";
+ try
+ {
+ String responseMessage = getResponseMessage(conn);
+ int code = getResponseCode(conn);
+ message += " Response: " + responseMessage + "/" +
code + ".";
+ }
+ catch (IOException e1)
+ {
+ log.debug("Unable to retrieve response message", e1);
+ }
}
- catch (IOException e1)
- {
- log.debug("Unable to retrieve response message", e1);
- }
throw new CannotConnectException(message, e);
}
@@ -1074,6 +1084,22 @@
val + " to a boolean value.");
}
}
+
+ val = configuration.get(IGNORE_ERROR_RESPONSE_MESSAGE);
+ if (val != null)
+ {
+ try
+ {
+ ignoreErrorResponseMessage = Boolean.valueOf((String)val).booleanValue();
+ log.debug(this + " setting ignoreErrorResponseMessage to " +
ignoreErrorResponseMessage);
+ }
+ catch (Exception e)
+ {
+ log.warn(this + " could not convert " +
+ IGNORE_ERROR_RESPONSE_MESSAGE + " value of " +
+ val + " to a boolean value.");
+ }
+ }
}
/**
Show replies by date