Coverage Report - org.mule.module.cxf.support.ReversibleStaxInInterceptor
 
Classes in this File Line Coverage Branch Coverage Complexity
ReversibleStaxInInterceptor
0%
0/11
0%
0/2
0
 
 1  
 /*
 2  
  * $Id: ReversibleStaxInInterceptor.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.module.xml.stax.ReversibleXMLStreamReader;
 14  
 
 15  
 import javax.xml.stream.XMLStreamReader;
 16  
 
 17  
 import org.apache.cxf.interceptor.Fault;
 18  
 import org.apache.cxf.interceptor.StaxInInterceptor;
 19  
 import org.apache.cxf.message.Message;
 20  
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 21  
 import org.apache.cxf.phase.Phase;
 22  
 
 23  
 /**
 24  
  * Resets the ReversibleXMLStreamReader so the person receiving it can start back
 25  
  * at the beginning of the stream.
 26  
  */
 27  
 public class ReversibleStaxInInterceptor extends AbstractPhaseInterceptor<Message>
 28  
 {
 29  
 
 30  
     public ReversibleStaxInInterceptor()
 31  
     {
 32  0
         super(Phase.POST_STREAM);
 33  0
         getAfter().add(StreamClosingInterceptor.class.getName());
 34  0
         getAfter().add(StaxInInterceptor.class.getName());
 35  0
     }
 36  
 
 37  
     public void handleMessage(Message message) throws Fault
 38  
     {
 39  0
         XMLStreamReader reader = message.getContent(XMLStreamReader.class);
 40  
         
 41  0
         if (reader != null) 
 42  
         {
 43  0
             ReversibleXMLStreamReader reversible = new ReversibleXMLStreamReader(reader);
 44  0
             reversible.setTracking(true);
 45  0
             message.setContent(XMLStreamReader.class, reversible);
 46  0
             message.setContent(ReversibleXMLStreamReader.class, reversible);
 47  
         }
 48  0
     }
 49  
 
 50  
 
 51  
 }
 52  
 
 53