protected void invokeInboundChain(Exchange ex, Endpoint ep) {
    Message m = getInBoundMessage(ex);
    Message inMsg = ep.getBinding().createMessage();
    MessageImpl.copyContent(m, inMsg);

    // Copy Response Context to Client inBound Message
    // TODO a Context Filter Strategy required.
    inMsg.putAll(m);

    inMsg.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
    inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
    inMsg.setExchange(ex);

    Exception exc = inMsg.getContent(Exception.class);
    if (exc != null) {
      ex.setInFaultMessage(inMsg);
      ColocInFaultObserver observer = new ColocInFaultObserver(bus);
      observer.onMessage(inMsg);
    } else {
      // Handle Response
      ex.setInMessage(inMsg);
      PhaseManager pm = bus.getExtension(PhaseManager.class);
      SortedSet<Phase> phases = new TreeSet<Phase>(pm.getInPhases());
      ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.PRE_INVOKE);

      InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);
      inMsg.setInterceptorChain(chain);
      chain.doIntercept(inMsg);
    }
    ex.put(ClientImpl.FINISHED, Boolean.TRUE);
  }
Exemple #2
0
 protected static PhaseInterceptorChain setupInInterceptorChain(ClientConfiguration cfg) {
   PhaseManager pm = cfg.getBus().getExtension(PhaseManager.class);
   List<Interceptor<? extends Message>> i1 = cfg.getBus().getInInterceptors();
   List<Interceptor<? extends Message>> i2 = cfg.getInInterceptors();
   List<Interceptor<? extends Message>> i3 =
       cfg.getConduitSelector().getEndpoint().getInInterceptors();
   PhaseInterceptorChain chain = new PhaseChainCache().get(pm.getInPhases(), i1, i2, i3);
   chain.add(new ClientResponseFilterInterceptor());
   return chain;
 }
 /**
  * @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;
 }
 @Test
 public void testPhases() {
   Bus bus = new SpringBusFactory().createBus();
   PhaseManager cxfPM = bus.getExtension(PhaseManager.class);
   PhaseManager defaultPM = new PhaseManagerImpl();
   SortedSet<Phase> cxfPhases = cxfPM.getInPhases();
   SortedSet<Phase> defaultPhases = defaultPM.getInPhases();
   assertEquals(defaultPhases.size(), cxfPhases.size());
   assertTrue(cxfPhases.equals(defaultPhases));
   cxfPhases = cxfPM.getOutPhases();
   defaultPhases = defaultPM.getOutPhases();
   assertEquals(defaultPhases.size(), cxfPhases.size());
   assertTrue(cxfPhases.equals(defaultPhases));
 }