1
2
3
4
5
6
7 package org.mule.endpoint.outbound;
8
9 import org.mule.api.MuleEvent;
10 import org.mule.api.MuleException;
11 import org.mule.api.endpoint.OutboundEndpoint;
12 import org.mule.processor.AbstractInterceptingMessageProcessor;
13
14 import java.util.List;
15
16
17
18
19
20
21
22
23 public class OutboundResponsePropertiesMessageProcessor extends AbstractInterceptingMessageProcessor
24 {
25
26 private OutboundEndpoint endpoint;
27
28 public OutboundResponsePropertiesMessageProcessor(OutboundEndpoint endpoint)
29 {
30 this.endpoint = endpoint;
31 }
32
33 public MuleEvent process(MuleEvent event) throws MuleException
34 {
35 MuleEvent responseEvent = processNext(event);
36
37 if (responseEvent != null)
38 {
39
40
41 List<String> responseProperties = endpoint.getResponseProperties();
42 for (String propertyName : responseProperties)
43 {
44 Object propertyValue = event.getMessage().getOutboundProperty(propertyName);
45 if (propertyValue != null)
46 {
47 responseEvent.getMessage().setOutboundProperty(propertyName, propertyValue);
48 }
49 }
50 }
51 return responseEvent;
52 }
53 }