TokenForward.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.pdd.core.token;

  21. import java.io.Serializable;
  22. import java.util.HashMap;
  23. import java.util.List;
  24. import java.util.Map;

  25. import org.openspcoop2.message.OpenSPCoop2Message;

  26. /**    
  27.  * TokenForward
  28.  *
  29.  * @author Poli Andrea (poli@link.it)
  30.  * @author $Author$
  31.  * @version $Rev$, $Date$
  32.  */
  33. public class TokenForward implements Serializable {

  34.     /**
  35.      *
  36.      */
  37.     private static final long serialVersionUID = 1L;
  38.    
  39.     private Map<String, List<String>> trasporto = new HashMap<>();
  40.     private Map<String, List<String>> url = new HashMap<>();
  41.    
  42.     public Map<String, List<String>> getTrasporto() {
  43.         return this.trasporto;
  44.     }
  45.     public void setTrasporto(Map<String, List<String>> trasporto) {
  46.         this.trasporto = trasporto;
  47.     }
  48.     public Map<String, List<String>> getUrl() {
  49.         return this.url;
  50.     }
  51.     public void setUrl(Map<String, List<String>> url) {
  52.         this.url = url;
  53.     }
  54.    
  55.     public void add(OpenSPCoop2Message msg) {
  56.         if(msg==null) {
  57.             return;
  58.         }
  59.         if(this.trasporto!=null && this.trasporto.size()>0) {
  60.             for (Map.Entry<String,List<String>> entry : this.trasporto.entrySet()) {
  61.                 msg.forceTransportHeader(entry.getKey(), entry.getValue());
  62.             }
  63.         }
  64.         if(this.url!=null && this.url.size()>0) {
  65.             for (Map.Entry<String,List<String>> entry : this.url.entrySet()) {
  66.                 msg.forceUrlProperty(entry.getKey(), entry.getValue());
  67.             }
  68.         }
  69.     }
  70. }