HttpsOptions.java

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

  20. package org.openspcoop2.utils.transport.http;

  21. /**
  22.  * HttpsOptions
  23.  *
  24.  * @author Poli Andrea (apoli@link.it)
  25.  * @author $Author$
  26.  * @version $Rev$, $Date$
  27.  */
  28. public class HttpsOptions implements HttpOptions {

  29.     private static final long serialVersionUID = 1L;
  30.    
  31.     @Override
  32.     public String toString() {
  33.         StringBuilder bf = new StringBuilder();
  34.         bf.append("hostnameVerifier").append(":").append(this.hostnameVerifier);
  35.         bf.append(" secureRandom").append(":").append(this.secureRandom);
  36.         if(this.secureRandom) {
  37.             bf.append(" secureRandomAlgo").append(":").append(this.secureRandomAlgorithm);
  38.         }
  39.         return bf.toString();
  40.     }
  41.    
  42.     @Override
  43.     public void fill(HttpRequest request) {
  44.         request.setHostnameVerifier(this.hostnameVerifier);
  45.         request.setSecureRandom(this.secureRandom);
  46.         request.setSecureRandomAlgorithm(this.secureRandomAlgorithm);
  47.     }
  48.    
  49.     private boolean secureRandom = false;
  50.     private String secureRandomAlgorithm = null;
  51.    
  52.     private boolean hostnameVerifier = false;

  53.     public boolean isSecureRandom() {
  54.         return this.secureRandom;
  55.     }

  56.     public void setSecureRandom(boolean secureRandom) {
  57.         this.secureRandom = secureRandom;
  58.     }

  59.     public String getSecureRandomAlgorithm() {
  60.         return this.secureRandomAlgorithm;
  61.     }

  62.     public void setSecureRandomAlgorithm(String secureRandomAlgorithm) {
  63.         this.secureRandomAlgorithm = secureRandomAlgorithm;
  64.     }

  65.     public boolean isHostnameVerifier() {
  66.         return this.hostnameVerifier;
  67.     }

  68.     public void setHostnameVerifier(boolean hostnameVerifier) {
  69.         this.hostnameVerifier = hostnameVerifier;
  70.     }
  71.    
  72. }