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