Author: hiranya
Date: Sun Jul 21 19:31:38 2013
New Revision: 1505454

URL: http://svn.apache.org/r1505454
Log:
Applying the patch for SYNAPSE-950. Handling the NO_ENTITY_BODY property in the 
pass thru http sender.

Modified:
    
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java

Modified: 
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java?rev=1505454&r1=1505453&r2=1505454&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java
 (original)
+++ 
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java
 Sun Jul 21 19:31:38 2013
@@ -508,12 +508,18 @@ public class PassThroughHttpSender exten
 
         ProtocolState state = SourceContext.getState(conn);
         if (state != null && state.compareTo(ProtocolState.REQUEST_DONE) <= 0) 
{
-            // start sending the response if we
-            if 
(msgContext.isPropertyTrue(PassThroughConstants.MESSAGE_BUILDER_INVOKED) && 
pipe != null) {
+            // start sending the response
+            if (noEntityBody != null && Boolean.TRUE == noEntityBody && pipe 
!= null) {
+                OutputStream out = pipe.getOutputStream();
+                out.write(new byte[0]);
+                pipe.setRawSerializationComplete(true);
+                out.close();
+            } else if 
(msgContext.isPropertyTrue(PassThroughConstants.MESSAGE_BUILDER_INVOKED) &&
+                    pipe != null) {
                 OutputStream out = pipe.getOutputStream();
                 if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED)) {
                     out.write(new byte[0]);
-                }else {
+                } else {
                     MessageFormatter formatter = 
MessageProcessorSelector.getMessageFormatter(msgContext);
                     OMOutputFormat format = 
PassThroughTransportUtils.getOMOutputFormat(msgContext);
                     formatter.writeTo(msgContext, format, out, false);
@@ -521,13 +527,6 @@ public class PassThroughHttpSender exten
                 pipe.setSerializationComplete(true);
                 out.close();
             }
-            
-            if(noEntityBody != null && Boolean.TRUE == noEntityBody && pipe != 
null){
-                OutputStream out = pipe.getOutputStream();
-               out.write(new byte[0]);
-               pipe.setRawSerializationComplete(true);
-                out.close();
-            }
             conn.requestOutput();
         } else {
             // nothing much to do as we have started the response already


Reply via email to