Author: ron.sigal(a)jboss.com
Date: 2009-08-26 15:39:29 -0400 (Wed, 26 Aug 2009)
New Revision: 5389
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1145: Made use of new content type test optional.
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 2009-08-26
19:38:14 UTC (rev 5388)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2009-08-26
19:39:29 UTC (rev 5389)
@@ -115,6 +115,7 @@
protected boolean noThrowOnError;
protected int numberOfCallAttempts = 1;
protected boolean unmarshalNullStream = true;
+ protected boolean useRemotingContentType = false;
private Object timeoutThreadPoolLock = new Object();
private ThreadPool timeoutThreadPool;
@@ -318,6 +319,8 @@
{
conn.setRequestProperty(HTTPMetadataConstants.CONTENTTYPE,
WebUtil.getContentType(invocation));
}
+
+ metadata.put(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE,
Boolean.toString(useRemotingContentType));
// set the remoting version
conn.setRequestProperty(HTTPMetadataConstants.REMOTING_VERSION_HEADER, new
Integer(getVersion()).toString());
@@ -560,7 +563,7 @@
unmarshaller = new
CompressingUnMarshaller(MarshalFactory.getUnMarshaller(SerializableUnMarshaller.DATATYPE));
}
- Map map = metadata == null ? headers : metadata;
+ Map map = metadata == null ? new HashMap(headers) : metadata;
// UnMarshaller may not be an HTTPUnMarshaller, in which case it
// can ignore this parameter.
@@ -571,6 +574,8 @@
map.put(HTTPUnMarshaller.PRESERVE_LINES, o);
}
+ map.put(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE,
Boolean.toString(useRemotingContentType));
+
try
{
if (unmarshaller instanceof VersionedUnMarshaller)
@@ -584,6 +589,7 @@
}
catch (IOException e)
{
+ log.trace(this + " unable to read response", e);
if (-1 == is.read())
{
throw new EOFException();
@@ -1052,6 +1058,22 @@
val + " to a boolean value.");
}
}
+
+ val = configuration.get(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE);
+ if (val != null)
+ {
+ try
+ {
+ useRemotingContentType = Boolean.valueOf((String)val).booleanValue();
+ log.debug(this + " setting useRemotingContent to " +
useRemotingContentType);
+ }
+ catch (Exception e)
+ {
+ log.warn(this + " could not convert " +
+ HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE + " value of
" +
+ val + " to a boolean value.");
+ }
+ }
}
/**
Show replies by date