Author: ron.sigal(a)jboss.com
Date: 2010-12-25 00:08:12 -0500 (Sat, 25 Dec 2010)
New Revision: 6195
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1248: Added ignoreErrorResponseMessage variable.
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
---
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2010-12-25
00:12:09 UTC (rev 6194)
+++
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2010-12-25
05:08:12 UTC (rev 6195)
@@ -99,10 +99,17 @@
*/
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 unmarshalNullStream = true;
protected boolean useRemotingContentType = false;
+ protected boolean ignoreErrorResponseMessage = false;
private Object timeoutThreadPoolLock = new Object();
private ThreadPool timeoutThreadPool;
@@ -366,17 +373,20 @@
String message = "Can not connect http client invoker.";
if (e.getMessage() != null)
message += " " + e.getMessage() + ".";
-
- try
+
+ if (!ignoreErrorResponseMessage)
{
- String responseMessage = conn.getResponseMessage();
- int code = conn.getResponseCode();
- message += " Response: " + responseMessage + "/" + code +
".";
+ try
+ {
+ String responseMessage = conn.getResponseMessage();
+ int code = conn.getResponseCode();
+ 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);
}
@@ -958,6 +968,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