TransportHeaderResource.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.monitor.sdk.transaction;

  21. import java.util.HashMap;
  22. import java.util.Set;

  23. import org.openspcoop2.monitor.sdk.constants.ContentResourceNames;
  24. import org.openspcoop2.monitor.sdk.constants.MessageType;

  25. /**
  26.  * TransportHeaderResource
  27.  *
  28.  * @author Poli Andrea (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class TransportHeaderResource extends AbstractContentResource {
  33.    
  34.     private HashMap<String,String> header = null;
  35.     public TransportHeaderResource(MessageType messageType) {
  36.         super(messageType);
  37.         this.header = new HashMap<>();
  38.     }
  39.    
  40.     public void setProperty(String name, String value) {
  41.         this.header.put(name, value);
  42.     }

  43.     public void setValue(HashMap<String,String> header) {
  44.         this.header = header;
  45.     }
  46.    

  47.     @Override
  48.     public String getName() {
  49.         if (this.isRequest())
  50.             return ContentResourceNames.REQ_TRANSPORT_HEADER;
  51.         else
  52.             return ContentResourceNames.RES_TRANSPORT_HEADER;
  53.     }
  54.    
  55.     public String getProperty(String key) {
  56.         return this.header.get(key);
  57.     }
  58.    
  59.     @Override
  60.     public HashMap<String,String> getValue() {
  61.         return this.header;
  62.     }
  63.    
  64.     public Set<String> keys(){
  65.         return this.header.keySet();
  66.     }



  67. }