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.
Location:
main/trunk/greenstone3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/build.xml

    r32340 r32344  
    14311431
    14321432    <antcall target="set-perl-shebangs" inheritAll="true" />
    1433    
     1433   
    14341434    <filter token="gsdlhome" value="${gs2build.home}"/>
    14351435    <filter token="gsdlhomequoted" value="&quot;${gs2build.home}&quot;"/>
     
    14431443    <filter token="tomcat.server" value="${tomcat.server}"/>
    14441444    <filter token="tomcat.port" value="${internal.tomcat.port}"/>
    1445     <filter token="tomcat.port.http" value="${tomcat.port.http}"/>
    1446     <filter token="tomcat.port.https" value="${tomcat.port.https}"/>
     1445    <!-- add filters for tomcat.port.http and tomcat.port.https depending on if
     1446     these are set. If any is not set, set its filter to the empty string -->
     1447    <if>
     1448      <bool><isset property="tomcat.port.http"/></bool>
     1449      <filter token="tomcat.port.http" value="${tomcat.port.http}"/>
     1450      <else><filter token="tomcat.port.http" value=""/></else>
     1451    </if>
     1452    <if>
     1453      <bool><isset property="tomcat.port.https"/></bool>
     1454      <filter token="tomcat.port.https" value="${tomcat.port.https}"/>
     1455      <else><filter token="tomcat.port.https" value=""/></else>
     1456    </if>
    14471457    <filter token="greenstone.context" value="${greenstone.context}"/>
    14481458    <filter token="derbyserver" value="${derby.server}"/>
  • 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.