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 private static String suffix = "cacert.local";
19 public static void init(Properties conf) {
20 securePort = port = "";
21 if ( !conf.getProperty("https.port").equals("443")) {
22 securePort = ":" + conf.getProperty("https.port");
24 if ( !conf.getProperty("http.port").equals("80")) {
25 port = ":" + conf.getProperty("http.port");
27 wwwHostName = conf.getProperty("name.www");
28 secureHostName = conf.getProperty("name.secure");
29 staticHostName = conf.getProperty("name.static");
30 apiHostName = conf.getProperty("name.api");
31 suffix = conf.getProperty("name.suffix", conf.getProperty("name.www").substring(4));
35 public static String getSecureHostName() {
36 return secureHostName;
39 public static String getStaticHostName() {
40 return staticHostName;
43 public static String getWwwHostName() {
47 public static String getApiHostName() {
51 public static String getSecureHostNamePort() {
52 return secureHostName + securePort;
55 public static String getStaticHostNamePortSecure() {
56 return staticHostName + securePort;
59 public static String getWwwHostNamePortSecure() {
60 return wwwHostName + securePort;
63 public static String getStaticHostNamePort() {
64 return staticHostName + port;
67 public static String getWwwHostNamePort() {
68 return wwwHostName + port;
71 public static String getApiHostNamePort() {
72 return apiHostName + securePort;
75 public static int getSecurePort() {
76 if (securePort.isEmpty()) {
79 return Integer.parseInt(securePort.substring(1, securePort.length()));
82 public static int getPort() {
86 return Integer.parseInt(port.substring(1, port.length()));
89 public static String getSuffix() {