Coverage Report - org.mule.module.cxf.support.CopyAttachmentOutInterceptor
 
Classes in this File Line Coverage Branch Coverage Complexity
CopyAttachmentOutInterceptor
0%
0/8
0%
0/2
0
 
 1  
 /*
 2  
  * $Id: CopyAttachmentOutInterceptor.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 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  
  * Copies any attachments which were stored by the proxy to the outbound CXF message.
 27  
  */
 28  
 public class CopyAttachmentOutInterceptor extends AbstractPhaseInterceptor
 29  
 {
 30  
     public CopyAttachmentOutInterceptor()
 31  
     {
 32  0
         super(Phase.SETUP);
 33  0
     }
 34  
 
 35  
     public void handleMessage(Message message) throws Fault
 36  
     {
 37  0
         MuleEvent event = RequestContext.getEvent();
 38  
         
 39  0
         Collection<Attachment> a = event.getMessage().getOutboundProperty(CxfConstants.ATTACHMENTS);
 40  
         
 41  0
         if (a != null) 
 42  
         {
 43  0
             message.setAttachments(a);
 44  0
             event.getMessage().removeProperty(CxfConstants.ATTACHMENTS);
 45  
         }
 46  0
     }
 47  
 }
 48  
 
 49