View Javadoc

1   /*
2    * $Id: OutboundRewriteResponseEventMessageProcessor.java 20320 2010-11-24 15:03:31Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.endpoint.outbound;
12  
13  import org.mule.DefaultMuleEvent;
14  import org.mule.OptimizedRequestContext;
15  import org.mule.api.MuleEvent;
16  import org.mule.api.MuleException;
17  import org.mule.api.processor.MessageProcessor;
18  import org.mule.util.ObjectUtils;
19  
20  
21  public class OutboundRewriteResponseEventMessageProcessor implements MessageProcessor
22  {
23      public MuleEvent process(MuleEvent event) throws MuleException
24      {
25          if (event != null)
26          { // See MULE-2692
27              // RM* This actually performs the function of adding properties from the
28              // request to the response message I think this could be done without the
29              // performance hit. Or we could provide a way to set the request message
30              // as
31              // the OriginalAdapter on the message And provide access to the request
32              // properties that way
33              return new DefaultMuleEvent(OptimizedRequestContext.unsafeRewriteEvent(event.getMessage()), event);
34          }
35          else
36          {
37              return null;
38          }
39      }
40  
41      @Override
42      public String toString()
43      {
44          return ObjectUtils.toString(this);
45      }
46  }