2016-10-18 12 views
1

私は、UNMARSHALフェーズのMultiPart要求に対して特定のロジックを実行するインターセプタを作成しています。このフェーズでは、全く別のCXFインターセプタがあります。論理。同じフェーズで複数のCXFインターセプタを持つことができますか

私の質問は、同じフェーズで複数のCXFインターセプタを作成できますか? はいの場合 以下に示すように、呼び出された順番は何ですか?

例:

public class Interceptor1 extends AbstractPhaseInterceptor<Message> { 

     public Interceptor1() { 
     super(Phase.UNMARSHAL); 
     } 
     @Override 
     public void handleMessage(Message message) throws Fault { 
      System.out.println("Interceptor1"); 
     } 

} 

public class Interceptor2 extends AbstractPhaseInterceptor<Message> { 

     public Interceptor2() { 
     super(Phase.UNMARSHAL); 
     } 
     @Override 
     public void handleMessage(Message message) throws Fault { 
      System.out.println("Interceptor2"); 
     } 

} 

答えて

1

各フェーズは、あなたが望むように多くのインターセプタ、彼らは彼らが

<bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"> 
     <property name="inInterceptors"> 
      <ref bean="MyInterceptor"/> 
      <ref bean="OtherInterceptor"/> 
     </property> 
     <property name="outInterceptors"> 
      <ref bean="MyInterceptor"/> 
     </property> 
    </bean> 

MyInterceptor(1)追加された順序で実行される段階で見つかった複数のインターセプタ含めることができます - > OtherInterceptorを(2)

関連する問題