Coverage Report - org.mule.module.cxf.support.ReversibleStaxInterceptor
 
Classes in this File Line Coverage Branch Coverage Complexity
ReversibleStaxInterceptor
0%
0/9
0%
0/2
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.module.xml.stax.ReversibleXMLStreamReader;
 10  
 
 11  
 import javax.xml.stream.XMLStreamReader;
 12  
 
 13  
 import org.apache.cxf.interceptor.Fault;
 14  
 import org.apache.cxf.message.Message;
 15  
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 16  
 
 17  
 /**
 18  
  * Creates a ReversibleXMLStreamReader to be able to track and replay events from the XMLStreamReader.
 19  
  */
 20  
 public abstract class ReversibleStaxInterceptor extends AbstractPhaseInterceptor<Message>
 21  
 {
 22  
     public ReversibleStaxInterceptor(String phase)
 23  
     {
 24  0
         super(phase);
 25  0
     }
 26  
 
 27  
     public void handleMessage(Message message) throws Fault
 28  
     {
 29  0
         XMLStreamReader reader = message.getContent(XMLStreamReader.class);
 30  
 
 31  0
         if (reader != null)
 32  
         {
 33  0
             ReversibleXMLStreamReader reversible = new ReversibleXMLStreamReader(reader);
 34  0
             reversible.setTracking(true);
 35  0
             message.setContent(XMLStreamReader.class, reversible);
 36  0
             message.setContent(ReversibleXMLStreamReader.class, reversible);
 37  
         }
 38  0
     }
 39  
 
 40  
 }