Ignore:
Timestamp:
2018-08-16T16:06:50+12:00 (6 years ago)
Author:
ak19
Message:
  1. Writing out tomcat.port.http(s) to global.properties only of set to a sensible value, else filter them with empty string for value. 2. GlobalProperties.java now maintains the default web URL and the web url for the other protocol if a port was provided for the other protocol.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/util/GlobalProperties.java

    r32336 r32344  
    4040    private static String full_gsdl3_web_address = null;
    4141
     42    private static String http_full_gsdl3_web_address = null;
     43    private static String https_full_gsdl3_web_address = null;
     44
    4245    /** get the value of the property 'key'. returns null if not found */
    4346    public static String getProperty(String key)
     
    207210            full_gsdl3_web_address = protocolSpecifier + hostSpecifier + portSpecifier + contextSpecifier;
    208211            gsdl3_web_address = contextSpecifier;
     212
     213            // set the http and https variants of the full web address, if they're meant to be available
     214            if(protocolSpecifier.startsWith("https")) { // check the default protocol, then set the address for the other protocol too
     215                https_full_gsdl3_web_address = full_gsdl3_web_address;
     216
     217                // and set http version, if sufficient properties are available
     218                String httpPort = properties.getProperty("tomcat.port.http");
     219                if(httpPort != null && !httpPort.equals("")) {
     220                http_full_gsdl3_web_address = "http://" + hostSpecifier + httpPort + contextSpecifier;
     221                }
     222            } else { // default protocol was http
     223                http_full_gsdl3_web_address = full_gsdl3_web_address;
     224
     225                // and set https version, if sufficient properties are available
     226                String httpsPort = properties.getProperty("tomcat.port.https");
     227                if(httpsPort != null && !httpsPort.equals("")) {
     228                https_full_gsdl3_web_address = "https://" + hostSpecifier + httpsPort + contextSpecifier;
     229                }
     230            }
    209231        }
    210232        catch (Exception e)
Note: See TracChangeset for help on using the changeset viewer.