ConfigurazioneGenerale.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.web.ctrlstat.servlet.config;

  21. import java.sql.Connection;
  22. import java.util.ArrayList;
  23. import java.util.List;

  24. import javax.servlet.http.HttpServletRequest;
  25. import javax.servlet.http.HttpServletResponse;
  26. import javax.servlet.http.HttpSession;

  27. import org.apache.commons.lang.StringUtils;
  28. import org.apache.struts.action.Action;
  29. import org.apache.struts.action.ActionForm;
  30. import org.apache.struts.action.ActionForward;
  31. import org.apache.struts.action.ActionMapping;
  32. import org.openspcoop2.core.config.AccessoConfigurazione;
  33. import org.openspcoop2.core.config.AccessoDatiAutenticazione;
  34. import org.openspcoop2.core.config.AccessoDatiAutorizzazione;
  35. import org.openspcoop2.core.config.AccessoDatiConsegnaApplicativi;
  36. import org.openspcoop2.core.config.AccessoDatiGestioneToken;
  37. import org.openspcoop2.core.config.AccessoDatiAttributeAuthority;
  38. import org.openspcoop2.core.config.AccessoDatiKeystore;
  39. import org.openspcoop2.core.config.AccessoDatiRichieste;
  40. import org.openspcoop2.core.config.AccessoRegistro;
  41. import org.openspcoop2.core.config.Attachments;
  42. import org.openspcoop2.core.config.Cache;
  43. import org.openspcoop2.core.config.CanaleConfigurazione;
  44. import org.openspcoop2.core.config.CanaleConfigurazioneNodo;
  45. import org.openspcoop2.core.config.CanaliConfigurazione;
  46. import org.openspcoop2.core.config.Configurazione;
  47. import org.openspcoop2.core.config.ConfigurazioneMultitenant;
  48. import org.openspcoop2.core.config.ConfigurazioneUrlInvocazione;
  49. import org.openspcoop2.core.config.CorsConfigurazione;
  50. import org.openspcoop2.core.config.CorsConfigurazioneHeaders;
  51. import org.openspcoop2.core.config.CorsConfigurazioneMethods;
  52. import org.openspcoop2.core.config.CorsConfigurazioneOrigin;
  53. import org.openspcoop2.core.config.Dump;
  54. import org.openspcoop2.core.config.IndirizzoRisposta;
  55. import org.openspcoop2.core.config.InoltroBusteNonRiscontrate;
  56. import org.openspcoop2.core.config.IntegrationManager;
  57. import org.openspcoop2.core.config.MessaggiDiagnostici;
  58. import org.openspcoop2.core.config.ResponseCachingConfigurazione;
  59. import org.openspcoop2.core.config.ResponseCachingConfigurazioneControl;
  60. import org.openspcoop2.core.config.ResponseCachingConfigurazioneGenerale;
  61. import org.openspcoop2.core.config.ResponseCachingConfigurazioneHashGenerator;
  62. import org.openspcoop2.core.config.ResponseCachingConfigurazioneRegola;
  63. import org.openspcoop2.core.config.Risposte;
  64. import org.openspcoop2.core.config.Tracciamento;
  65. import org.openspcoop2.core.config.ValidazioneBuste;
  66. import org.openspcoop2.core.config.ValidazioneContenutiApplicativi;
  67. import org.openspcoop2.core.config.constants.AlgoritmoCache;
  68. import org.openspcoop2.core.config.constants.CostantiConfigurazione;
  69. import org.openspcoop2.core.config.constants.PortaApplicativaSoggettiFruitori;
  70. import org.openspcoop2.core.config.constants.PortaDelegataSoggettiErogatori;
  71. import org.openspcoop2.core.config.constants.Severita;
  72. import org.openspcoop2.core.config.constants.StatoFunzionalita;
  73. import org.openspcoop2.core.config.constants.StatoFunzionalitaCacheDigestQueryParameter;
  74. import org.openspcoop2.core.config.constants.StatoFunzionalitaConWarning;
  75. import org.openspcoop2.core.config.constants.TipoConnessioneRisposte;
  76. import org.openspcoop2.core.config.constants.TipoGestioneCORS;
  77. import org.openspcoop2.core.config.constants.ValidazioneBusteTipoControllo;
  78. import org.openspcoop2.core.config.constants.ValidazioneContenutiApplicativiTipo;
  79. import org.openspcoop2.core.controllo_traffico.constants.CacheAlgorithm;
  80. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  81. import org.openspcoop2.web.ctrlstat.core.DBManager;
  82. import org.openspcoop2.web.ctrlstat.costanti.CostantiControlStation;
  83. import org.openspcoop2.web.ctrlstat.costanti.MultitenantSoggettiErogazioni;
  84. import org.openspcoop2.web.ctrlstat.costanti.MultitenantSoggettiFruizioni;
  85. import org.openspcoop2.web.ctrlstat.plugins.IExtendedBean;
  86. import org.openspcoop2.web.ctrlstat.plugins.IExtendedFormServlet;
  87. import org.openspcoop2.web.ctrlstat.plugins.WrapperExtendedBean;
  88. import org.openspcoop2.web.ctrlstat.plugins.servlet.AbstractServletNewWindowChangeExtended;
  89. import org.openspcoop2.web.ctrlstat.servlet.GeneralHelper;
  90. import org.openspcoop2.web.lib.mvc.Costanti;
  91. import org.openspcoop2.web.lib.mvc.DataElement;
  92. import org.openspcoop2.web.lib.mvc.DataElementType;
  93. import org.openspcoop2.web.lib.mvc.GeneralData;
  94. import org.openspcoop2.web.lib.mvc.PageData;
  95. import org.openspcoop2.web.lib.mvc.Parameter;
  96. import org.openspcoop2.web.lib.mvc.ServletUtils;
  97. import org.openspcoop2.web.lib.mvc.TipoOperazione;

  98. /**
  99.  * configurazione
  100.  *
  101.  * @author Andrea Poli (apoli@link.it)
  102.  * @author Stefano Corallo (corallo@link.it)
  103.  * @author Sandra Giangrandi (sandra@link.it)
  104.  * @author $Author$
  105.  * @version $Rev$, $Date$
  106.  *
  107.  */
  108. public final class ConfigurazioneGenerale extends Action {

  109.     @Override
  110.     public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

  111.         HttpSession session = request.getSession(true);

  112.         // Inizializzo PageData
  113.         PageData pd = new PageData();

  114.         GeneralHelper generalHelper = new GeneralHelper(session);

  115.         // Inizializzo GeneralData
  116.         GeneralData gd = generalHelper.initGeneralData(request);

  117.         String userLogin = ServletUtils.getUserLoginFromSession(session);  

  118.         try {


  119.             ConfigurazioneHelper confHelper = new ConfigurazioneHelper(request, pd, session);
  120.             ConfigurazioneCore confCore = new ConfigurazioneCore();

  121.             List<IExtendedFormServlet> extendedServletList = confCore.getExtendedServletConfigurazione();

  122.             String inoltromin = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_INOLTRO_MIN);
  123.             String stato = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO);
  124.             String controllo = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONTROLLO);
  125.             String severita = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA);
  126.             String severitaLog4j = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIVELLO_SEVERITA_LOG4J);
  127.             String integman = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_INTEGMAN);
  128.             String nomeintegman = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_NOME_INTEGMAN);
  129.             String profcoll = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROFILO_COLLABORAZIONE);
  130.             String connessione = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CONNESSIONE);
  131.             String utilizzo = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_UTILIZZO);
  132.             String validman = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_VALIDMAN);
  133.             String gestman = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_GESTMAN);
  134.             String registrazioneTracce = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_REGISTRAZIONE_TRACCE);
  135.             String dumpPD = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PD);
  136.             String dumpPA = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DUMP_CONNETTORE_PA);
  137.             String xsd = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_XSD);
  138.             String tipoValidazione = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_TIPO_VALIDAZIONE);
  139.             String applicaMTOM = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_APPLICA_MTOM);

  140.             String configurazioneCachesTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CACHES);
  141.             boolean isAllHiddenConfigurazione = ServletUtils.isCheckBoxEnabled(configurazioneCachesTmp);
  142.             boolean isAllHiddenCache = !isAllHiddenConfigurazione;
  143.            
  144.             String statoCacheRegistry = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_REGISTRY);
  145.             String dimensionecacheRegistry = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_REGISTRY);
  146.             String algoritmocacheRegistry = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_REGISTRY);
  147.             String idlecacheRegistry = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_REGISTRY);
  148.             String lifecacheRegistry = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_REGISTRY);
  149.            
  150.             String statoCacheConfig = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONFIG);
  151.             String dimensionecacheConfig = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONFIG);
  152.             String algoritmocacheConfig = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONFIG);
  153.             String idlecacheConfig = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONFIG);
  154.             String lifecacheConfig = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONFIG);

  155.             String statoCacheAuthz = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHZ);
  156.             String dimensionecacheAuthz = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHZ);
  157.             String algoritmocacheAuthz = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHZ);
  158.             String idlecacheAuthz = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHZ);
  159.             String lifecacheAuthz = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHZ);

  160.             String statoCacheAuthn = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHN);
  161.             String dimensionecacheAuthn = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHN);
  162.             String algoritmocacheAuthn = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHN);
  163.             String idlecacheAuthn = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHN);
  164.             String lifecacheAuthn = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHN);

  165.             String statoCacheToken = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_TOKEN);
  166.             String dimensionecacheToken = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_TOKEN);
  167.             String algoritmocacheToken = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_TOKEN);
  168.             String idlecacheToken = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_TOKEN);
  169.             String lifecacheToken = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_TOKEN);
  170.            
  171.             String statoCacheAA = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_ATTRIBUTE_AUTHORITY);
  172.             String dimensionecacheAA = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_ATTRIBUTE_AUTHORITY);
  173.             String algoritmocacheAA = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_ATTRIBUTE_AUTHORITY);
  174.             String idlecacheAA = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_ATTRIBUTE_AUTHORITY);
  175.             String lifecacheAA = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_ATTRIBUTE_AUTHORITY);
  176.            
  177.             String statoCacheKeystore = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_KEYSTORE);
  178.             String dimensionecacheKeystore = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_KEYSTORE);
  179.             String algoritmocacheKeystore = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_KEYSTORE);
  180.             String idlecacheKeystore = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_KEYSTORE);
  181.             String lifecacheKeystore = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_KEYSTORE);
  182.             String crlLifecacheKeystore = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CRL_LIFE_CACHE_KEYSTORE);

  183.             String statoCacheControlloTraffico = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONTROLLO_TRAFFICO);
  184.             String dimensionecacheControlloTraffico = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONTROLLO_TRAFFICO);
  185.             String algoritmocacheControlloTraffico = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONTROLLO_TRAFFICO);
  186.             String idlecacheControlloTraffico = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONTROLLO_TRAFFICO);
  187.             String lifecacheControlloTraffico = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONTROLLO_TRAFFICO);
  188.            
  189.             String statoCacheRisposte = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_RISPOSTE);
  190.             String dimensionecacheRisposte = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_RISPOSTE);
  191.             String algoritmocacheRisposte = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_RISPOSTE);
  192.             String idlecacheRisposte = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_RISPOSTE);
  193.             String lifecacheRisposte = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_RISPOSTE);

  194.             String statoCacheConsegna = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONSEGNA);
  195.             String dimensionecacheConsegna = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONSEGNA);
  196.             String algoritmocacheConsegna = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONSEGNA);
  197.             String idlecacheConsegna = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONSEGNA);
  198.             String lifecacheConsegna = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONSEGNA);
  199.            
  200.             String statoCachEdatiRichieste = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_DATI_RICHIESTE);
  201.             String dimensionecachEdatiRichieste = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_DATI_RICHIESTE);
  202.             String algoritmocachEdatiRichieste = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_DATI_RICHIESTE);
  203.             String idlecachEdatiRichieste = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_DATI_RICHIESTE);
  204.             String lifecachEdatiRichieste = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_DATI_RICHIESTE);
  205.            
  206.             String multitenantStatoTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_STATO);
  207.             boolean multitenantEnabled = CostantiConfigurazione.ABILITATO.getValue().equals(multitenantStatoTmp);
  208.             String multitenantSoggettiFruizioni = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_FRUIZIONI_SOGGETTO_EROGATORE);
  209.             String multitenantSoggettiErogazioni = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_MULTITENANT_EROGAZIONI_SOGGETTI_FRUITORI);

  210.             String corsStatoTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_STATO);
  211.             boolean corsStato = ServletUtils.isCheckBoxEnabled(corsStatoTmp);
  212.             String corsTipoTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_TIPO);
  213.             TipoGestioneCORS corsTipo = corsTipoTmp != null ? TipoGestioneCORS.toEnumConstant(corsTipoTmp) : TipoGestioneCORS.GATEWAY;
  214.             String corsAllAllowOriginsTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_ORIGINS);
  215.             boolean corsAllAllowOrigins = ServletUtils.isCheckBoxEnabled(corsAllAllowOriginsTmp);
  216.             String corsAllAllowHeadersTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_HEADERS);
  217.             boolean corsAllAllowHeaders = ServletUtils.isCheckBoxEnabled(corsAllAllowHeadersTmp);
  218.             String corsAllAllowMethodsTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_ALL_ALLOW_METHODS);
  219.             boolean corsAllAllowMethods = ServletUtils.isCheckBoxEnabled(corsAllAllowMethodsTmp);
  220.             String corsAllowHeaders =  confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_HEADERS);
  221.             String corsAllowOrigins =  confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_ORIGINS);
  222.             String corsAllowMethods =  confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_METHODS);
  223.             String corsAllowCredentialTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_ALLOW_CREDENTIALS);
  224.             boolean corsAllowCredential =  ServletUtils.isCheckBoxEnabled(corsAllowCredentialTmp);
  225.             String corsExposeHeaders = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_EXPOSE_HEADERS);
  226.             String corsMaxAgeTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE);
  227.             boolean corsMaxAge =  ServletUtils.isCheckBoxEnabled(corsMaxAgeTmp);
  228.             String corsMaxAgeSecondsTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CORS_MAX_AGE_SECONDS);
  229.             int corsMaxAgeSeconds = -1;
  230.             if(corsMaxAgeSecondsTmp != null) {
  231.                 try {
  232.                     corsMaxAgeSeconds = Integer.parseInt(corsMaxAgeSecondsTmp);
  233.                 }catch(Exception e) {}
  234.             }
  235.            
  236.             String responseCachingEnabledTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_STATO);
  237.             boolean responseCachingEnabled = ServletUtils.isCheckBoxEnabled(responseCachingEnabledTmp);
  238.            
  239.             String responseCachingSecondsTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_TIMEOUT);
  240.             int responseCachingSeconds = 1;
  241.             if(responseCachingSecondsTmp != null) {
  242.                 try {
  243.                     responseCachingSeconds = Integer.parseInt(responseCachingSecondsTmp);
  244.                 }catch(Exception e) {}
  245.             }
  246.            
  247.            
  248.             String responseCachingMaxResponseSizeTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_MAX_RESPONSE_SIZE);
  249.             boolean responseCachingMaxResponseSize = ServletUtils.isCheckBoxEnabled(responseCachingMaxResponseSizeTmp);
  250.            
  251.             String responseCachingMaxResponseSizeBytesTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_MAX_RESPONSE_SIZE_BYTES);
  252.             long responseCachingMaxResponseSizeBytes = 1;
  253.             if(responseCachingMaxResponseSizeBytesTmp != null) {
  254.                 try {
  255.                     responseCachingMaxResponseSizeBytes = Integer.parseInt(responseCachingMaxResponseSizeBytesTmp);
  256.                 }catch(Exception e) {}
  257.             }
  258.             String responseCachingDigestUrlInvocazioneTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_URI_INVOCAZIONE);
  259.             boolean responseCachingDigestUrlInvocazione = ServletUtils.isCheckBoxEnabled(responseCachingDigestUrlInvocazioneTmp);
  260.             String responseCachingDigestHeadersTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS);
  261.             boolean responseCachingDigestHeaders = ServletUtils.isCheckBoxEnabled(responseCachingDigestHeadersTmp);
  262.             String responseCachingDigestPayloadTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_PAYLOAD);
  263.             boolean responseCachingDigestPayload = ServletUtils.isCheckBoxEnabled(responseCachingDigestPayloadTmp);
  264.             String responseCachingDigestHeadersNomiHeaders = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_HEADERS_NOMI_HEADERS);
  265.             StatoFunzionalitaCacheDigestQueryParameter responseCachingDigestQueryParameter = null;
  266.             String responseCachingDigestQueryParameterTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS);
  267.             if(responseCachingDigestQueryParameterTmp!=null && !"".equals(responseCachingDigestQueryParameterTmp)) {
  268.                 responseCachingDigestQueryParameter = StatoFunzionalitaCacheDigestQueryParameter.toEnumConstant(responseCachingDigestQueryParameterTmp, true);
  269.             }
  270.             String responseCachingDigestNomiParametriQuery = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_RESPONSE_DIGEST_QUERY_PARAMETERS_NOMI);
  271.            
  272.             String responseCachingCacheControlNoCacheTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_NO_CACHE);
  273.             boolean responseCachingCacheControlNoCache = ServletUtils.isCheckBoxEnabled(responseCachingCacheControlNoCacheTmp);
  274.             String responseCachingCacheControlMaxAgeTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_MAX_AGE);
  275.             boolean responseCachingCacheControlMaxAge = ServletUtils.isCheckBoxEnabled(responseCachingCacheControlMaxAgeTmp);
  276.             String responseCachingCacheControlNoStoreTmp = confHelper.getParameter(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_CACHE_CONTROL_NO_STORE);
  277.             boolean responseCachingCacheControlNoStore = ServletUtils.isCheckBoxEnabled(responseCachingCacheControlNoStoreTmp);

  278.             Boolean confPersB = ServletUtils.getConfigurazioniPersonalizzateFromSession(session);
  279.             String confPers = confPersB ? "true" : "false";
  280.             Configurazione configurazione = confCore.getConfigurazioneGenerale();
  281.             ResponseCachingConfigurazioneGenerale responseCachingGenerale = configurazione.getResponseCaching();
  282.             ResponseCachingConfigurazione cachingConfigurazione = responseCachingGenerale != null ? responseCachingGenerale.getConfigurazione() : null;
  283.             boolean visualizzaLinkConfigurazioneRegola = confHelper.isResponseCachingAbilitato(cachingConfigurazione) && responseCachingEnabled;
  284.             String servletResponseCachingConfigurazioneRegolaList = ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_RESPONSE_CACHING_CONFIGURAZIONE_REGOLA_LIST;
  285.             List<Parameter> paramsResponseCachingConfigurazioneRegolaList = new ArrayList<>();
  286.             int numeroResponseCachingConfigurazioneRegola = confHelper.numeroRegoleResponseCaching(cachingConfigurazione);
  287.             List<ResponseCachingConfigurazioneRegola> listaRegoleCachingConfigurazione = cachingConfigurazione != null ?  cachingConfigurazione.getRegolaList() : null;
  288.             int numeroRegoleProxyPass = confHelper.numeroRegoleProxyPass(configurazione.getUrlInvocazione());
  289.             int numeroArchiviPlugins = confHelper.numeroPluginsRegistroArchivi();
  290.             int numeroClassiPlugins = confHelper.numeroPluginsRegistroClassi();
  291.            
  292.             String canaliEnabledTmp = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_STATO);
  293.             boolean canaliEnabled = ServletUtils.isCheckBoxEnabled(canaliEnabledTmp);
  294.             CanaliConfigurazione gestioneCanali = configurazione.getGestioneCanali();
  295.             List<CanaleConfigurazione> canaleList = gestioneCanali != null ? gestioneCanali.getCanaleList() : null;
  296.             List<CanaleConfigurazioneNodo> nodoList = gestioneCanali != null ? gestioneCanali.getNodoList() : null;
  297.             int numeroCanali = confHelper.numeroCanali(gestioneCanali);
  298.             int numeroNodi = confHelper.numeroNodi(gestioneCanali);
  299.             String canaliNome = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_NOME);
  300.             String canaliDescrizione = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DESCRIZIONE);
  301.             String canaliDefault = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CANALI_DEFAULT);

  302.             String urlInvocazionePA = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PA);
  303.             String urlInvocazionePD = confHelper.getParameter(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_PROTOCOLLO_PREFIX_URL_INVOCAZIONE_PD);
  304.            
  305.             List<ExtendedInfo> extendedBeanList = new ArrayList<>();
  306.             if(extendedServletList!=null && !extendedServletList.isEmpty()){
  307.                 for (IExtendedFormServlet extendedServlet : extendedServletList) {

  308.                     if(extendedServlet==null) {
  309.                         throw new Exception("IExtendedFormServlet is null in list");
  310.                     }
  311.                    
  312.                     ExtendedInfo ei = new ExtendedInfo();
  313.                     ei.extendedServlet = extendedServlet;
  314.                     DBManager dbManager = null;
  315.                     Connection con = null;
  316.                     try{
  317.                         dbManager = DBManager.getInstance();
  318.                         con = dbManager.getConnection();
  319.                         ei.extendedBean = extendedServlet.getExtendedBean(con, "SingleInstance");
  320.                     }finally{
  321.                         dbManager.releaseConnection(con);
  322.                     }

  323.                     ei.extended = false;
  324.                     ei.extendedToNewWindow = false;
  325.                     if(extendedServlet!=null && extendedServlet.showExtendedInfoUpdate(request, session)){
  326.                         ei.extendedBean = extendedServlet.readHttpParameters(configurazione, TipoOperazione.CHANGE,  ei.extendedBean, request);
  327.                         ei.extended = true;
  328.                         ei.extendedToNewWindow = extendedServlet.extendedUpdateToNewWindow(request, session);
  329.                     }

  330.                     extendedBeanList.add(ei);

  331.                 }
  332.             }



  333.             // Preparo il menu
  334.             confHelper.makeMenu();

  335.             // setto la barra del titolo
  336.             String title = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE;
  337.             if(isAllHiddenConfigurazione) {
  338.                 title = ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE;
  339.             }
  340.             ServletUtils.setPageDataTitle_ServletFirst(pd, title, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE);

  341.             // Se idhid != null, modifico i dati della porta di dominio nel
  342.             // db
  343.             if (!confHelper.isEditModeInProgress()) {

  344.                 // Controlli sui campi immessi
  345.                 boolean isOk = confHelper.configurazioneCheckData();
  346.                 if (isOk) {
  347.                     if(extendedBeanList!=null && !extendedBeanList.isEmpty()){
  348.                         for (ExtendedInfo ei : extendedBeanList) {
  349.                             if(ei.extended && !ei.extendedToNewWindow){
  350.                                 try{
  351.                                     ei.extendedServlet.checkDati(TipoOperazione.CHANGE, confHelper, confCore, configurazione, ei.extendedBean);
  352.                                 }catch(Exception e){
  353.                                     isOk = false;
  354.                                     pd.setMessage(e.getMessage());
  355.                                 }
  356.                             }
  357.                         }
  358.                     }
  359.                 }
  360.                 if (!isOk) {
  361.                     // preparo i campi
  362.                     List<DataElement> dati = new ArrayList<>();

  363.                     dati.add(ServletUtils.getDataElementForEditModeFinished());

  364.                     DataElement de = new DataElement();
  365.                     de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CACHES);
  366.                     de.setValue(configurazioneCachesTmp);
  367.                     de.setType(DataElementType.HIDDEN);
  368.                     dati.add(de);
  369.                    
  370.                     dati = confHelper.addConfigurazioneToDati( isAllHiddenConfigurazione,
  371.                             inoltromin, stato, controllo, severita, severitaLog4j, integman, nomeintegman, profcoll,
  372.                             connessione, utilizzo, validman, gestman, registrazioneTracce, dumpPD, dumpPA,
  373.                             xsd, tipoValidazione, confPers, configurazione, dati, applicaMTOM,
  374.                             urlInvocazionePA, urlInvocazionePD,
  375.                             multitenantEnabled, multitenantSoggettiFruizioni, multitenantSoggettiErogazioni,
  376.                             true,
  377.                             corsStato, corsTipo, corsAllAllowOrigins, corsAllAllowHeaders, corsAllAllowMethods,
  378.                             corsAllowHeaders, corsAllowOrigins, corsAllowMethods, corsAllowCredential, corsExposeHeaders, corsMaxAge, corsMaxAgeSeconds,
  379.                             responseCachingEnabled, responseCachingSeconds, responseCachingMaxResponseSize, responseCachingMaxResponseSizeBytes,
  380.                             responseCachingDigestUrlInvocazione, responseCachingDigestHeaders, responseCachingDigestPayload, responseCachingDigestHeadersNomiHeaders, responseCachingDigestQueryParameter, responseCachingDigestNomiParametriQuery,
  381.                             responseCachingCacheControlNoCache, responseCachingCacheControlMaxAge, responseCachingCacheControlNoStore, visualizzaLinkConfigurazioneRegola,
  382.                             servletResponseCachingConfigurazioneRegolaList, paramsResponseCachingConfigurazioneRegolaList, numeroResponseCachingConfigurazioneRegola, numeroRegoleProxyPass,
  383.                             canaliEnabled, numeroCanali, numeroNodi, canaliNome, canaliDescrizione, canaleList, canaliDefault,
  384.                             numeroArchiviPlugins, numeroClassiPlugins);

  385.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_DATI_RICHIESTE,
  386.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_DATI_RICHIESTE,statoCachEdatiRichieste,
  387.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_DATI_RICHIESTE,dimensionecachEdatiRichieste,
  388.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_DATI_RICHIESTE,algoritmocachEdatiRichieste,
  389.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_DATI_RICHIESTE,idlecachEdatiRichieste,
  390.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_DATI_RICHIESTE,lifecachEdatiRichieste,
  391.                             isAllHiddenCache);
  392.                    
  393.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_REGISTRY,
  394.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_REGISTRY,statoCacheRegistry,
  395.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_REGISTRY,dimensionecacheRegistry,
  396.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_REGISTRY,algoritmocacheRegistry,
  397.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_REGISTRY,idlecacheRegistry,
  398.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_REGISTRY,lifecacheRegistry,
  399.                             isAllHiddenCache);
  400.                    
  401.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONFIG,
  402.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONFIG,statoCacheConfig,
  403.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONFIG,dimensionecacheConfig,
  404.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONFIG,algoritmocacheConfig,
  405.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONFIG,idlecacheConfig,
  406.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONFIG,lifecacheConfig,
  407.                             isAllHiddenCache);

  408.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_AUTHZ,
  409.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHZ,statoCacheAuthz,
  410.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHZ,dimensionecacheAuthz,
  411.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHZ,algoritmocacheAuthz,
  412.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHZ,idlecacheAuthz,
  413.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHZ,lifecacheAuthz,
  414.                             isAllHiddenCache);

  415.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_AUTHN,
  416.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHN,statoCacheAuthn,
  417.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHN,dimensionecacheAuthn,
  418.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHN,algoritmocacheAuthn,
  419.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHN,idlecacheAuthn,
  420.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHN,lifecacheAuthn,
  421.                             isAllHiddenCache);

  422.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_TOKEN,
  423.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_TOKEN,statoCacheToken,
  424.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_TOKEN,dimensionecacheToken,
  425.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_TOKEN,algoritmocacheToken,
  426.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_TOKEN,idlecacheToken,
  427.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_TOKEN,lifecacheToken,
  428.                             isAllHiddenCache);
  429.                    
  430.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_ATTRIBUTE_AUTHORITY,
  431.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_ATTRIBUTE_AUTHORITY,statoCacheAA,
  432.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_ATTRIBUTE_AUTHORITY,dimensionecacheAA,
  433.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_ATTRIBUTE_AUTHORITY,algoritmocacheAA,
  434.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_ATTRIBUTE_AUTHORITY,idlecacheAA,
  435.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_ATTRIBUTE_AUTHORITY,lifecacheAA,
  436.                             isAllHiddenCache);
  437.                    
  438.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_KEYSTORE,
  439.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_KEYSTORE,statoCacheKeystore,
  440.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_KEYSTORE,dimensionecacheKeystore,
  441.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_KEYSTORE,algoritmocacheKeystore,
  442.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_KEYSTORE,idlecacheKeystore,
  443.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_KEYSTORE,lifecacheKeystore,
  444.                             isAllHiddenCache);
  445.                     confHelper.setDataElementCRLCacheInfo(dati,
  446.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CRL_LIFE_CACHE_KEYSTORE,crlLifecacheKeystore,
  447.                             isAllHiddenCache);

  448.                     if(!isAllHiddenCache) {
  449.                         confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONTROLLO_TRAFFICO,
  450.                                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONTROLLO_TRAFFICO,statoCacheControlloTraffico,
  451.                                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONTROLLO_TRAFFICO,dimensionecacheControlloTraffico,
  452.                                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONTROLLO_TRAFFICO,algoritmocacheControlloTraffico,
  453.                                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONTROLLO_TRAFFICO,idlecacheControlloTraffico,
  454.                                 ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONTROLLO_TRAFFICO,lifecacheControlloTraffico,
  455.                                 isAllHiddenCache);
  456.                     }
  457.                    
  458.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_RISPOSTE,
  459.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_RISPOSTE,statoCacheRisposte,
  460.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_RISPOSTE,dimensionecacheRisposte,
  461.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_RISPOSTE,algoritmocacheRisposte,
  462.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_RISPOSTE,idlecacheRisposte,
  463.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_RISPOSTE,lifecacheRisposte,
  464.                             isAllHiddenCache);
  465.                    
  466.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONSEGNA_APPLICATIVI,
  467.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONSEGNA,statoCacheConsegna,
  468.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONSEGNA,dimensionecacheConsegna,
  469.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONSEGNA,algoritmocacheConsegna,
  470.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONSEGNA,idlecacheConsegna,
  471.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONSEGNA,lifecacheConsegna,
  472.                             isAllHiddenCache);

  473.                     if(extendedBeanList!=null && !extendedBeanList.isEmpty()){
  474.                         for (ExtendedInfo ei : extendedBeanList) {
  475.                             if(ei.extended){
  476.                                 if(ei.extendedToNewWindow){
  477.                                     AbstractServletNewWindowChangeExtended.addToDatiNewWindow(ei.extendedServlet,
  478.                                             dati, confHelper, confCore, configurazione, ei.extendedBean, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE_EXTENDED);
  479.                                 }else{
  480.                                     ei.extendedServlet.addToDati(dati, TipoOperazione.CHANGE, confHelper, confCore, configurazione, ei.extendedBean);
  481.                                 }
  482.                             }
  483.                         }
  484.                     }

  485.                     pd.setDati(dati);

  486.                     ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  487.                     return ServletUtils.getStrutsForwardEditModeCheckError(mapping,
  488.                             ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_GENERALE,
  489.                             ConfigurazioneCostanti.TIPO_OPERAZIONE_CONFIGURAZIONE_GENERALE);
  490.                 }

  491.                 // Modifico i dati della porta di dominio nel db
  492.                 Configurazione newConfigurazione = confCore.getConfigurazioneGenerale();

  493.                 if (newConfigurazione.getInoltroBusteNonRiscontrate() != null) {
  494.                     newConfigurazione.getInoltroBusteNonRiscontrate().setCadenza(inoltromin);
  495.                 } else {
  496.                     InoltroBusteNonRiscontrate ibnr = new InoltroBusteNonRiscontrate();
  497.                     ibnr.setCadenza(inoltromin);
  498.                     newConfigurazione.setInoltroBusteNonRiscontrate(ibnr);
  499.                 }

  500.                 if (newConfigurazione.getValidazioneBuste() != null) {
  501.                     newConfigurazione.getValidazioneBuste().setStato(StatoFunzionalitaConWarning.toEnumConstant(stato));
  502.                     newConfigurazione.getValidazioneBuste().setControllo(ValidazioneBusteTipoControllo.toEnumConstant(controllo));
  503.                     newConfigurazione.getValidazioneBuste().setProfiloCollaborazione(StatoFunzionalita.toEnumConstant(profcoll));
  504.                     newConfigurazione.getValidazioneBuste().setManifestAttachments(StatoFunzionalita.toEnumConstant(validman));
  505.                 } else {
  506.                     ValidazioneBuste vbe = new ValidazioneBuste();
  507.                     vbe.setStato(StatoFunzionalitaConWarning.toEnumConstant(stato));
  508.                     vbe.setControllo(ValidazioneBusteTipoControllo.toEnumConstant(controllo));
  509.                     vbe.setProfiloCollaborazione(StatoFunzionalita.toEnumConstant(profcoll));
  510.                     vbe.setManifestAttachments(StatoFunzionalita.toEnumConstant(validman));
  511.                     newConfigurazione.setValidazioneBuste(vbe);
  512.                 }

  513.                 if (newConfigurazione.getMessaggiDiagnostici() != null) {
  514.                     newConfigurazione.getMessaggiDiagnostici().setSeverita(Severita.toEnumConstant(severita));
  515.                     newConfigurazione.getMessaggiDiagnostici().setSeveritaLog4j(Severita.toEnumConstant(severitaLog4j));
  516.                 } else {
  517.                     MessaggiDiagnostici md = new MessaggiDiagnostici();
  518.                     md.setSeverita(Severita.toEnumConstant(severita));
  519.                     md.setSeveritaLog4j(Severita.toEnumConstant(severitaLog4j));
  520.                     newConfigurazione.setMessaggiDiagnostici(md);
  521.                 }

  522.                 if (newConfigurazione.getIntegrationManager() != null) {
  523.                     if (integman == null || !integman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_IM_CUSTOM))
  524.                         newConfigurazione.getIntegrationManager().setAutenticazione(integman);
  525.                     else
  526.                         newConfigurazione.getIntegrationManager().setAutenticazione(nomeintegman);
  527.                 } else {
  528.                     IntegrationManager im = new IntegrationManager();
  529.                     if (integman == null || !integman.equals(ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_IM_CUSTOM))
  530.                         im.setAutenticazione(integman);
  531.                     else
  532.                         im.setAutenticazione(nomeintegman);
  533.                     newConfigurazione.setIntegrationManager(im);
  534.                 }

  535.                 if (newConfigurazione.getRisposte() != null) {
  536.                     newConfigurazione.getRisposte().setConnessione(TipoConnessioneRisposte.toEnumConstant(connessione));
  537.                 } else {
  538.                     Risposte rs = new Risposte();
  539.                     rs.setConnessione(TipoConnessioneRisposte.toEnumConstant(connessione));
  540.                     newConfigurazione.setRisposte(rs);
  541.                 }

  542.                 if (newConfigurazione.getIndirizzoRisposta() != null) {
  543.                     newConfigurazione.getIndirizzoRisposta().setUtilizzo(StatoFunzionalita.toEnumConstant(utilizzo));
  544.                 } else {
  545.                     IndirizzoRisposta it = new IndirizzoRisposta();
  546.                     it.setUtilizzo(StatoFunzionalita.toEnumConstant(utilizzo));
  547.                     newConfigurazione.setIndirizzoRisposta(it);
  548.                 }

  549.                 if (newConfigurazione.getAttachments() != null) {
  550.                     newConfigurazione.getAttachments().setGestioneManifest(StatoFunzionalita.toEnumConstant(gestman));
  551.                 } else {
  552.                     Attachments a = new Attachments();
  553.                     a.setGestioneManifest(StatoFunzionalita.toEnumConstant(gestman));
  554.                     newConfigurazione.setAttachments(a);
  555.                 }

  556.                 if (newConfigurazione.getTracciamento() != null) {
  557.                     newConfigurazione.getTracciamento().setStato(StatoFunzionalita.toEnumConstant(registrazioneTracce));
  558.                 } else {
  559.                     Tracciamento t = new Tracciamento();
  560.                     t.setStato(StatoFunzionalita.toEnumConstant(registrazioneTracce));
  561.                     newConfigurazione.setTracciamento(t);
  562.                 }

  563.                 if (newConfigurazione.getDump() != null) {
  564.                     newConfigurazione.getDump().setDumpBinarioPortaDelegata(StatoFunzionalita.toEnumConstant(dumpPD));
  565.                     newConfigurazione.getDump().setDumpBinarioPortaApplicativa(StatoFunzionalita.toEnumConstant(dumpPA));
  566.                 } else {
  567.                     Dump d = new Dump();
  568.                     d.setStato(StatoFunzionalita.DISABILITATO);
  569.                     d.setDumpBinarioPortaDelegata(StatoFunzionalita.toEnumConstant(dumpPD));
  570.                     d.setDumpBinarioPortaApplicativa(StatoFunzionalita.toEnumConstant(dumpPA));
  571.                     newConfigurazione.setDump(d);
  572.                 }

  573.                 if (newConfigurazione.getValidazioneContenutiApplicativi() != null) {
  574.                     newConfigurazione.getValidazioneContenutiApplicativi().setStato(StatoFunzionalitaConWarning.toEnumConstant(xsd));
  575.                     newConfigurazione.getValidazioneContenutiApplicativi().setTipo(ValidazioneContenutiApplicativiTipo.toEnumConstant(tipoValidazione));
  576.                     if(applicaMTOM != null){
  577.                         if(ServletUtils.isCheckBoxEnabled(applicaMTOM))
  578.                             newConfigurazione.getValidazioneContenutiApplicativi().setAcceptMtomMessage(StatoFunzionalita.ABILITATO);
  579.                         else
  580.                             newConfigurazione.getValidazioneContenutiApplicativi().setAcceptMtomMessage(StatoFunzionalita.DISABILITATO);
  581.                     } else
  582.                         newConfigurazione.getValidazioneContenutiApplicativi().setAcceptMtomMessage(null);
  583.                 } else {
  584.                     ValidazioneContenutiApplicativi vca = new ValidazioneContenutiApplicativi();
  585.                     vca.setStato(StatoFunzionalitaConWarning.toEnumConstant(xsd));
  586.                     vca.setTipo(ValidazioneContenutiApplicativiTipo.toEnumConstant(tipoValidazione));
  587.                     vca.setAcceptMtomMessage(null);
  588.                     newConfigurazione.setValidazioneContenutiApplicativi(vca);
  589.                 }

  590.                 if(newConfigurazione.getAccessoRegistro()==null){
  591.                     newConfigurazione.setAccessoRegistro(new AccessoRegistro());
  592.                 }
  593.                 if(statoCacheRegistry.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  594.                     newConfigurazione.getAccessoRegistro().setCache(new Cache());
  595.                     newConfigurazione.getAccessoRegistro().getCache().setDimensione(dimensionecacheRegistry);
  596.                     newConfigurazione.getAccessoRegistro().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheRegistry));
  597.                     newConfigurazione.getAccessoRegistro().getCache().setItemIdleTime(idlecacheRegistry);
  598.                     newConfigurazione.getAccessoRegistro().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheRegistry));
  599.                 }
  600.                 else{
  601.                     newConfigurazione.getAccessoRegistro().setCache(null);
  602.                 }
  603.                
  604.                 if(newConfigurazione.getAccessoConfigurazione()==null){
  605.                     newConfigurazione.setAccessoConfigurazione(new AccessoConfigurazione());
  606.                 }
  607.                 if(statoCacheConfig.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  608.                     newConfigurazione.getAccessoConfigurazione().setCache(new Cache());
  609.                     newConfigurazione.getAccessoConfigurazione().getCache().setDimensione(dimensionecacheConfig);
  610.                     newConfigurazione.getAccessoConfigurazione().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheConfig));
  611.                     newConfigurazione.getAccessoConfigurazione().getCache().setItemIdleTime(idlecacheConfig);
  612.                     newConfigurazione.getAccessoConfigurazione().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheConfig));
  613.                 }
  614.                 else{
  615.                     newConfigurazione.getAccessoConfigurazione().setCache(null);
  616.                 }

  617.                 if(newConfigurazione.getAccessoDatiAutorizzazione()==null){
  618.                     newConfigurazione.setAccessoDatiAutorizzazione(new AccessoDatiAutorizzazione());
  619.                 }
  620.                 if(statoCacheAuthz.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  621.                     newConfigurazione.getAccessoDatiAutorizzazione().setCache(new Cache());
  622.                     newConfigurazione.getAccessoDatiAutorizzazione().getCache().setDimensione(dimensionecacheAuthz);
  623.                     newConfigurazione.getAccessoDatiAutorizzazione().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheAuthz));
  624.                     newConfigurazione.getAccessoDatiAutorizzazione().getCache().setItemIdleTime(idlecacheAuthz);
  625.                     newConfigurazione.getAccessoDatiAutorizzazione().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheAuthz));
  626.                 }
  627.                 else{
  628.                     newConfigurazione.getAccessoDatiAutorizzazione().setCache(null);
  629.                 }

  630.                 if(newConfigurazione.getAccessoDatiAutenticazione()==null){
  631.                     newConfigurazione.setAccessoDatiAutenticazione(new AccessoDatiAutenticazione());
  632.                 }
  633.                 if(statoCacheAuthn.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  634.                     newConfigurazione.getAccessoDatiAutenticazione().setCache(new Cache());
  635.                     newConfigurazione.getAccessoDatiAutenticazione().getCache().setDimensione(dimensionecacheAuthn);
  636.                     newConfigurazione.getAccessoDatiAutenticazione().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheAuthn));
  637.                     newConfigurazione.getAccessoDatiAutenticazione().getCache().setItemIdleTime(idlecacheAuthn);
  638.                     newConfigurazione.getAccessoDatiAutenticazione().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheAuthn));
  639.                 }
  640.                 else{
  641.                     newConfigurazione.getAccessoDatiAutenticazione().setCache(null);
  642.                 }

  643.                 if(newConfigurazione.getAccessoDatiGestioneToken()==null){
  644.                     newConfigurazione.setAccessoDatiGestioneToken(new AccessoDatiGestioneToken());
  645.                 }
  646.                 if(statoCacheToken.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  647.                     newConfigurazione.getAccessoDatiGestioneToken().setCache(new Cache());
  648.                     newConfigurazione.getAccessoDatiGestioneToken().getCache().setDimensione(dimensionecacheToken);
  649.                     newConfigurazione.getAccessoDatiGestioneToken().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheToken));
  650.                     newConfigurazione.getAccessoDatiGestioneToken().getCache().setItemIdleTime(idlecacheToken);
  651.                     newConfigurazione.getAccessoDatiGestioneToken().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheToken));
  652.                 }
  653.                 else{
  654.                     newConfigurazione.getAccessoDatiGestioneToken().setCache(null);
  655.                 }
  656.                
  657.                 if(newConfigurazione.getAccessoDatiAttributeAuthority()==null){
  658.                     newConfigurazione.setAccessoDatiAttributeAuthority(new AccessoDatiAttributeAuthority());
  659.                 }
  660.                 if(statoCacheAA.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  661.                     newConfigurazione.getAccessoDatiAttributeAuthority().setCache(new Cache());
  662.                     newConfigurazione.getAccessoDatiAttributeAuthority().getCache().setDimensione(dimensionecacheAA);
  663.                     newConfigurazione.getAccessoDatiAttributeAuthority().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheAA));
  664.                     newConfigurazione.getAccessoDatiAttributeAuthority().getCache().setItemIdleTime(idlecacheAA);
  665.                     newConfigurazione.getAccessoDatiAttributeAuthority().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheAA));
  666.                 }
  667.                 else{
  668.                     newConfigurazione.getAccessoDatiAttributeAuthority().setCache(null);
  669.                 }
  670.                
  671.                 if(newConfigurazione.getAccessoDatiKeystore()==null){
  672.                     newConfigurazione.setAccessoDatiKeystore(new AccessoDatiKeystore());
  673.                 }
  674.                 if(statoCacheKeystore.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  675.                     newConfigurazione.getAccessoDatiKeystore().setCache(new Cache());
  676.                     newConfigurazione.getAccessoDatiKeystore().getCache().setDimensione(dimensionecacheKeystore);
  677.                     newConfigurazione.getAccessoDatiKeystore().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheKeystore));
  678.                     newConfigurazione.getAccessoDatiKeystore().getCache().setItemIdleTime(idlecacheKeystore);
  679.                     newConfigurazione.getAccessoDatiKeystore().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheKeystore));
  680.                     newConfigurazione.getAccessoDatiKeystore().setCrlItemLifeSecond(confHelper.convertLifeCacheValue(crlLifecacheKeystore));
  681.                 }
  682.                 else{
  683.                     newConfigurazione.getAccessoDatiKeystore().setCache(null);
  684.                     newConfigurazione.getAccessoDatiKeystore().setCrlItemLifeSecond(null);
  685.                 }

  686.                 if(newConfigurazione.getResponseCaching()==null){
  687.                     newConfigurazione.setResponseCaching(new ResponseCachingConfigurazioneGenerale());
  688.                 }
  689.                 if(statoCacheRisposte.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  690.                     newConfigurazione.getResponseCaching().setCache(new Cache());
  691.                     newConfigurazione.getResponseCaching().getCache().setDimensione(dimensionecacheRisposte);
  692.                     newConfigurazione.getResponseCaching().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheRisposte));
  693.                     newConfigurazione.getResponseCaching().getCache().setItemIdleTime(idlecacheRisposte);
  694.                     newConfigurazione.getResponseCaching().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheRisposte));
  695.                 }
  696.                 else{
  697.                     newConfigurazione.getResponseCaching().setCache(null);
  698.                 }
  699.                
  700.                 if(newConfigurazione.getAccessoDatiConsegnaApplicativi()==null){
  701.                     newConfigurazione.setAccessoDatiConsegnaApplicativi(new AccessoDatiConsegnaApplicativi());
  702.                 }
  703.                 if(statoCacheConsegna.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  704.                     newConfigurazione.getAccessoDatiConsegnaApplicativi().setCache(new Cache());
  705.                     newConfigurazione.getAccessoDatiConsegnaApplicativi().getCache().setDimensione(dimensionecacheConsegna);
  706.                     newConfigurazione.getAccessoDatiConsegnaApplicativi().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocacheConsegna));
  707.                     newConfigurazione.getAccessoDatiConsegnaApplicativi().getCache().setItemIdleTime(idlecacheConsegna);
  708.                     newConfigurazione.getAccessoDatiConsegnaApplicativi().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecacheConsegna));
  709.                 }
  710.                 else{
  711.                     newConfigurazione.getAccessoDatiConsegnaApplicativi().setCache(null);
  712.                 }
  713.                
  714.                 if(newConfigurazione.getAccessoDatiRichieste()==null){
  715.                     newConfigurazione.setAccessoDatiRichieste(new AccessoDatiRichieste());
  716.                 }
  717.                 if(statoCachEdatiRichieste.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  718.                     newConfigurazione.getAccessoDatiRichieste().setCache(new Cache());
  719.                     newConfigurazione.getAccessoDatiRichieste().getCache().setDimensione(dimensionecachEdatiRichieste);
  720.                     newConfigurazione.getAccessoDatiRichieste().getCache().setAlgoritmo(AlgoritmoCache.toEnumConstant(algoritmocachEdatiRichieste));
  721.                     newConfigurazione.getAccessoDatiRichieste().getCache().setItemIdleTime(idlecachEdatiRichieste);
  722.                     newConfigurazione.getAccessoDatiRichieste().getCache().setItemLifeSecond(confHelper.convertLifeCacheValue(lifecachEdatiRichieste));
  723.                 }
  724.                 else{
  725.                     newConfigurazione.getAccessoDatiRichieste().setCache(null);
  726.                 }

  727.                 newConfigurazione.setMultitenant(new ConfigurazioneMultitenant());
  728.                 newConfigurazione.getMultitenant().setStato(multitenantEnabled ? StatoFunzionalita.ABILITATO : StatoFunzionalita.DISABILITATO);

  729.                 MultitenantSoggettiFruizioni multitenantSoggettiFruizioniEnum = null;
  730.                 if(multitenantSoggettiFruizioni!=null && !"".equals(multitenantSoggettiFruizioni)) {
  731.                     multitenantSoggettiFruizioniEnum = MultitenantSoggettiFruizioni.valueOf(multitenantSoggettiFruizioni);
  732.                 }
  733.                 if(multitenantSoggettiFruizioniEnum!=null) {
  734.                     switch (multitenantSoggettiFruizioniEnum) {
  735.                     case SOLO_SOGGETTI_ESTERNI:
  736.                         newConfigurazione.getMultitenant().setFruizioneSceltaSoggettiErogatori(PortaDelegataSoggettiErogatori.SOGGETTI_ESTERNI);
  737.                         break;
  738.                     case ESCLUDI_SOGGETTO_FRUITORE:
  739.                         newConfigurazione.getMultitenant().setFruizioneSceltaSoggettiErogatori(PortaDelegataSoggettiErogatori.ESCLUDI_SOGGETTO_FRUITORE);
  740.                         break;
  741.                     case TUTTI:
  742.                         newConfigurazione.getMultitenant().setFruizioneSceltaSoggettiErogatori(PortaDelegataSoggettiErogatori.TUTTI);
  743.                         break;
  744.                     }
  745.                 }
  746.                 else {
  747.                     newConfigurazione.getMultitenant().setFruizioneSceltaSoggettiErogatori(PortaDelegataSoggettiErogatori.SOGGETTI_ESTERNI); // default
  748.                 }


  749.                 MultitenantSoggettiErogazioni multitenantSoggettiErogazioniEnum = null;
  750.                 if(multitenantSoggettiErogazioni!=null && !"".equals(multitenantSoggettiErogazioni)) {
  751.                     multitenantSoggettiErogazioniEnum = MultitenantSoggettiErogazioni.valueOf(multitenantSoggettiErogazioni);
  752.                 }
  753.                 if(multitenantSoggettiErogazioniEnum!=null) {
  754.                     switch (multitenantSoggettiErogazioniEnum) {
  755.                     case SOLO_SOGGETTI_ESTERNI:
  756.                         newConfigurazione.getMultitenant().setErogazioneSceltaSoggettiFruitori(PortaApplicativaSoggettiFruitori.SOGGETTI_ESTERNI);
  757.                         break;
  758.                     case ESCLUDI_SOGGETTO_EROGATORE:
  759.                         newConfigurazione.getMultitenant().setErogazioneSceltaSoggettiFruitori(PortaApplicativaSoggettiFruitori.ESCLUDI_SOGGETTO_EROGATORE);
  760.                         break;
  761.                     case TUTTI:
  762.                         newConfigurazione.getMultitenant().setErogazioneSceltaSoggettiFruitori(PortaApplicativaSoggettiFruitori.TUTTI);
  763.                         break;
  764.                     }
  765.                 }
  766.                 else {
  767.                     newConfigurazione.getMultitenant().setErogazioneSceltaSoggettiFruitori(PortaApplicativaSoggettiFruitori.SOGGETTI_ESTERNI); // default
  768.                 }

  769.                
  770.                 // Url Invocazione
  771.                 if(newConfigurazione.getUrlInvocazione()==null) {
  772.                     newConfigurazione.setUrlInvocazione(new ConfigurazioneUrlInvocazione());
  773.                 }
  774.                 newConfigurazione.getUrlInvocazione().setBaseUrl(urlInvocazionePA);
  775.                 if(urlInvocazionePD!=null && !"".equals(urlInvocazionePD)) {
  776.                     newConfigurazione.getUrlInvocazione().setBaseUrlFruizione(urlInvocazionePD);
  777.                 }
  778.                 else {
  779.                     newConfigurazione.getUrlInvocazione().setBaseUrlFruizione(null);
  780.                 }
  781.                

  782.                 // cors
  783.                 CorsConfigurazione gestioneCors = confHelper.getGestioneCors(corsStato, corsTipo, corsAllAllowOrigins, corsAllAllowHeaders, corsAllAllowMethods,
  784.                         corsAllowHeaders, corsAllowOrigins, corsAllowMethods, corsAllowCredential, corsExposeHeaders, corsMaxAge,   corsMaxAgeSeconds);
  785.                 newConfigurazione.setGestioneCors(gestioneCors);
  786.                
  787.                 // Response Caching
  788.                 ResponseCachingConfigurazione responseCaching = confHelper.getResponseCaching(responseCachingEnabled, responseCachingSeconds, responseCachingMaxResponseSize, responseCachingMaxResponseSizeBytes,
  789.                         responseCachingDigestUrlInvocazione, responseCachingDigestHeaders, responseCachingDigestPayload, responseCachingDigestHeadersNomiHeaders, responseCachingDigestQueryParameter, responseCachingDigestNomiParametriQuery,
  790.                         responseCachingCacheControlNoCache, responseCachingCacheControlMaxAge, responseCachingCacheControlNoStore,listaRegoleCachingConfigurazione);
  791.                 if(newConfigurazione.getResponseCaching()==null) {
  792.                     newConfigurazione.setResponseCaching(new ResponseCachingConfigurazioneGenerale());
  793.                 }
  794.                 newConfigurazione.getResponseCaching().setConfigurazione(responseCaching);

  795.                 // canali
  796.                 CanaliConfigurazione newGestioneCanali = confHelper.getGestioneCanali(canaliEnabled, canaliDefault, canaleList, canaliNome, canaliDescrizione, nodoList);
  797.                 newConfigurazione.setGestioneCanali(newGestioneCanali);
  798.                
  799.                 numeroResponseCachingConfigurazioneRegola = responseCaching.sizeRegolaList();
  800.                 visualizzaLinkConfigurazioneRegola = responseCaching.getStato().equals(StatoFunzionalita.ABILITATO);

  801.                 confCore.performUpdateOperation(userLogin, confHelper.smista(), newConfigurazione);

  802.                 if(!isAllHiddenCache) {
  803.                     org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale configurazioneControlloTraffico = confCore.getConfigurazioneControlloTraffico();
  804.                     if(statoCacheControlloTraffico.equals(ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO)){
  805.                         configurazioneControlloTraffico.setCache(new org.openspcoop2.core.controllo_traffico.Cache());
  806.                         configurazioneControlloTraffico.getCache().setCache(true);
  807.                         configurazioneControlloTraffico.getCache().setSize(Long.valueOf(dimensionecacheControlloTraffico));
  808.                         configurazioneControlloTraffico.getCache().setAlgorithm(CacheAlgorithm.toEnumConstant(algoritmocacheControlloTraffico));
  809.                         if(idlecacheControlloTraffico!=null && !"".equals(idlecacheControlloTraffico)) {
  810.                             configurazioneControlloTraffico.getCache().setIdleTime(Long.valueOf(idlecacheControlloTraffico));
  811.                         }
  812.                         configurazioneControlloTraffico.getCache().setLifeTime(Long.valueOf(confHelper.convertLifeCacheValue(lifecacheControlloTraffico)));
  813.                     }
  814.                     else{
  815.                         configurazioneControlloTraffico.setCache(null);
  816.                     }
  817.                     confCore.performUpdateOperation(userLogin, confHelper.smista(), configurazioneControlloTraffico);
  818.                 }
  819.                
  820.                 if(extendedBeanList!=null && !extendedBeanList.isEmpty()){
  821.                     for (ExtendedInfo ei : extendedBeanList) {
  822.                         if(ei.extended && !ei.extendedToNewWindow){
  823.                             WrapperExtendedBean wrapperExtendedBean = new WrapperExtendedBean();
  824.                             wrapperExtendedBean.setExtendedBean(ei.extendedBean);
  825.                             wrapperExtendedBean.setExtendedServlet(ei.extendedServlet);
  826.                             wrapperExtendedBean.setOriginalBean(newConfigurazione);
  827.                             wrapperExtendedBean.setManageOriginalBean(false);
  828.                             confCore.performUpdateOperation(userLogin, confHelper.smista(), wrapperExtendedBean);
  829.                         }
  830.                     }
  831.                 }
  832.                
  833.                 List<DataElement> dati = new ArrayList<>();

  834.                 DataElement de = new DataElement();
  835.                 de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CACHES);
  836.                 de.setValue(configurazioneCachesTmp);
  837.                 de.setType(DataElementType.HIDDEN);
  838.                 dati.add(de);
  839.                
  840.                 dati = confHelper.addConfigurazioneToDati(isAllHiddenConfigurazione,
  841.                         inoltromin, stato, controllo, severita, severitaLog4j, integman, nomeintegman, profcoll,
  842.                         connessione, utilizzo, validman, gestman, registrazioneTracce, dumpPD, dumpPA,
  843.                         xsd, tipoValidazione, confPers, configurazione, dati, applicaMTOM,
  844.                         urlInvocazionePA, urlInvocazionePD,
  845.                         multitenantEnabled, multitenantSoggettiFruizioni, multitenantSoggettiErogazioni,
  846.                         false,
  847.                         corsStato, corsTipo, corsAllAllowOrigins, corsAllAllowHeaders, corsAllAllowMethods,
  848.                         corsAllowHeaders, corsAllowOrigins, corsAllowMethods, corsAllowCredential, corsExposeHeaders, corsMaxAge, corsMaxAgeSeconds,
  849.                         responseCachingEnabled, responseCachingSeconds, responseCachingMaxResponseSize, responseCachingMaxResponseSizeBytes,
  850.                         responseCachingDigestUrlInvocazione, responseCachingDigestHeaders, responseCachingDigestPayload, responseCachingDigestHeadersNomiHeaders, responseCachingDigestQueryParameter, responseCachingDigestNomiParametriQuery,
  851.                         responseCachingCacheControlNoCache, responseCachingCacheControlMaxAge, responseCachingCacheControlNoStore, visualizzaLinkConfigurazioneRegola,
  852.                         servletResponseCachingConfigurazioneRegolaList, paramsResponseCachingConfigurazioneRegolaList, numeroResponseCachingConfigurazioneRegola, numeroRegoleProxyPass,
  853.                         canaliEnabled, numeroCanali, numeroNodi, canaliNome, canaliDescrizione, canaleList, canaliDefault,
  854.                         numeroArchiviPlugins, numeroClassiPlugins);

  855.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_DATI_RICHIESTE,
  856.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_DATI_RICHIESTE,statoCachEdatiRichieste,
  857.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_DATI_RICHIESTE,dimensionecachEdatiRichieste,
  858.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_DATI_RICHIESTE,algoritmocachEdatiRichieste,
  859.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_DATI_RICHIESTE,idlecachEdatiRichieste,
  860.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_DATI_RICHIESTE,lifecachEdatiRichieste,
  861.                         isAllHiddenCache);
  862.                
  863.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_REGISTRY,
  864.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_REGISTRY,statoCacheRegistry,
  865.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_REGISTRY,dimensionecacheRegistry,
  866.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_REGISTRY,algoritmocacheRegistry,
  867.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_REGISTRY,idlecacheRegistry,
  868.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_REGISTRY,lifecacheRegistry,
  869.                         isAllHiddenCache);
  870.                
  871.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONFIG,
  872.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONFIG,statoCacheConfig,
  873.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONFIG,dimensionecacheConfig,
  874.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONFIG,algoritmocacheConfig,
  875.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONFIG,idlecacheConfig,
  876.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONFIG,lifecacheConfig,
  877.                         isAllHiddenCache);

  878.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_AUTHZ,
  879.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHZ,statoCacheAuthz,
  880.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHZ,dimensionecacheAuthz,
  881.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHZ,algoritmocacheAuthz,
  882.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHZ,idlecacheAuthz,
  883.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHZ,lifecacheAuthz,
  884.                         isAllHiddenCache);

  885.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_AUTHN,
  886.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHN,statoCacheAuthn,
  887.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHN,dimensionecacheAuthn,
  888.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHN,algoritmocacheAuthn,
  889.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHN,idlecacheAuthn,
  890.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHN,lifecacheAuthn,
  891.                         isAllHiddenCache);

  892.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_TOKEN,
  893.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_TOKEN,statoCacheToken,
  894.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_TOKEN,dimensionecacheToken,
  895.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_TOKEN,algoritmocacheToken,
  896.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_TOKEN,idlecacheToken,
  897.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_TOKEN,lifecacheToken,
  898.                         isAllHiddenCache);
  899.                
  900.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_ATTRIBUTE_AUTHORITY,
  901.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_ATTRIBUTE_AUTHORITY,statoCacheAA,
  902.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_ATTRIBUTE_AUTHORITY,dimensionecacheAA,
  903.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_ATTRIBUTE_AUTHORITY,algoritmocacheAA,
  904.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_ATTRIBUTE_AUTHORITY,idlecacheAA,
  905.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_ATTRIBUTE_AUTHORITY,lifecacheAA,
  906.                         isAllHiddenCache);
  907.                
  908.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_KEYSTORE,
  909.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_KEYSTORE,statoCacheKeystore,
  910.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_KEYSTORE,dimensionecacheKeystore,
  911.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_KEYSTORE,algoritmocacheKeystore,
  912.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_KEYSTORE,idlecacheKeystore,
  913.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_KEYSTORE,lifecacheKeystore,
  914.                         isAllHiddenCache);
  915.                 confHelper.setDataElementCRLCacheInfo(dati,
  916.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CRL_LIFE_CACHE_KEYSTORE,crlLifecacheKeystore,
  917.                         isAllHiddenCache);

  918.                 if(!isAllHiddenCache) {
  919.                     confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONTROLLO_TRAFFICO,
  920.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONTROLLO_TRAFFICO,statoCacheControlloTraffico,
  921.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONTROLLO_TRAFFICO,dimensionecacheControlloTraffico,
  922.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONTROLLO_TRAFFICO,algoritmocacheControlloTraffico,
  923.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONTROLLO_TRAFFICO,idlecacheControlloTraffico,
  924.                             ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONTROLLO_TRAFFICO,lifecacheControlloTraffico,
  925.                             isAllHiddenCache);
  926.                 }
  927.                
  928.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_RISPOSTE,
  929.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_RISPOSTE,statoCacheRisposte,
  930.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_RISPOSTE,dimensionecacheRisposte,
  931.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_RISPOSTE,algoritmocacheRisposte,
  932.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_RISPOSTE,idlecacheRisposte,
  933.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_RISPOSTE,lifecacheRisposte,
  934.                         isAllHiddenCache);
  935.                
  936.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONSEGNA_APPLICATIVI,
  937.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONSEGNA,statoCacheConsegna,
  938.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONSEGNA,dimensionecacheConsegna,
  939.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONSEGNA,algoritmocacheConsegna,
  940.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONSEGNA,idlecacheConsegna,
  941.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONSEGNA,lifecacheConsegna,
  942.                         isAllHiddenCache);

  943.                 if(extendedBeanList!=null && !extendedBeanList.isEmpty()){
  944.                     for (ExtendedInfo ei : extendedBeanList) {
  945.                         if(ei.extended){
  946.                             if(ei.extendedToNewWindow){
  947.                                 AbstractServletNewWindowChangeExtended.addToDatiNewWindow(ei.extendedServlet,
  948.                                         dati, confHelper, confCore, newConfigurazione, ei.extendedBean, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE_EXTENDED);
  949.                             }else{
  950.                                 ei.extendedServlet.addToDati(dati, TipoOperazione.CHANGE, confHelper, confCore, newConfigurazione, ei.extendedBean);
  951.                             }
  952.                         }
  953.                     }
  954.                 }

  955.                 pd.setDati(dati);

  956.                 pd.setMessage(ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_GENERALE_MODIFICATA_CON_SUCCESSO, Costanti.MESSAGE_TYPE_INFO);

  957.                 pd.disableEditMode();

  958.                 generalHelper = new GeneralHelper(session);
  959.                 gd = generalHelper.initGeneralData(request); // re-inizializzo per ricalcolare il menu in alto a destra

  960.                 ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  961.                 return ServletUtils.getStrutsForwardEditModeFinished(mapping,
  962.                         ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_GENERALE,
  963.                         ConfigurazioneCostanti.TIPO_OPERAZIONE_CONFIGURAZIONE_GENERALE);
  964.             }
  965.            
  966.             String postBackElementName = confHelper.getPostBackElementName();
  967.             if(postBackElementName != null ){
  968.                 if(postBackElementName.equalsIgnoreCase(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_RESPONSE_CACHING_STATO)){
  969.                    
  970.                     if(!confHelper.isResponseCachingAbilitato(cachingConfigurazione) && responseCachingEnabled) {
  971.                         ResponseCachingConfigurazione configurazioneTmp = new ResponseCachingConfigurazione();
  972.                        
  973.                         responseCachingSeconds = configurazioneTmp.getCacheTimeoutSeconds() != null ? configurazioneTmp.getCacheTimeoutSeconds().intValue() : 1;
  974.                        
  975.                         responseCachingMaxResponseSize = false;
  976.                         if(configurazioneTmp.getMaxMessageSize() != null) {
  977.                             responseCachingMaxResponseSize = true;
  978.                             responseCachingMaxResponseSizeBytes = configurazioneTmp.getMaxMessageSize().longValue();
  979.                         }
  980.                        
  981.                         responseCachingDigestUrlInvocazione = true;
  982.                         responseCachingDigestQueryParameter = StatoFunzionalitaCacheDigestQueryParameter.ABILITATO;
  983.                         responseCachingDigestHeaders = false;
  984.                         responseCachingDigestPayload = true;
  985.                         configurazioneTmp.setHashGenerator(new ResponseCachingConfigurazioneHashGenerator());
  986.                         if(configurazioneTmp.getHashGenerator() != null) {
  987.                             if(configurazioneTmp.getHashGenerator().getQueryParameters() != null)
  988.                                 responseCachingDigestQueryParameter = configurazioneTmp.getHashGenerator().getQueryParameters();
  989.                            
  990.                             if(configurazioneTmp.getHashGenerator().getQueryParameterList() != null)  
  991.                                 responseCachingDigestNomiParametriQuery = StringUtils.join(configurazioneTmp.getHashGenerator().getQueryParameterList(), ",");
  992.                            
  993.                             if(configurazioneTmp.getHashGenerator().getHeaders() != null)  
  994.                                 responseCachingDigestHeaders = configurazioneTmp.getHashGenerator().getHeaders().equals(StatoFunzionalita.ABILITATO);
  995.                            
  996.                             if(configurazioneTmp.getHashGenerator().getHeaderList() != null)  
  997.                                 responseCachingDigestHeadersNomiHeaders = StringUtils.join(configurazioneTmp.getHashGenerator().getHeaderList(), ",");
  998.                            
  999.                             if(configurazioneTmp.getHashGenerator().getRequestUri() != null)
  1000.                                 responseCachingDigestUrlInvocazione = configurazioneTmp.getHashGenerator().getRequestUri().equals(StatoFunzionalita.ABILITATO);
  1001.                            
  1002.                             if(configurazioneTmp.getHashGenerator().getPayload() != null)
  1003.                                 responseCachingDigestPayload = configurazioneTmp.getHashGenerator().getPayload().equals(StatoFunzionalita.ABILITATO);
  1004.                         }
  1005.                        
  1006.                         responseCachingCacheControlNoCache = true;
  1007.                         responseCachingCacheControlMaxAge = true;
  1008.                         responseCachingCacheControlNoStore = true;
  1009.                         configurazioneTmp.setControl(new ResponseCachingConfigurazioneControl());
  1010.                         if(configurazioneTmp.getControl() != null) {
  1011.                             responseCachingCacheControlNoCache = configurazioneTmp.getControl().isNoCache();
  1012.                             responseCachingCacheControlMaxAge = configurazioneTmp.getControl().isMaxAge();
  1013.                             responseCachingCacheControlNoStore = configurazioneTmp.getControl().isNoStore();
  1014.                         }
  1015.                     }
  1016.                 }
  1017.                
  1018.                 if(postBackElementName.equalsIgnoreCase(CostantiControlStation.PARAMETRO_CONFIGURAZIONE_CORS_STATO)){
  1019.                     CorsConfigurazione oldConfigurazione = configurazione.getGestioneCors();
  1020.                     if(!confHelper.isCorsAbilitato(oldConfigurazione) && corsStato) {
  1021.                         CorsConfigurazione configurazioneTmp = new CorsConfigurazione();
  1022.                        
  1023.                         corsTipo = configurazioneTmp.getTipo();
  1024.                         if(configurazioneTmp.getTipo() != null && configurazioneTmp.getTipo().equals(TipoGestioneCORS.GATEWAY)) {

  1025.                             corsAllAllowOrigins = true;
  1026.                             if(configurazioneTmp.getAccessControlAllAllowOrigins() != null && configurazioneTmp.getAccessControlAllAllowOrigins().equals(StatoFunzionalita.DISABILITATO)) {
  1027.                                 corsAllAllowOrigins = false;

  1028.                                 configurazioneTmp.setAccessControlAllowOrigins(new CorsConfigurazioneOrigin());
  1029.                                 corsAllowOrigins = StringUtils.join(configurazioneTmp.getAccessControlAllowOrigins().getOriginList(), ",");
  1030.                             }

  1031.                             corsAllAllowHeaders = false;
  1032.                             if(configurazioneTmp.getAccessControlAllAllowHeaders() != null && configurazioneTmp.getAccessControlAllAllowHeaders().equals(StatoFunzionalita.ABILITATO)) {
  1033.                                 corsAllAllowHeaders = true;
  1034.                             }
  1035.                             if(!corsAllAllowHeaders) {
  1036.                                 configurazioneTmp.setAccessControlAllowHeaders(new CorsConfigurazioneHeaders());
  1037.                                 corsAllowHeaders = StringUtils.join(configurazioneTmp.getAccessControlAllowHeaders().getHeaderList(), ",");
  1038.                             }

  1039.                             corsAllAllowMethods = false;
  1040.                             if(configurazioneTmp.getAccessControlAllAllowMethods() != null && configurazioneTmp.getAccessControlAllAllowMethods().equals(StatoFunzionalita.ABILITATO)) {
  1041.                                 corsAllAllowMethods = true;
  1042.                             }
  1043.                             if(!corsAllAllowMethods) {
  1044.                                 configurazioneTmp.setAccessControlAllowMethods(new CorsConfigurazioneMethods());
  1045.                                 corsAllowMethods = StringUtils.join(configurazioneTmp.getAccessControlAllowMethods().getMethodList(), ",");
  1046.                             }

  1047.                             configurazioneTmp.setAccessControlExposeHeaders(new CorsConfigurazioneHeaders());
  1048.                             corsExposeHeaders = StringUtils.join(configurazioneTmp.getAccessControlExposeHeaders().getHeaderList(), ",");

  1049.                             corsAllowCredential = false;
  1050.                             if(configurazioneTmp.getAccessControlAllowCredentials() != null && configurazioneTmp.getAccessControlAllowCredentials().equals(StatoFunzionalita.ABILITATO)) {
  1051.                                 corsAllowCredential = true;
  1052.                             }

  1053.                             corsMaxAge = false;
  1054.                             corsMaxAgeSeconds = -1;
  1055.                             if(configurazioneTmp.getAccessControlMaxAge() != null ) {
  1056.                                 corsMaxAge = true;
  1057.                                 corsMaxAgeSeconds = configurazioneTmp.getAccessControlMaxAge();
  1058.                             }
  1059.                         }
  1060.                     }
  1061.                 }
  1062.             }

  1063.             if (inoltromin == null) {
  1064.                 inoltromin = configurazione.getInoltroBusteNonRiscontrate().getCadenza();
  1065.                 if(configurazione.getValidazioneBuste().getStato()!=null)
  1066.                     stato = configurazione.getValidazioneBuste().getStato().toString();
  1067.                 if(configurazione.getValidazioneBuste().getControllo()!=null)
  1068.                     controllo = configurazione.getValidazioneBuste().getControllo().toString();
  1069.                 if(configurazione.getMessaggiDiagnostici().getSeverita()!=null)
  1070.                     severita = configurazione.getMessaggiDiagnostici().getSeverita().toString();
  1071.                 if(configurazione.getMessaggiDiagnostici().getSeveritaLog4j()!=null)
  1072.                     severitaLog4j = configurazione.getMessaggiDiagnostici().getSeveritaLog4j().toString();
  1073.                 integman = configurazione.getIntegrationManager().getAutenticazione();
  1074.                 boolean foundIM = false;
  1075.                 if(integman!=null){
  1076.                     for (int i = 0; i < ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_IM.length; i++) {
  1077.                         if(ConfigurazioneCostanti.PARAMETRI_CONFIGURAZIONE_IM[i].equals(integman)){
  1078.                             foundIM = true;
  1079.                             break;
  1080.                         }
  1081.                     }
  1082.                 }
  1083.                 if (!foundIM) {
  1084.                     nomeintegman = integman;
  1085.                     integman = ConfigurazioneCostanti.DEFAULT_VALUE_PARAMETRO_CONFIGURAZIONE_IM_CUSTOM  ;
  1086.                 }
  1087.                 if(configurazione.getValidazioneBuste().getProfiloCollaborazione()!=null)
  1088.                     profcoll = configurazione.getValidazioneBuste().getProfiloCollaborazione().toString();
  1089.                 if(configurazione.getRisposte().getConnessione()!=null)
  1090.                     connessione = configurazione.getRisposte().getConnessione().toString();
  1091.                 if(configurazione.getIndirizzoRisposta().getUtilizzo()!=null)
  1092.                     utilizzo = configurazione.getIndirizzoRisposta().getUtilizzo().toString();
  1093.                 if(configurazione.getValidazioneBuste().getManifestAttachments()!=null)
  1094.                     validman = configurazione.getValidazioneBuste().getManifestAttachments().toString();
  1095.                 if(configurazione.getAttachments().getGestioneManifest()!=null)
  1096.                     gestman = configurazione.getAttachments().getGestioneManifest().toString();
  1097.                 if(configurazione.getTracciamento().getStato()!=null)
  1098.                     registrazioneTracce = configurazione.getTracciamento().getStato().toString();
  1099.                 if(configurazione.getDump().getDumpBinarioPortaDelegata()!=null)
  1100.                     dumpPD = configurazione.getDump().getDumpBinarioPortaDelegata().toString();
  1101.                 if(configurazione.getDump().getDumpBinarioPortaApplicativa()!=null)
  1102.                     dumpPA = configurazione.getDump().getDumpBinarioPortaApplicativa().toString();
  1103.                 if (configurazione.getValidazioneContenutiApplicativi() != null) {
  1104.                     if(configurazione.getValidazioneContenutiApplicativi().getStato()!=null)
  1105.                         xsd = configurazione.getValidazioneContenutiApplicativi().getStato().toString();
  1106.                     if(configurazione.getValidazioneContenutiApplicativi().getTipo()!=null)
  1107.                         tipoValidazione = configurazione.getValidazioneContenutiApplicativi().getTipo().toString();
  1108.                     if(configurazione.getValidazioneContenutiApplicativi().getAcceptMtomMessage()!=null){
  1109.                         if(StatoFunzionalita.ABILITATO.equals(configurazione.getValidazioneContenutiApplicativi().getAcceptMtomMessage())){
  1110.                             applicaMTOM = Costanti.CHECK_BOX_ENABLED_ABILITATO;
  1111.                         }
  1112.                         else{
  1113.                             applicaMTOM = Costanti.CHECK_BOX_DISABLED;
  1114.                         }
  1115.                     }
  1116.                 }
  1117.                 if(configurazione.getUrlInvocazione()!=null) {
  1118.                     urlInvocazionePA = configurazione.getUrlInvocazione().getBaseUrl();
  1119.                     if(configurazione.getUrlInvocazione().getBaseUrlFruizione()!=null) {
  1120.                         urlInvocazionePD = configurazione.getUrlInvocazione().getBaseUrlFruizione();
  1121.                     }
  1122.                     numeroRegoleProxyPass = configurazione.getUrlInvocazione().sizeRegolaList();
  1123.                 }
  1124.                 if(configurazione.getAccessoRegistro()!=null && configurazione.getAccessoRegistro().getCache()!=null){
  1125.                     statoCacheRegistry = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1126.                     dimensionecacheRegistry = configurazione.getAccessoRegistro().getCache().getDimensione();
  1127.                     if(configurazione.getAccessoRegistro().getCache().getAlgoritmo()!=null){
  1128.                         algoritmocacheRegistry = configurazione.getAccessoRegistro().getCache().getAlgoritmo().getValue();
  1129.                     }
  1130.                     idlecacheRegistry = configurazione.getAccessoRegistro().getCache().getItemIdleTime();
  1131.                     lifecacheRegistry = configurazione.getAccessoRegistro().getCache().getItemLifeSecond();
  1132.                 }
  1133.                 else{
  1134.                     statoCacheRegistry = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1135.                 }
  1136.                 if(configurazione.getAccessoConfigurazione()!=null && configurazione.getAccessoConfigurazione().getCache()!=null){
  1137.                     statoCacheConfig = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1138.                     dimensionecacheConfig = configurazione.getAccessoConfigurazione().getCache().getDimensione();
  1139.                     if(configurazione.getAccessoConfigurazione().getCache().getAlgoritmo()!=null){
  1140.                         algoritmocacheConfig = configurazione.getAccessoConfigurazione().getCache().getAlgoritmo().getValue();
  1141.                     }
  1142.                     idlecacheConfig = configurazione.getAccessoConfigurazione().getCache().getItemIdleTime();
  1143.                     lifecacheConfig = configurazione.getAccessoConfigurazione().getCache().getItemLifeSecond();
  1144.                 }
  1145.                 else{
  1146.                     statoCacheConfig = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1147.                 }
  1148.                 if(configurazione.getAccessoDatiAutorizzazione()!=null && configurazione.getAccessoDatiAutorizzazione().getCache()!=null){
  1149.                     statoCacheAuthz = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1150.                     dimensionecacheAuthz = configurazione.getAccessoDatiAutorizzazione().getCache().getDimensione();
  1151.                     if(configurazione.getAccessoDatiAutorizzazione().getCache().getAlgoritmo()!=null){
  1152.                         algoritmocacheAuthz = configurazione.getAccessoDatiAutorizzazione().getCache().getAlgoritmo().getValue();
  1153.                     }
  1154.                     idlecacheAuthz = configurazione.getAccessoDatiAutorizzazione().getCache().getItemIdleTime();
  1155.                     lifecacheAuthz = configurazione.getAccessoDatiAutorizzazione().getCache().getItemLifeSecond();
  1156.                 }
  1157.                 else{
  1158.                     statoCacheAuthz = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1159.                 }
  1160.                 if(configurazione.getAccessoDatiAutenticazione()!=null && configurazione.getAccessoDatiAutenticazione().getCache()!=null){
  1161.                     statoCacheAuthn = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1162.                     dimensionecacheAuthn = configurazione.getAccessoDatiAutenticazione().getCache().getDimensione();
  1163.                     if(configurazione.getAccessoDatiAutenticazione().getCache().getAlgoritmo()!=null){
  1164.                         algoritmocacheAuthn = configurazione.getAccessoDatiAutenticazione().getCache().getAlgoritmo().getValue();
  1165.                     }
  1166.                     idlecacheAuthn = configurazione.getAccessoDatiAutenticazione().getCache().getItemIdleTime();
  1167.                     lifecacheAuthn = configurazione.getAccessoDatiAutenticazione().getCache().getItemLifeSecond();
  1168.                 }
  1169.                 else{
  1170.                     statoCacheAuthn = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1171.                 }
  1172.                 if(configurazione.getAccessoDatiGestioneToken()!=null && configurazione.getAccessoDatiGestioneToken().getCache()!=null){
  1173.                     statoCacheToken = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1174.                     dimensionecacheToken = configurazione.getAccessoDatiGestioneToken().getCache().getDimensione();
  1175.                     if(configurazione.getAccessoDatiGestioneToken().getCache().getAlgoritmo()!=null){
  1176.                         algoritmocacheToken = configurazione.getAccessoDatiGestioneToken().getCache().getAlgoritmo().getValue();
  1177.                     }
  1178.                     idlecacheToken = configurazione.getAccessoDatiGestioneToken().getCache().getItemIdleTime();
  1179.                     lifecacheToken = configurazione.getAccessoDatiGestioneToken().getCache().getItemLifeSecond();
  1180.                 }
  1181.                 else{
  1182.                     statoCacheToken = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1183.                 }
  1184.                 if(configurazione.getAccessoDatiAttributeAuthority()!=null && configurazione.getAccessoDatiAttributeAuthority().getCache()!=null){
  1185.                     statoCacheAA = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1186.                     dimensionecacheAA = configurazione.getAccessoDatiAttributeAuthority().getCache().getDimensione();
  1187.                     if(configurazione.getAccessoDatiAttributeAuthority().getCache().getAlgoritmo()!=null){
  1188.                         algoritmocacheAA = configurazione.getAccessoDatiAttributeAuthority().getCache().getAlgoritmo().getValue();
  1189.                     }
  1190.                     idlecacheAA = configurazione.getAccessoDatiAttributeAuthority().getCache().getItemIdleTime();
  1191.                     lifecacheAA = configurazione.getAccessoDatiAttributeAuthority().getCache().getItemLifeSecond();
  1192.                 }
  1193.                 else{
  1194.                     statoCacheAA = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1195.                 }
  1196.                 if(configurazione.getAccessoDatiKeystore()!=null && configurazione.getAccessoDatiKeystore().getCache()!=null){
  1197.                     statoCacheKeystore = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1198.                     dimensionecacheKeystore = configurazione.getAccessoDatiKeystore().getCache().getDimensione();
  1199.                     if(configurazione.getAccessoDatiKeystore().getCache().getAlgoritmo()!=null){
  1200.                         algoritmocacheKeystore = configurazione.getAccessoDatiKeystore().getCache().getAlgoritmo().getValue();
  1201.                     }
  1202.                     idlecacheKeystore = configurazione.getAccessoDatiKeystore().getCache().getItemIdleTime();
  1203.                     lifecacheKeystore = configurazione.getAccessoDatiKeystore().getCache().getItemLifeSecond();
  1204.                     crlLifecacheKeystore = configurazione.getAccessoDatiKeystore().getCrlItemLifeSecond();
  1205.                 }
  1206.                 else{
  1207.                     statoCacheKeystore = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1208.                 }
  1209.                 if(!isAllHiddenCache) {
  1210.                     org.openspcoop2.core.controllo_traffico.ConfigurazioneGenerale configurazioneControlloTraffico = confCore.getConfigurazioneControlloTraffico();
  1211.                     if(configurazioneControlloTraffico.getCache()!=null && configurazioneControlloTraffico.getCache().isCache()){
  1212.                         statoCacheControlloTraffico = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1213.                         dimensionecacheControlloTraffico = configurazioneControlloTraffico.getCache().getSize()+"";
  1214.                         if(configurazioneControlloTraffico.getCache().getAlgorithm()!=null){
  1215.                             algoritmocacheControlloTraffico = configurazioneControlloTraffico.getCache().getAlgorithm().getValue();
  1216.                         }
  1217.                         if(configurazioneControlloTraffico.getCache().getIdleTime()!=null) {
  1218.                             idlecacheControlloTraffico = configurazioneControlloTraffico.getCache().getIdleTime()+"";
  1219.                         }
  1220.                         lifecacheControlloTraffico = configurazioneControlloTraffico.getCache().getLifeTime()+"";
  1221.                     }
  1222.                     else{
  1223.                         statoCacheControlloTraffico = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1224.                     }
  1225.                 }
  1226.                 if(configurazione.getResponseCaching()!=null && configurazione.getResponseCaching().getCache()!=null) {
  1227.                     statoCacheRisposte = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1228.                     dimensionecacheRisposte = configurazione.getResponseCaching().getCache().getDimensione();
  1229.                     if(configurazione.getResponseCaching().getCache().getAlgoritmo()!=null){
  1230.                         algoritmocacheRisposte = configurazione.getResponseCaching().getCache().getAlgoritmo().getValue();
  1231.                     }
  1232.                     idlecacheRisposte = configurazione.getResponseCaching().getCache().getItemIdleTime();
  1233.                     lifecacheRisposte = configurazione.getResponseCaching().getCache().getItemLifeSecond();
  1234.                 }
  1235.                 else{
  1236.                     statoCacheRisposte = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1237.                 }
  1238.                 if(configurazione.getAccessoDatiConsegnaApplicativi()!=null && configurazione.getAccessoDatiConsegnaApplicativi().getCache()!=null) {
  1239.                     statoCacheConsegna = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1240.                     dimensionecacheConsegna = configurazione.getAccessoDatiConsegnaApplicativi().getCache().getDimensione();
  1241.                     if(configurazione.getAccessoDatiConsegnaApplicativi().getCache().getAlgoritmo()!=null){
  1242.                         algoritmocacheConsegna = configurazione.getAccessoDatiConsegnaApplicativi().getCache().getAlgoritmo().getValue();
  1243.                     }
  1244.                     idlecacheConsegna = configurazione.getAccessoDatiConsegnaApplicativi().getCache().getItemIdleTime();
  1245.                     lifecacheConsegna = configurazione.getAccessoDatiConsegnaApplicativi().getCache().getItemLifeSecond();
  1246.                 }
  1247.                 else{
  1248.                     statoCacheConsegna = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1249.                 }
  1250.                 if(configurazione.getAccessoDatiRichieste()!=null && configurazione.getAccessoDatiRichieste().getCache()!=null) {
  1251.                     statoCachEdatiRichieste = ConfigurazioneCostanti.DEFAULT_VALUE_ABILITATO;
  1252.                     dimensionecachEdatiRichieste = configurazione.getAccessoDatiRichieste().getCache().getDimensione();
  1253.                     if(configurazione.getAccessoDatiRichieste().getCache().getAlgoritmo()!=null){
  1254.                         algoritmocachEdatiRichieste = configurazione.getAccessoDatiRichieste().getCache().getAlgoritmo().getValue();
  1255.                     }
  1256.                     idlecachEdatiRichieste = configurazione.getAccessoDatiRichieste().getCache().getItemIdleTime();
  1257.                     lifecachEdatiRichieste = configurazione.getAccessoDatiRichieste().getCache().getItemLifeSecond();
  1258.                 }
  1259.                 else{
  1260.                     statoCachEdatiRichieste = ConfigurazioneCostanti.DEFAULT_VALUE_DISABILITATO;
  1261.                 }
  1262.                 if(configurazione.getMultitenant()!=null) {
  1263.                     if(configurazione.getMultitenant().getStato()!=null) {
  1264.                         multitenantEnabled = StatoFunzionalita.ABILITATO.equals(configurazione.getMultitenant().getStato());
  1265.                     }
  1266.                     if(configurazione.getMultitenant().getFruizioneSceltaSoggettiErogatori()!=null) {
  1267.                         switch (configurazione.getMultitenant().getFruizioneSceltaSoggettiErogatori()) {
  1268.                         case SOGGETTI_ESTERNI:
  1269.                             multitenantSoggettiFruizioni = MultitenantSoggettiFruizioni.SOLO_SOGGETTI_ESTERNI.name();
  1270.                             break;
  1271.                         case ESCLUDI_SOGGETTO_FRUITORE:
  1272.                             multitenantSoggettiFruizioni = MultitenantSoggettiFruizioni.ESCLUDI_SOGGETTO_FRUITORE.name();
  1273.                             break;
  1274.                         case TUTTI:
  1275.                             multitenantSoggettiFruizioni = MultitenantSoggettiFruizioni.TUTTI.name();
  1276.                             break;
  1277.                         }
  1278.                     }
  1279.                     if(configurazione.getMultitenant().getErogazioneSceltaSoggettiFruitori()!=null) {
  1280.                         switch (configurazione.getMultitenant().getErogazioneSceltaSoggettiFruitori()) {
  1281.                         case SOGGETTI_ESTERNI:
  1282.                             multitenantSoggettiErogazioni = MultitenantSoggettiErogazioni.SOLO_SOGGETTI_ESTERNI.name();
  1283.                             break;
  1284.                         case ESCLUDI_SOGGETTO_EROGATORE:
  1285.                             multitenantSoggettiErogazioni = MultitenantSoggettiErogazioni.ESCLUDI_SOGGETTO_EROGATORE.name();
  1286.                             break;
  1287.                         case TUTTI:
  1288.                             multitenantSoggettiErogazioni = MultitenantSoggettiErogazioni.TUTTI.name();
  1289.                             break;
  1290.                         }
  1291.                     }
  1292.                 }

  1293.                 corsStato = false;
  1294.                 CorsConfigurazione gestioneCors = configurazione.getGestioneCors();
  1295.                 if(gestioneCors != null) {
  1296.                     if(gestioneCors.getStato() != null && gestioneCors.getStato().equals(StatoFunzionalita.ABILITATO)) {
  1297.                         corsStato = true;

  1298.                         corsTipo = gestioneCors.getTipo();
  1299.                         if(gestioneCors.getTipo() != null && gestioneCors.getTipo().equals(TipoGestioneCORS.GATEWAY)) {

  1300.                             corsAllAllowOrigins = true;
  1301.                             if(gestioneCors.getAccessControlAllAllowOrigins() != null && gestioneCors.getAccessControlAllAllowOrigins().equals(StatoFunzionalita.DISABILITATO)) {
  1302.                                 corsAllAllowOrigins = false;

  1303.                                 if(gestioneCors.getAccessControlAllowOrigins() != null) {
  1304.                                     corsAllowOrigins = StringUtils.join(gestioneCors.getAccessControlAllowOrigins().getOriginList(), ",");
  1305.                                 }
  1306.                             }

  1307.                             corsAllAllowHeaders = false;
  1308.                             if(gestioneCors.getAccessControlAllAllowHeaders() != null && gestioneCors.getAccessControlAllAllowHeaders().equals(StatoFunzionalita.ABILITATO)) {
  1309.                                 corsAllAllowHeaders = true;
  1310.                             }
  1311.                             if(!corsAllAllowHeaders) {
  1312.                                 if(gestioneCors.getAccessControlAllowHeaders() != null) {
  1313.                                     corsAllowHeaders = StringUtils.join(gestioneCors.getAccessControlAllowHeaders().getHeaderList(), ",");
  1314.                                 }
  1315.                             }

  1316.                             corsAllAllowMethods = false;
  1317.                             if(gestioneCors.getAccessControlAllAllowMethods() != null && gestioneCors.getAccessControlAllAllowMethods().equals(StatoFunzionalita.ABILITATO)) {
  1318.                                 corsAllAllowMethods = true;
  1319.                             }
  1320.                             if(!corsAllAllowMethods) {
  1321.                                 if(gestioneCors.getAccessControlAllowMethods() != null) {
  1322.                                     corsAllowMethods = StringUtils.join(gestioneCors.getAccessControlAllowMethods().getMethodList(), ",");
  1323.                                 }
  1324.                             }

  1325.                             if(gestioneCors.getAccessControlExposeHeaders() != null) {
  1326.                                 corsExposeHeaders = StringUtils.join(gestioneCors.getAccessControlExposeHeaders().getHeaderList(), ",");
  1327.                             }

  1328.                             corsAllowCredential = false;
  1329.                             if(gestioneCors.getAccessControlAllowCredentials() != null && gestioneCors.getAccessControlAllowCredentials().equals(StatoFunzionalita.ABILITATO)) {
  1330.                                 corsAllowCredential = true;
  1331.                             }

  1332.                             corsMaxAge = false;
  1333.                             corsMaxAgeSeconds = -1;
  1334.                             if(gestioneCors.getAccessControlMaxAge() != null ) {
  1335.                                 corsMaxAge = true;
  1336.                                 corsMaxAgeSeconds = gestioneCors.getAccessControlMaxAge();
  1337.                             }
  1338.                         }

  1339.                     }
  1340.                 }
  1341.                
  1342.                 responseCachingGenerale = configurazione.getResponseCaching();
  1343.                 responseCachingEnabled = false;
  1344.                 if(responseCachingGenerale != null) {
  1345.                     ResponseCachingConfigurazione responseCaching = responseCachingGenerale.getConfigurazione();
  1346.                     if(responseCaching != null && responseCaching.getStato().equals(StatoFunzionalita.ABILITATO)) {
  1347.                         responseCachingEnabled = true;
  1348.                        
  1349.                         responseCachingSeconds = responseCaching.getCacheTimeoutSeconds() != null ? responseCaching.getCacheTimeoutSeconds().intValue() : 1;
  1350.                        
  1351.                         responseCachingMaxResponseSize = false;
  1352.                         if(responseCaching.getMaxMessageSize() != null) {
  1353.                             responseCachingMaxResponseSize = true;
  1354.                             responseCachingMaxResponseSizeBytes = responseCaching.getMaxMessageSize().longValue();
  1355.                         }
  1356.                        
  1357.                         responseCachingDigestUrlInvocazione = true;
  1358.                         responseCachingDigestQueryParameter = StatoFunzionalitaCacheDigestQueryParameter.ABILITATO;
  1359.                         responseCachingDigestHeaders = false;
  1360.                         responseCachingDigestPayload = true;
  1361.                         responseCachingDigestHeadersNomiHeaders = "";
  1362.                         if(responseCaching.getHashGenerator() != null) {
  1363.                            
  1364.                             if(responseCaching.getHashGenerator().getQueryParameters() != null)
  1365.                                 responseCachingDigestQueryParameter = responseCaching.getHashGenerator().getQueryParameters();
  1366.                            
  1367.                             if(responseCaching.getHashGenerator().getQueryParameterList() != null)  
  1368.                                 responseCachingDigestNomiParametriQuery = StringUtils.join(responseCaching.getHashGenerator().getQueryParameterList(), ",");
  1369.                            
  1370.                             if(responseCaching.getHashGenerator().getHeaders() != null)  
  1371.                                 responseCachingDigestHeaders = responseCaching.getHashGenerator().getHeaders().equals(StatoFunzionalita.ABILITATO);
  1372.                            
  1373.                             if(responseCaching.getHashGenerator().getHeaderList() != null)  
  1374.                                 responseCachingDigestHeadersNomiHeaders = StringUtils.join(responseCaching.getHashGenerator().getHeaderList(), ",");
  1375.                            
  1376.                             if(responseCaching.getHashGenerator().getRequestUri() != null)
  1377.                                 responseCachingDigestUrlInvocazione = responseCaching.getHashGenerator().getRequestUri().equals(StatoFunzionalita.ABILITATO);
  1378.                            
  1379.                             if(responseCaching.getHashGenerator().getPayload() != null)
  1380.                                 responseCachingDigestPayload = responseCaching.getHashGenerator().getPayload().equals(StatoFunzionalita.ABILITATO);
  1381.                         }
  1382.                        
  1383.                         responseCachingCacheControlNoCache = true;
  1384.                         responseCachingCacheControlMaxAge = true;
  1385.                         responseCachingCacheControlNoStore = true;
  1386.                         if(responseCaching.getControl() != null) {
  1387.                             responseCachingCacheControlNoCache = responseCaching.getControl().isNoCache();
  1388.                             responseCachingCacheControlMaxAge = responseCaching.getControl().isMaxAge();
  1389.                             responseCachingCacheControlNoStore = responseCaching.getControl().isNoStore();
  1390.                         }
  1391.                        
  1392.                         numeroResponseCachingConfigurazioneRegola = responseCaching.sizeRegolaList();
  1393.                         visualizzaLinkConfigurazioneRegola = true;
  1394.                     }
  1395.                 }
  1396.                
  1397.                 canaliEnabled = false;
  1398.                 gestioneCanali = configurazione.getGestioneCanali();
  1399.                 numeroCanali = confHelper.numeroCanali(gestioneCanali);
  1400.                 numeroNodi = confHelper.numeroNodi(gestioneCanali);
  1401.                 if(gestioneCanali != null &&
  1402.                     gestioneCanali.getStato() != null && gestioneCanali.getStato().equals(StatoFunzionalita.ABILITATO)) {
  1403.                     canaliEnabled = true;
  1404.                    
  1405.                     if(numeroCanali > 0) {
  1406.                         for (CanaleConfigurazione canaleConfigurazione : gestioneCanali.getCanaleList()) {
  1407.                             if(canaleConfigurazione.isCanaleDefault()) {
  1408.                                 canaliDefault = canaleConfigurazione.getNome();
  1409.                                 break;
  1410.                             }
  1411.                         }
  1412.                     }
  1413.                 }
  1414.             }

  1415.             // preparo i campi
  1416.             List<DataElement> dati = new ArrayList<>();

  1417.             dati.add(ServletUtils.getDataElementForEditModeFinished());

  1418.             DataElement de = new DataElement();
  1419.             de.setName(ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CACHES);
  1420.             de.setValue(configurazioneCachesTmp);
  1421.             de.setType(DataElementType.HIDDEN);
  1422.             dati.add(de);
  1423.            
  1424.             dati = confHelper.addConfigurazioneToDati(isAllHiddenConfigurazione,  
  1425.                     inoltromin, stato, controllo, severita, severitaLog4j, integman, nomeintegman, profcoll,
  1426.                     connessione, utilizzo, validman, gestman, registrazioneTracce, dumpPD, dumpPA,
  1427.                     xsd, tipoValidazione, confPers, configurazione, dati, applicaMTOM,
  1428.                     urlInvocazionePA, urlInvocazionePD,
  1429.                     multitenantEnabled, multitenantSoggettiFruizioni, multitenantSoggettiErogazioni, true,
  1430.                     corsStato, corsTipo, corsAllAllowOrigins, corsAllAllowHeaders, corsAllAllowMethods,
  1431.                     corsAllowHeaders, corsAllowOrigins, corsAllowMethods, corsAllowCredential, corsExposeHeaders, corsMaxAge, corsMaxAgeSeconds,
  1432.                     responseCachingEnabled, responseCachingSeconds, responseCachingMaxResponseSize, responseCachingMaxResponseSizeBytes,
  1433.                     responseCachingDigestUrlInvocazione, responseCachingDigestHeaders, responseCachingDigestPayload, responseCachingDigestHeadersNomiHeaders, responseCachingDigestQueryParameter, responseCachingDigestNomiParametriQuery,
  1434.                     responseCachingCacheControlNoCache, responseCachingCacheControlMaxAge, responseCachingCacheControlNoStore, visualizzaLinkConfigurazioneRegola,
  1435.                     servletResponseCachingConfigurazioneRegolaList, paramsResponseCachingConfigurazioneRegolaList, numeroResponseCachingConfigurazioneRegola, numeroRegoleProxyPass,
  1436.                     canaliEnabled, numeroCanali, numeroNodi, canaliNome, canaliDescrizione, canaleList, canaliDefault,
  1437.                     numeroArchiviPlugins, numeroClassiPlugins);

  1438.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_DATI_RICHIESTE,
  1439.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_DATI_RICHIESTE,statoCachEdatiRichieste,
  1440.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_DATI_RICHIESTE,dimensionecachEdatiRichieste,
  1441.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_DATI_RICHIESTE,algoritmocachEdatiRichieste,
  1442.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_DATI_RICHIESTE,idlecachEdatiRichieste,
  1443.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_DATI_RICHIESTE,lifecachEdatiRichieste,
  1444.                     isAllHiddenCache);
  1445.            
  1446.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_REGISTRY,
  1447.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_REGISTRY,statoCacheRegistry,
  1448.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_REGISTRY,dimensionecacheRegistry,
  1449.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_REGISTRY,algoritmocacheRegistry,
  1450.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_REGISTRY,idlecacheRegistry,
  1451.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_REGISTRY,lifecacheRegistry,
  1452.                     isAllHiddenCache);
  1453.            
  1454.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONFIG,
  1455.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONFIG,statoCacheConfig,
  1456.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONFIG,dimensionecacheConfig,
  1457.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONFIG,algoritmocacheConfig,
  1458.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONFIG,idlecacheConfig,
  1459.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONFIG,lifecacheConfig,
  1460.                     isAllHiddenCache);

  1461.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_AUTHZ,
  1462.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHZ,statoCacheAuthz,
  1463.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHZ,dimensionecacheAuthz,
  1464.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHZ,algoritmocacheAuthz,
  1465.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHZ,idlecacheAuthz,
  1466.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHZ,lifecacheAuthz,
  1467.                     isAllHiddenCache);

  1468.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_AUTHN,
  1469.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_AUTHN,statoCacheAuthn,
  1470.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_AUTHN,dimensionecacheAuthn,
  1471.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_AUTHN,algoritmocacheAuthn,
  1472.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_AUTHN,idlecacheAuthn,
  1473.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_AUTHN,lifecacheAuthn,
  1474.                     isAllHiddenCache);

  1475.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_TOKEN,
  1476.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_TOKEN,statoCacheToken,
  1477.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_TOKEN,dimensionecacheToken,
  1478.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_TOKEN,algoritmocacheToken,
  1479.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_TOKEN,idlecacheToken,
  1480.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_TOKEN,lifecacheToken,
  1481.                     isAllHiddenCache);
  1482.            
  1483.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_ATTRIBUTE_AUTHORITY,
  1484.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_ATTRIBUTE_AUTHORITY,statoCacheAA,
  1485.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_ATTRIBUTE_AUTHORITY,dimensionecacheAA,
  1486.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_ATTRIBUTE_AUTHORITY,algoritmocacheAA,
  1487.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_ATTRIBUTE_AUTHORITY,idlecacheAA,
  1488.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_ATTRIBUTE_AUTHORITY,lifecacheAA,
  1489.                     isAllHiddenCache);
  1490.            
  1491.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_KEYSTORE,
  1492.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_KEYSTORE,statoCacheKeystore,
  1493.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_KEYSTORE,dimensionecacheKeystore,
  1494.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_KEYSTORE,algoritmocacheKeystore,
  1495.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_KEYSTORE,idlecacheKeystore,
  1496.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_KEYSTORE,lifecacheKeystore,
  1497.                     isAllHiddenCache);
  1498.             confHelper.setDataElementCRLCacheInfo(dati,
  1499.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_CRL_LIFE_CACHE_KEYSTORE,crlLifecacheKeystore,
  1500.                     isAllHiddenCache);

  1501.             if(!isAllHiddenCache) {
  1502.                 confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONTROLLO_TRAFFICO,
  1503.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONTROLLO_TRAFFICO,statoCacheControlloTraffico,
  1504.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONTROLLO_TRAFFICO,dimensionecacheControlloTraffico,
  1505.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONTROLLO_TRAFFICO,algoritmocacheControlloTraffico,
  1506.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONTROLLO_TRAFFICO,idlecacheControlloTraffico,
  1507.                         ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONTROLLO_TRAFFICO,lifecacheControlloTraffico,
  1508.                         isAllHiddenCache);
  1509.             }
  1510.            
  1511.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_RISPOSTE,
  1512.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_RISPOSTE,statoCacheRisposte,
  1513.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_RISPOSTE,dimensionecacheRisposte,
  1514.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_RISPOSTE,algoritmocacheRisposte,
  1515.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_RISPOSTE,idlecacheRisposte,
  1516.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_RISPOSTE,lifecacheRisposte,
  1517.                     isAllHiddenCache);

  1518.             confHelper.setDataElementCache(dati,ConfigurazioneCostanti.LABEL_CONFIGURAZIONE_CACHE_CONSEGNA_APPLICATIVI,
  1519.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_STATO_CACHE_CONSEGNA,statoCacheConsegna,
  1520.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_DIMENSIONE_CACHE_CONSEGNA,dimensionecacheConsegna,
  1521.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_ALGORITMO_CACHE_CONSEGNA,algoritmocacheConsegna,
  1522.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_IDLE_CACHE_CONSEGNA,idlecacheConsegna,
  1523.                     ConfigurazioneCostanti.PARAMETRO_CONFIGURAZIONE_LIFE_CACHE_CONSEGNA,lifecacheConsegna,
  1524.                     isAllHiddenCache);
  1525.            
  1526.             if(extendedBeanList!=null && !extendedBeanList.isEmpty()){
  1527.                 for (ExtendedInfo ei : extendedBeanList) {
  1528.                     if(ei.extended){
  1529.                         if(ei.extendedToNewWindow){
  1530.                             AbstractServletNewWindowChangeExtended.addToDatiNewWindow(ei.extendedServlet,
  1531.                                     dati, confHelper, confCore, configurazione, ei.extendedBean, ConfigurazioneCostanti.SERVLET_NAME_CONFIGURAZIONE_GENERALE_EXTENDED);
  1532.                         }else{
  1533.                             ei.extendedServlet.addToDati(dati, TipoOperazione.CHANGE, confHelper, confCore, configurazione, ei.extendedBean);
  1534.                         }
  1535.                     }
  1536.                 }
  1537.             }

  1538.             pd.setDati(dati);

  1539.             String msg = confHelper.getParameter(Costanti.PARAMETER_NAME_MSG_ERROR_EXPORT);
  1540.             if(msg!=null && !"".equals(msg)){
  1541.                 pd.setMessage("Errore durante esportazione: "+msg);
  1542.             }

  1543.             ServletUtils.setGeneralAndPageDataIntoSession(request, session, gd, pd);

  1544.             return ServletUtils.getStrutsForwardEditModeInProgress(mapping,
  1545.                     ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_GENERALE,
  1546.                     ConfigurazioneCostanti.TIPO_OPERAZIONE_CONFIGURAZIONE_GENERALE);
  1547.         } catch (Exception e) {
  1548.             return ServletUtils.getStrutsForwardError(ControlStationCore.getLog(), e, pd, request, session, gd, mapping,
  1549.                     ConfigurazioneCostanti.OBJECT_NAME_CONFIGURAZIONE_GENERALE, ConfigurazioneCostanti.TIPO_OPERAZIONE_CONFIGURAZIONE_GENERALE);
  1550.         }
  1551.     }

  1552. }


  1553. class ExtendedInfo{

  1554.     IExtendedBean extendedBean = null;
  1555.     boolean extended = false;
  1556.     boolean extendedToNewWindow = false;
  1557.     IExtendedFormServlet extendedServlet = null;

  1558. }