View Javadoc
1   /**
2    * This Source Code Form is subject to the terms of the Mozilla Public
3    * License, v. 2.0. If a copy of the MPL was not distributed with this
4    * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5    *
6    * If it is not possible or desirable to put the notice in a particular
7    * file, then You may include the notice in a location (such as a LICENSE
8    * file in a relevant directory) where a recipient would be likely to look
9    * for such a notice.
10  
11   * 
12   */
13   
14  /*  ---------------------------------------------------------------------------
15   *  U.S. Government, Department of the Army
16   *  Army Materiel Command
17   *  Research Development Engineering Command
18   *  Communications Electronics Research Development and Engineering Center
19   *  ---------------------------------------------------------------------------
20   */
21  
22  package org.miloss.fgsms.agents;
23  
24  import org.apache.cxf.message.Message;
25  import org.apache.cxf.phase.Phase;
26  
27  /**
28   *
29   * @author AO
30   */
31  public class CXFInterceptorInService extends org.apache.cxf.phase.AbstractPhaseInterceptor {
32  
33      public CXFInterceptorInService() {
34          super(Phase.POST_LOGICAL);
35      }
36  
37      @Override
38      public void handleMessage(Message message) {
39          Boolean isclient = (Boolean) message.get("org.apache.cxf.client");
40          Boolean isinbound = (Boolean) message.get("org.apache.cxf.message.inbound");
41          if (isclient == null) {
42              isclient = false;
43          }
44          if (isinbound == null) {
45              isinbound = false;
46          }
47  
48          if (isclient && !isinbound) //client outbound request
49          {
50              CXFCommonMessageHandler.ProcessRequest(message, true, this.getClass().getCanonicalName());
51          } else if (isclient && isinbound) {
52              CXFCommonMessageHandler.ProcessResponse(message, false, true, this.getClass().getCanonicalName());
53          } else {
54              CXFCommonMessageHandler.ProcessRequest(message, false, this.getClass().getCanonicalName());
55          }
56  
57          // CXFCommonMessageHandler.ProcessResponse(message, false, true, this.getClass().getCanonicalName());
58  
59      }
60  
61      @Override
62      public void handleFault(Message message) {
63          //   CXFCommonMessageHandler.ProcessRequest(message, true, this.getClass().getCanonicalName());
64  
65          CXFCommonMessageHandler.ProcessResponse(message, true, true, this.getClass().getCanonicalName());
66  
67      }
68  }