X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Futil%2FServerConstants.java;h=8689209444b1f5199b0d6c29905aa2686d33d362;hb=6ca949e722abe1d8eb95a90353c837e376874e44;hp=28a52eb4e924332fc9726ed35473209fac42ac31;hpb=d690eda36eba121aa79e4f456d5f0eb481be8b86;p=gigi.git diff --git a/src/org/cacert/gigi/util/ServerConstants.java b/src/org/cacert/gigi/util/ServerConstants.java index 28a52eb4..86892094 100644 --- a/src/org/cacert/gigi/util/ServerConstants.java +++ b/src/org/cacert/gigi/util/ServerConstants.java @@ -3,36 +3,84 @@ package org.cacert.gigi.util; import java.util.Properties; public class ServerConstants { - private static String wwwHostName = "www.cacert.local"; - private static String secureHostName = "secure.cacert.local"; - private static String staticHostName = "static.cacert.local"; - private static String port; - public static void init(Properties conf) { - port = ""; - if (!conf.getProperty("port").equals("443")) { - port = ":" + conf.getProperty("port"); - } - wwwHostName = conf.getProperty("name.www"); - secureHostName = conf.getProperty("name.secure"); - staticHostName = conf.getProperty("name.static"); - } - public static String getSecureHostName() { - return secureHostName; - } - public static String getStaticHostName() { - return staticHostName; - } - public static String getWwwHostName() { - return wwwHostName; - } - public static String getSecureHostNamePort() { - return secureHostName + port; - } - public static String getStaticHostNamePort() { - return staticHostName + port; - } - public static String getWwwHostNamePort() { - return wwwHostName + port; - } + + private static String wwwHostName = "www.cacert.local"; + + private static String secureHostName = "secure.cacert.local"; + + private static String staticHostName = "static.cacert.local"; + + private static String apiHostName = "api.cacert.local"; + + private static String securePort, port; + + public static void init(Properties conf) { + securePort = port = ""; + if ( !conf.getProperty("https.port").equals("443")) { + securePort = ":" + conf.getProperty("https.port"); + } + if ( !conf.getProperty("http.port").equals("80")) { + port = ":" + conf.getProperty("http.port"); + } + wwwHostName = conf.getProperty("name.www"); + secureHostName = conf.getProperty("name.secure"); + staticHostName = conf.getProperty("name.static"); + apiHostName = conf.getProperty("name.api"); + + } + + public static String getSecureHostName() { + return secureHostName; + } + + public static String getStaticHostName() { + return staticHostName; + } + + public static String getWwwHostName() { + return wwwHostName; + } + + public static String getApiHostName() { + return apiHostName; + } + + public static String getSecureHostNamePort() { + return secureHostName + securePort; + } + + public static String getStaticHostNamePortSecure() { + return staticHostName + securePort; + } + + public static String getWwwHostNamePortSecure() { + return wwwHostName + securePort; + } + + public static String getStaticHostNamePort() { + return staticHostName + port; + } + + public static String getWwwHostNamePort() { + return wwwHostName + port; + } + + public static String getApiHostNamePort() { + return apiHostName + securePort; + } + + public static int getSecurePort() { + if (securePort.isEmpty()) { + return 443; + } + return Integer.parseInt(securePort.substring(1, securePort.length())); + } + + public static int getPort() { + if (port.isEmpty()) { + return 80; + } + return Integer.parseInt(port.substring(1, port.length())); + } }