Author: ron.sigal(a)jboss.com
Date: 2009-08-29 20:41:05 -0400 (Sat, 29 Aug 2009)
New Revision: 5403
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
Log:
JBREM-1145: Added useRemotingContentType variable and related processing.
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
===================================================================
---
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2009-08-30
00:40:18 UTC (rev 5402)
+++
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2009-08-30
00:41:05 UTC (rev 5403)
@@ -67,6 +67,7 @@
private boolean unwrapSingletonArrays;
private boolean createUniqueObjectName;
+ private boolean useRemotingContentType;
public ServletServerInvoker(InvokerLocator locator)
{
@@ -118,6 +119,17 @@
val + " to a boolean value.");
}
}
+
+ val = configuration.get(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE);
+ if (val instanceof String)
+ {
+ useRemotingContentType = Boolean.valueOf((String) val).booleanValue();
+ }
+ else if (val != null)
+ {
+ log.warn(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE + " value should
be a String: " + val);
+ }
+ log.debug(this + " useRemotingContentType: " + useRemotingContentType);
}
public String getMBeanObjectName()
@@ -328,6 +340,13 @@
if (path != null)
metadata.put(HTTPMetadataConstants.PATH, path);
+ metadata.put(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE,
Boolean.toString(useRemotingContentType));
+ String remotingContentType = (String)
metadata.get(HTTPMetadataConstants.REMOTING_CONTENT_TYPE);
+ if (remotingContentType == null)
+ {
+ remotingContentType = (String)
metadata.get(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_LC);
+ }
+
String requestContentType = request.getContentType();
@@ -369,7 +388,8 @@
}
else
{
- if(WebUtil.isBinary(requestContentType))
+ if((useRemotingContentType &&
HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING.equalsIgnoreCase(remotingContentType))
+ || (!useRemotingContentType &&
WebUtil.isBinary(requestContentType)))
{
invocationRequest = getInvocationRequest(metadata, obj);
}
@@ -471,7 +491,15 @@
retval = outputStream.toByteArray();
response.setContentLength(retval.length);
}
-
+
+ if (responseObject instanceof String)
+ {
+ response.addHeader(HTTPMetadataConstants.REMOTING_CONTENT_TYPE,
HTTPMetadataConstants.REMOTING_CONTENT_TYPE_STRING);
+ }
+ else
+ {
+ response.addHeader(HTTPMetadataConstants.REMOTING_CONTENT_TYPE,
HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING);
+ }
}
catch(ClassNotFoundException e)
{