1 package org.cacert.gigi.util;
3 import java.util.Properties;
5 public class ServerConstants {
7 private static String wwwHostName = "www.cacert.local";
9 private static String secureHostName = "secure.cacert.local";
11 private static String staticHostName = "static.cacert.local";
13 private static String apiHostName = "api.cacert.local";
15 private static String securePort, port;
17 public static void init(Properties conf) {
18 securePort = port = "";
19 if ( !conf.getProperty("https.port").equals("443")) {
20 securePort = ":" + conf.getProperty("https.port");
22 if ( !conf.getProperty("http.port").equals("80")) {
23 port = ":" + conf.getProperty("http.port");
25 wwwHostName = conf.getProperty("name.www");
26 secureHostName = conf.getProperty("name.secure");
27 staticHostName = conf.getProperty("name.static");
28 apiHostName = conf.getProperty("name.api");
32 public static String getSecureHostName() {
33 return secureHostName;
36 public static String getStaticHostName() {
37 return staticHostName;
40 public static String getWwwHostName() {
44 public static String getApiHostName() {
48 public static String getSecureHostNamePort() {
49 return secureHostName + securePort;
52 public static String getStaticHostNamePortSecure() {
53 return staticHostName + securePort;
56 public static String getWwwHostNamePortSecure() {
57 return wwwHostName + securePort;
60 public static String getStaticHostNamePort() {
61 return staticHostName + port;
64 public static String getWwwHostNamePort() {
65 return wwwHostName + port;
68 public static String getApiHostNamePort() {
69 return apiHostName + securePort;
72 public static int getSecurePort() {
73 if (securePort.isEmpty()) {
76 return Integer.parseInt(securePort.substring(1, securePort.length()));
79 public static int getPort() {
83 return Integer.parseInt(port.substring(1, port.length()));