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 | 0 | { |
30 | 0 | this.endpoint = endpoint; |
31 | 0 | } |
32 | |
|
33 | |
public MuleEvent process(MuleEvent event) throws MuleException |
34 | |
{ |
35 | 0 | MuleEvent responseEvent = processNext(event); |
36 | |
|
37 | 0 | if (responseEvent != null) |
38 | |
{ |
39 | |
|
40 | |
|
41 | 0 | List<String> responseProperties = endpoint.getResponseProperties(); |
42 | 0 | for (String propertyName : responseProperties) |
43 | |
{ |
44 | 0 | Object propertyValue = event.getMessage().getOutboundProperty(propertyName); |
45 | 0 | if (propertyValue != null) |
46 | |
{ |
47 | 0 | responseEvent.getMessage().setOutboundProperty(propertyName, propertyValue); |
48 | |
} |
49 | 0 | } |
50 | |
} |
51 | 0 | return responseEvent; |
52 | |
} |
53 | |
} |