Package org.apache.servicemix.soap.api

Examples of org.apache.servicemix.soap.api.Interceptor


            setState(message, iterator);
        }

        try {
            while (iterator.hasNext()) {
                Interceptor currentInterceptor = iterator.next();
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Invoking handleMessage on interceptor " + currentInterceptor.getId());
                }
                currentInterceptor.handleMessage(message);
            }
        } catch (RuntimeException ex) {
            if (LOG.isInfoEnabled()) {
                LOG.info("Interceptor has thrown exception, unwinding now", ex);
            }
            message.setContent(Exception.class, ex);
            // Unwind
            while (iterator.hasPrevious()) {
                Interceptor currentInterceptor = iterator.previous();
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Invoking handleFault on interceptor " + currentInterceptor.getId());
                }
                currentInterceptor.handleFault(message);
            }
            throw ex;
        }
    }
View Full Code Here


        int begin = -1;
        int end = interceptors.size();
        Collection before = interc.getBefore();
        Collection after = interc.getAfter();
        for (int i = 0; i < interceptors.size(); i++) {
            Interceptor cmp = interceptors.get(i);
            if (cmp.getId() == null) {
                continue;
            }
            if (before.contains(cmp.getId()) && i < end) {
                end = i;
            }
            if (cmp.getBefore().contains(interc.getId()) && i > begin) {
                begin = i;
            }
            if (after.contains(cmp.getId()) && i > begin) {
                begin = i;
            }
            if (cmp.getAfter().contains(interc.getId()) && i < end) {
                end = i;
            }
        }
        if (end < begin + 1) {
            throw new IllegalStateException("Invalid ordering for interceptor " + interc.getId());
View Full Code Here

import org.apache.servicemix.soap.core.MessageImpl;

public class JbiInInterceptorTest extends TestCase {

    public void test() throws Exception {
        Interceptor interceptor = new JbiInInterceptor(true);
        Message message = new MessageImpl();
        message.put(JbiInInterceptor.OPERATION_MEP, JbiConstants.IN_ONLY);
        message.put(MessageExchangeFactory.class, new MockExchangeFactory());
        message.setContent(Source.class, new StreamSource(new StringReader("<hello/>")));
        message.getTransportHeaders().put("Content-Type", "text/xml");
       
        interceptor.handleMessage(message);
       
        MessageExchange me = message.getContent(MessageExchange.class);
        assertNotNull(me);
        assertTrue(me instanceof InOnly);
        NormalizedMessage nm = me.getMessage("in");
View Full Code Here

import org.apache.servicemix.tck.mock.MockExchangeFactory;

public class JbiInInterceptorTest extends TestCase {

    public void test() throws Exception {
        Interceptor interceptor = new JbiInInterceptor(true);
        Message message = new MessageImpl();
        message.put(JbiInInterceptor.OPERATION_MEP, JbiConstants.IN_ONLY);
        message.put(MessageExchangeFactory.class, new MockExchangeFactory());
        message.setContent(Source.class, new StreamSource(new StringReader("<hello/>")));
        message.getTransportHeaders().put("Content-Type", "text/xml");
       
        interceptor.handleMessage(message);
       
        MessageExchange me = message.getContent(MessageExchange.class);
        assertNotNull(me);
        assertTrue(me instanceof InOnly);
        NormalizedMessage nm = me.getMessage("in");
View Full Code Here

TOP

Related Classes of org.apache.servicemix.soap.api.Interceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.