[jboss-svn-commits] JBL Code SVN: r26906 - labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/remoting.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jun 10 09:41:41 EDT 2009
Author: tfennelly
Date: 2009-06-10 09:41:41 -0400 (Wed, 10 Jun 2009)
New Revision: 26906
Modified:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2611
And found another related use case that needed to be covered.
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java 2009-06-10 13:30:35 UTC (rev 26905)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/remoting/HttpMarshaller.java 2009-06-10 13:41:41 UTC (rev 26906)
@@ -40,37 +40,42 @@
public class HttpMarshaller extends HTTPMarshaller {
public void write(Object object, OutputStream outputStream, int version) throws IOException {
- InvocationRequest currentRequest = JBossRemotingGatewayListener.getCurrentRequest();
- Map requestMetadata = currentRequest.getRequestPayload();
- Map responseMetadata = currentRequest.getReturnPayload();
- Object userAgentObj = requestMetadata.get(HTTPMetadataConstants.REMOTING_USER_AGENT);
- boolean isRemotingClient = false;
- boolean isBinaryResponse = false;
+ if(object instanceof InvocationResponse) {
+ Object result = ((InvocationResponse)object).getResult();
+ InvocationRequest currentRequest = JBossRemotingGatewayListener.getCurrentRequest();
+ boolean isRemotingClient = false;
+ boolean isBinaryResponse = false;
- if(userAgentObj != null) {
- isRemotingClient = ((String)userAgentObj).startsWith("JBossRemoting");
+ if(result != null && currentRequest != null) {
+ Map requestMetadata = currentRequest.getRequestPayload();
+ Map responseMetadata = currentRequest.getReturnPayload();
+ Object userAgentObj = requestMetadata.get(HTTPMetadataConstants.REMOTING_USER_AGENT);
- // In this case, assume non binary if the content type has not been set.
- // Will only kick in if the object is an InvocationResponse.
- if(JBossRemotingUtil.getContentType(responseMetadata) == null) {
- isBinaryResponse = true;
- } else {
- isBinaryResponse = JBossRemotingUtil.isBinaryPayload(responseMetadata);
+ if(userAgentObj != null) {
+ isRemotingClient = ((String)userAgentObj).startsWith("JBossRemoting");
+
+ // In this case, assume non binary if the content type has not been set.
+ // Will only kick in if the object is an InvocationResponse.
+ if(JBossRemotingUtil.getContentType(responseMetadata) == null) {
+ isBinaryResponse = true;
+ } else {
+ isBinaryResponse = JBossRemotingUtil.isBinaryPayload(responseMetadata);
+ }
+ }
}
- }
-
- if(isRemotingClient && !isBinaryResponse && object instanceof InvocationResponse) {
- // This block of code tries to work around a bug in JBoss Remoting, while at the same time
- // providing backward compatibility for earlier versions of the ESB. This code should not
- // have been present. See https://jira.jboss.org/jira/browse/JBESB-2611
- Object result = ((InvocationResponse)object).getResult();
-
- if(result instanceof byte[]) {
- outputStream.write((byte[])result);
- outputStream.flush();
+ if(isRemotingClient && !isBinaryResponse) {
+ // This block of code tries to work around a bug in JBoss Remoting, while at the same time
+ // providing backward compatibility for earlier versions of the ESB. This code should not
+ // have been present. See https://jira.jboss.org/jira/browse/JBESB-2611
+ if(result instanceof byte[]) {
+ outputStream.write((byte[])result);
+ outputStream.flush();
+ } else {
+ super.write(result, outputStream, version);
+ }
} else {
- super.write(result, outputStream, version);
+ super.write(object, outputStream, version);
}
} else {
if(object instanceof byte[]) {
More information about the jboss-svn-commits
mailing list