1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.cxf.support;
12
13 import org.mule.api.MuleEvent;
14 import org.mule.module.cxf.CxfConstants;
15
16 import java.util.Collection;
17
18 import org.apache.cxf.interceptor.Fault;
19 import org.apache.cxf.message.Attachment;
20 import org.apache.cxf.message.Message;
21 import org.apache.cxf.phase.AbstractPhaseInterceptor;
22 import org.apache.cxf.phase.Phase;
23
24
25
26
27 public class CopyAttachmentOutInterceptor extends AbstractPhaseInterceptor
28 {
29 public CopyAttachmentOutInterceptor()
30 {
31 super(Phase.SETUP);
32 }
33
34 public void handleMessage(Message message) throws Fault
35 {
36 MuleEvent event = (MuleEvent) message.getExchange().get(CxfConstants.MULE_EVENT);
37 Collection<Attachment> a = event.getMessage().getInvocationProperty(CxfConstants.ATTACHMENTS);
38
39 if (a != null)
40 {
41 message.setAttachments(a);
42 }
43 }
44 }
45
46