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