Coverage Report - org.mule.module.cxf.support.CopyAttachmentInInterceptor
 
Classes in this File Line Coverage Branch Coverage Complexity
CopyAttachmentInInterceptor
0%
0/9
0%
0/4
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.module.cxf.support;
 8  
 
 9  
 import org.mule.api.MuleEvent;
 10  
 import org.mule.api.MuleMessage;
 11  
 import org.mule.module.cxf.CxfConstants;
 12  
 import org.mule.transport.http.HttpConstants;
 13  
 
 14  
 import java.util.Collection;
 15  
 
 16  
 import org.apache.cxf.interceptor.Fault;
 17  
 import org.apache.cxf.message.Attachment;
 18  
 import org.apache.cxf.message.Message;
 19  
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 20  
 import org.apache.cxf.phase.Phase;
 21  
 
 22  
 public class CopyAttachmentInInterceptor extends AbstractPhaseInterceptor
 23  
 {
 24  
     public CopyAttachmentInInterceptor()
 25  
     {
 26  0
         super(Phase.PRE_INVOKE);
 27  0
     }
 28  
 
 29  
     public void handleMessage(Message message) throws Fault
 30  
     {
 31  0
         MuleEvent event = (MuleEvent) message.getExchange().get(CxfConstants.MULE_EVENT);
 32  0
         MuleMessage muleMsg = event.getMessage();
 33  0
         Collection<Attachment> atts = message.getAttachments();
 34  
 
 35  0
         if (atts != null && !atts.isEmpty())
 36  
         {
 37  0
             muleMsg.setInvocationProperty(CxfConstants.ATTACHMENTS, atts);
 38  0
             muleMsg.setOutboundProperty(HttpConstants.HEADER_CONTENT_TYPE, muleMsg.getInboundProperty(HttpConstants.HEADER_CONTENT_TYPE));
 39  
         }
 40  0
     }
 41  
 
 42  
 }
 43  
 
 44