DumpFeature.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.utils.service.context.dump;


  21. import org.apache.cxf.Bus;
  22. import org.apache.cxf.annotations.Provider;
  23. import org.apache.cxf.annotations.Provider.Type;
  24. import org.apache.cxf.common.injection.NoJSR250Annotations;
  25. import org.apache.cxf.interceptor.InterceptorProvider;
  26. import org.openspcoop2.utils.service.context.server.ServerConfig;

  27. /**
  28.  * DumpFeature
  29.  *
  30.  * @author Lorenzo Nardi (nardi@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */
  34. @NoJSR250Annotations
  35. @Provider(value = Type.Feature)
  36. public class DumpFeature extends org.apache.cxf.ext.logging.LoggingFeature {
  37.    
  38.     private DumpInInterceptor in;
  39.     private DumpOutInterceptor out;

  40.     public DumpFeature() {
  41.         this.in = new DumpInInterceptor();
  42.         this.out = new DumpOutInterceptor();
  43.     }

  44.     public DumpConfig getDumpConfig() {
  45.         return this.in.getDumpConfig();
  46.     }
  47.     public void setDumpConfig(DumpConfig dumpConfig) {
  48.         this.in.setDumpConfig(dumpConfig);
  49.         this.out.setDumpConfig(dumpConfig);
  50.     }
  51.    
  52.     public ServerConfig getServerConfig() {
  53.         return this.in.getServerConfig();
  54.     }
  55.     public void setServerConfig(ServerConfig serverConfig) {
  56.         this.in.setServerConfig(serverConfig);
  57.         this.out.setServerConfig(serverConfig);
  58.     }
  59.    
  60.     @Override
  61.     protected void initializeProvider(InterceptorProvider provider, Bus bus) {
  62.         provider.getInInterceptors().add(this.in);
  63.         provider.getInFaultInterceptors().add(this.in);

  64.         provider.getOutInterceptors().add(this.out);
  65.         provider.getOutFaultInterceptors().add(this.out);
  66.     }

  67. }