Show
Ignore:
Timestamp:
07.09.2018 19:39:40 (15 months ago)
Author:
ak19
Message:

1. Since there's a chance that 127.0.0.1 isn't always the loopback address or may not always work, we allow this to be specified by the new property localhost.server.http in build.properties. Updating recently commited code that is affected by this and where I had been hardcoding 127.0.0.1. 2. Fixing up the port and now the server host name used by the solr extension: these should be the correct property names, which are localhost.port.http and the new localhost.server.http instead of tomcat.server and the default port for the default protocol, since all GS3 internal communications with solr are done through the local HTTP url, whatever the public URL (with default protocol, matching port and server name) might be. I also updated the get-solr-servlet-url target in build.xml to use the local http base URL (see point 3), so that solr building will work correctly. 3. build.xml now has 2 new targets, one to get the local http base URL and one to get the local http default servlet URL. Both also use the new localhost.server.http property, besides the recently introduced localhost.port.http property. 4. Now the default behaviour of util.pm::get_full_greenstone_url_prefix() is to call the new get-local-http-servlet-url ant target, since only activate.pl's servercontrol.pm helper module uses it. If you want util.pm::get_full_greenstone_url_prefix() to return the non-local (public) servlet URL, pass in 1 (true) for the new 3rd parameter. The important decision here is that activate will use the internal (i.e. local http) greenstone servlet URL to issue pinging and (de)activating commands, since localhost (specifically 127.0.0.1) over http is now always available and because a domain named server over https will create complications to do with certification checks by wget, when wget gets run by activate.pl. Alternatively, activate.pl/servercontrol.pm could run wget with the no-cert-checking flag or we could make wget check the GS3 https certificate if one exists. But all that is convoluted and unnecessary: we've so far always worked with http, and usually with localhost over the httpport, and activate.pl so far has worked well with this, so have some confidence that using the local http URL internally should still work, even if the default GS3 URL has been set up to be a public (https) URL.

Location:
main/trunk/greenstone2/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/servercontrol.pm

    r32166 r32432  
    385385    # For GS2, we derive the URL from the llssite.cfg file. 
    386386 
    387     my $url = &util::get_full_greenstone_url_prefix($gs_mode, $lib_name); # found largely identical method copied 
    388             # into util. Don't want duplicates, so calling that from here. 
    389      
    390     # either the url is still undef or it is now set 
     387    # note that unless we pass in $get_public_url=1, we now get the local http URL 
     388    # by default (e.g. http://127.0.0.1:httpPort/greenstone/library) 
     389    my $url = &util::get_full_greenstone_url_prefix($gs_mode, $lib_name); # found largely identical method copied 
     390        # into util.pm. Don't want duplicates, so calling that from here. 
     391     
     392    # either the url is still undef or it is now set 
    391393    #print STDERR "\n@@@@@ final URL:|$url|\n" if $url;      
    392394    #print STDERR "\n@@@@@ URL still undef\n" if !$url; 
  • main/trunk/greenstone2/perllib/util.pm

    r32345 r32432  
    12921292# 
    12931293# Designed to work with a server included with GS. 
    1294 #  - For GS3, we ask ant for the library URL. 
    12951294#  - For GS2, we derive the URL from the llssite.cfg file. 
     1295#  - For GS3, we ask ant for the library URL. For GS3, we get the local *http* URL 
     1296# by default, something like http://127.0.0.1:<httpPort>/greenstone3/library). 
     1297# Pass in $get_public_url=1 to get something like 
     1298# <default.protocol>://<tomcat.server>:<default.port>/greenstone/library 
    12961299 
    12971300sub get_full_greenstone_url_prefix 
    12981301{    
    1299     my ($gs_mode, $lib_name) = @_; 
     1302    my ($gs_mode, $lib_name, $get_public_url) = @_; 
    13001303     
    13011304    # if already set on a previous occasion, just return that 
     
    13711374    # app.name is stored in app.path by build.xml. Need to move app.name in build.properties from build.xml 
    13721375     
    1373     # Or, run the new target get-default-servlet-url 
     1376    # Or, run the new target get-local-http-servlet-url / get-default-servlet-url 
    13741377    # the output can look like: 
    13751378    # 
     
    13851388    # - see http://stackoverflow.com/questions/799968/whats-the-difference-between-perls-backticks-system-and-exec 
    13861389     
    1387     # The get-default-servlet-url ant target can be run from anywhere by specifying the 
     1390    # The get-local-http-servlet-url (or get-default-servlet-url) ant target can be run from anywhere by specifying the 
    13881391    # location of GS3's ant build.xml buildfile. Activate.pl can be run from anywhere for GS3 
    13891392    # GSDL3SRCHOME will be set for GS3 by gs3-setup.sh, a step that would have been necessary 
    13901393    # to run the activate.pl script in the first place 
    13911394     
     1395    # The default is to get-local-http-servlet-url (of the form http://127.0.0.1:<httpPort>/greentone3/library) 
    13921396    my $full_build_xml = &FileUtils::javaFilenameConcatenate($ENV{'GSDL3SRCHOME'},"build.xml"); 
    13931397 
    1394     my $perl_command = "ant -buildfile \"$full_build_xml\" get-default-servlet-url"; 
     1398    my $perl_command = $get_public_url ? "get-default-servlet-url" : "get-local-http-servlet-url"; 
     1399    $perl_command = "ant -buildfile \"$full_build_xml\" $perl_command";  
    13951400     
    13961401    if (open(PIN, "$perl_command |")) {