Search in sources :

Example 11 with PhaseManager

use of org.apache.cxf.phase.PhaseManager in project cxf by apache.

the class OutgoingChainInterceptor method getOutInterceptorChain.

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;
}
Also used : Binding(org.apache.cxf.binding.Binding) Bus(org.apache.cxf.Bus) PhaseInterceptorChain(org.apache.cxf.phase.PhaseInterceptorChain) PhaseManager(org.apache.cxf.phase.PhaseManager) Endpoint(org.apache.cxf.endpoint.Endpoint) Message(org.apache.cxf.message.Message) AbstractPhaseInterceptor(org.apache.cxf.phase.AbstractPhaseInterceptor)

Example 12 with PhaseManager

use of org.apache.cxf.phase.PhaseManager in project cxf by apache.

the class ClientImpl method setupInterceptorChain.

protected PhaseInterceptorChain setupInterceptorChain(Endpoint endpoint) {
    PhaseManager pm = bus.getExtension(PhaseManager.class);
    List<Interceptor<? extends Message>> i1 = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + i1);
    }
    List<Interceptor<? extends Message>> i2 = getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by client: " + i2);
    }
    List<Interceptor<? extends Message>> i3 = endpoint.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + i3);
    }
    List<Interceptor<? extends Message>> i4 = endpoint.getBinding().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by binding: " + i4);
    }
    List<Interceptor<? extends Message>> i5 = null;
    if (endpoint.getService().getDataBinding() instanceof InterceptorProvider) {
        i5 = ((InterceptorProvider) endpoint.getService().getDataBinding()).getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by databinding: " + i5);
        }
    }
    if (i5 != null) {
        return outboundChainCache.get(pm.getOutPhases(), i1, i2, i3, i4, i5);
    }
    return outboundChainCache.get(pm.getOutPhases(), i1, i2, i3, i4);
}
Also used : PhaseManager(org.apache.cxf.phase.PhaseManager) Message(org.apache.cxf.message.Message) InterceptorProvider(org.apache.cxf.interceptor.InterceptorProvider) AbstractBasicInterceptorProvider(org.apache.cxf.interceptor.AbstractBasicInterceptorProvider) Interceptor(org.apache.cxf.interceptor.Interceptor)

Aggregations

PhaseManager (org.apache.cxf.phase.PhaseManager)12 Message (org.apache.cxf.message.Message)10 Bus (org.apache.cxf.Bus)8 Interceptor (org.apache.cxf.interceptor.Interceptor)6 PhaseInterceptorChain (org.apache.cxf.phase.PhaseInterceptorChain)6 Endpoint (org.apache.cxf.endpoint.Endpoint)4 Phase (org.apache.cxf.phase.Phase)4 Binding (org.apache.cxf.binding.Binding)3 PhaseManagerImpl (org.apache.cxf.bus.managers.PhaseManagerImpl)3 AbstractOutDatabindingInterceptor (org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor)3 InterceptorProvider (org.apache.cxf.interceptor.InterceptorProvider)3 AbstractPhaseInterceptor (org.apache.cxf.phase.AbstractPhaseInterceptor)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 TreeSet (java.util.TreeSet)2 WriterInterceptor (javax.ws.rs.ext.WriterInterceptor)2 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)2 AbstractBasicInterceptorProvider (org.apache.cxf.interceptor.AbstractBasicInterceptorProvider)2 StaxInEndingInterceptor (org.apache.cxf.interceptor.StaxInEndingInterceptor)2 ClientRequestFilterInterceptor (org.apache.cxf.jaxrs.client.spec.ClientRequestFilterInterceptor)2