Changeset 36105


Ignore:
Timestamp:
2022-03-11T10:38:01+13:00 (2 years ago)
Author:
kjdon
Message:

some commits around handling servlet path - if teh gliserver url is not the same as the pne we stored previously, then clear out the saved site and servlet info - they might be wrong, and if the servlet path is not valid, you can't authenticate, and can't open gli at all. if we have no serv;et path, get one from remote server, and then find out what its site is.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r36094 r36105  
    380380
    381381                int greenstoneVersion = 2;
    382                 requestGLIServerURL();
     382                String prev_gliserver_url_string = Configuration.getString("general.gliserver_url", true);
     383                requestGLIServerURL(); // opens up the gliserver dialog
    383384                gliserver_url_string = Configuration.gliserver_url.toString();
     385               
    384386               
    385387                greenstoneVersion = remoteGreenstoneServer.getGreenstoneVersion();
     
    391393                if(greenstoneVersion >= 3) {
    392394                    this.GS3 = true;
    393                     Configuration.prepareForGS3();
     395                    if (!prev_gliserver_url_string.equals(gliserver_url_string)) {
     396                        System.err.println("Using a new GLI server url, clear site and servlet info");
     397                        Configuration.setSiteAndServlet("", "");
     398                    } else {
     399                        Configuration.prepareForGS3();
     400                    }
    394401                }
    395402               
     
    494501
    495502            // The "-gliserver_url" option overwrites anything in the config files
     503            // why do this? we have already asked the user for gliserver url and set it...
    496504            if (gliserver_url_string != null && gliserver_url_string.length() > 0) {
    497505                try {
     
    514522                    servlet_config= new ServletConfiguration(gsdl3_path);
    515523                }
    516             }
    517 
    518             if (GS3 && Configuration.servlet_path == null) {
    519                 Configuration.servlet_path = servlet_config.getServletPath(Configuration.site_name);
     524           
     525
     526                if (Configuration.servlet_path == null || Configuration.servlet_path.equals("")) {
     527                    if (isGsdlRemote) {
     528                    System.err.println("servlet path is null, get new one from remote server");
     529                    String my_servlet_path = remoteGreenstoneServer.getDefaultServletPath().trim();
     530                    // set site name to match
     531                    String my_site_name = servlet_config.getSiteForServlet(my_servlet_path);
     532
     533                    Configuration.setSiteAndServlet(my_site_name, my_servlet_path);
     534                    } else {
     535                    // TODO - how do we work out default in local case?
     536                    Configuration.servlet_path = servlet_config.getServletPath(Configuration.site_name);
     537                    }
     538                }
    520539            }
    521540           
     
    14061425        WarningDialog dialog;
    14071426        String[] defaultURLs = {
    1408             "http://localhost:8080/greenstone3/cgi-bin/gliserver.pl",
     1427            "http://localhost:8383/greenstone3/cgi-bin/gliserver.pl",
    14091428            "http://localhost:8080/gsdl/cgi-bin/gliserver.pl"
    14101429        };
Note: See TracChangeset for help on using the changeset viewer.