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