Java Code Examples for org.apache.cxf.Bus#getOutInterceptors()

The following examples show how to use org.apache.cxf.Bus#getOutInterceptors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RetransmissionQueueImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * @param endpoint
 * @param cache
 * @return
 */
protected PhaseInterceptorChain buildRetransmitChain(final Endpoint endpoint, PhaseChainCache cache) {
    PhaseInterceptorChain retransmitChain;
    Bus bus = getManager().getBus();
    List<Interceptor<? extends Message>> i1 = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + i1);
    }
    List<Interceptor<? extends Message>> i2 = endpoint.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + i2);
    }
    List<Interceptor<? extends Message>> i3 = endpoint.getBinding().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by binding: " + i3);
    }
    PhaseManager pm = bus.getExtension(PhaseManager.class);
    retransmitChain = cache.get(pm.getOutPhases(), i1, i2, i3);
    return retransmitChain;
}
 
Example 2
Source File: SpringBusFactoryTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkCustomerConfiguration(Bus bus) {
    assertNotNull(bus);
    List<Interceptor<? extends Message>> interceptors = bus.getInInterceptors();
    assertEquals("Unexpected number of interceptors", 2, interceptors.size());
    assertEquals("Unexpected interceptor", "in-a", interceptors.get(0).toString());
    assertEquals("Unexpected interceptor", "in-b", interceptors.get(1).toString());
    interceptors = bus.getInFaultInterceptors();
    assertEquals("Unexpected number of interceptors", 1, interceptors.size());
    assertEquals("Unexpected interceptor", "in-fault", interceptors.get(0).toString());
    interceptors = bus.getOutFaultInterceptors();
    assertEquals("Unexpected number of interceptors", 1, interceptors.size());
    assertEquals("Unexpected interceptor", "out-fault", interceptors.get(0).toString());
    interceptors = bus.getOutInterceptors();
    assertEquals("Unexpected number of interceptors", 1, interceptors.size());
    assertEquals("Unexpected interceptor", "out", interceptors.get(0).toString());
}
 
Example 3
Source File: KSBDispatcherServlet.java    From rice with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void initFrameworkServlet() throws ServletException, BeansException {
	this.httpInvokerHandler = new KSBHttpInvokerHandler();
	
       Bus bus = KSBServiceLocator.getCXFBus();

       List<Interceptor<? extends Message>> inInterceptors = KSBServiceLocator.getInInterceptors();
       if(inInterceptors != null) {
       	List<Interceptor<? extends Message>> busInInterceptors = bus.getInInterceptors();
       	busInInterceptors.addAll(inInterceptors);
       }
      
       List<Interceptor<? extends Message>> outInterceptors = KSBServiceLocator.getOutInterceptors();
       if(outInterceptors != null) {
       	List<Interceptor<? extends Message>> busOutInterceptors = bus.getOutInterceptors();
       	busOutInterceptors.addAll(outInterceptors);
       }


	HTTPTransportFactory transportFactory = bus.getExtension(HTTPTransportFactory.class);
       if (transportFactory == null) {
           throw new IllegalStateException("Failed to locate HTTPTransportFactory extension on Apache CXF Bus");
       }

       DestinationRegistry destinationRegistry = transportFactory.getRegistry();


	this.cxfServletController = new ServletController(destinationRegistry, getCXFServletConfig(
               this.getServletConfig()), new ServiceListGeneratorServlet(destinationRegistry, bus));

	this.setPublishEvents(false);
}
 
Example 4
Source File: ColocUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static InterceptorChain getOutInterceptorChain(Exchange ex, SortedSet<Phase> phases) {
    Bus bus = ex.getBus();
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);

    Endpoint ep = ex.getEndpoint();
    List<Interceptor<? extends Message>> il = ep.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + il);
    }
    chain.add(il);
    il = ep.getService().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + il);
    }
    chain.add(il);
    il = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + il);
    }
    chain.add(il);

    if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
        il = ((InterceptorProvider)ep.getService().getDataBinding()).getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by databinding: " + il);
        }
        chain.add(il);
    }
    modifyChain(chain, ex, false);

    return chain;
}
 
Example 5
Source File: OutgoingChainInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static InterceptorChain getOutInterceptorChain(Exchange ex) {
    Bus bus = ex.getBus();
    Binding binding = ex.getBinding();
    PhaseManager pm = bus.getExtension(PhaseManager.class);
    PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getOutPhases());

    Endpoint ep = ex.getEndpoint();
    List<Interceptor<? extends Message>> il = ep.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + il);
    }
    chain.add(il);
    il = ep.getService().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + il);
    }
    chain.add(il);
    il = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + il);
    }
    chain.add(il);
    if (binding != null) {
        il = binding.getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by binding: " + il);
        }
        chain.add(il);
    }
    modifyChain(chain, ex);
    chain.setFaultObserver(ep.getOutFaultObserver());
    return chain;
}
 
Example 6
Source File: OutgoingChainInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static PhaseInterceptorChain getChain(Exchange ex, PhaseChainCache chainCache) {
    Bus bus = ex.getBus();
    Binding binding = ex.getBinding();

    Endpoint ep = ex.getEndpoint();

    List<Interceptor<? extends Message>> i1 = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + i1);
    }
    List<Interceptor<? extends Message>> i2 = ep.getService().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + i2);
    }
    List<Interceptor<? extends Message>> i3 = ep.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + i3);
    }
    List<Interceptor<? extends Message>> i4 = null;
    if (binding != null) {
        i4 = binding.getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by binding: " + i4);
        }
    }
    List<Interceptor<? extends Message>> i5 = null;
    if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
        i5 = ((InterceptorProvider)ep.getService().getDataBinding()).getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by databinding: " + i5);
        }
        if (i4 == null) {
            i4 = i5;
            i5 = null;
        }
    }
    PhaseInterceptorChain chain;
    if (i5 != null) {
        chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(),
                               i1, i2, i3, i4, i5);
    } else if (i4 != null) {
        chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(),
                               i1, i2, i3, i4);
    } else {
        chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(),
                               i1, i2, i3);
    }

    modifyChain(chain, ex);
    chain.setFaultObserver(ep.getOutFaultObserver());
    return chain;
}