Changeset 29730

Show
Ignore:
Timestamp:
11.02.2015 21:09:47 (5 years ago)
Author:
ak19
Message:

The second and final part of the commits to getting GLI running again and parsing web.xml, after the changes to commit r29687, where web.xml was split into two and included server.xml. In this commit: 1. GLI uses an EntityResolver? to resolve entities in web.xml that are defined in the included servlets.xml file. In order to keep XMLTools.java tidy and hopefully make the GLI entity resolver more reusable, the new GLIEntityResolver.java class checks default search paths first when asked to resolve entities. web/WEB-INF, where web.xml and servlets.xml live, has been added to the default search paths, as also the gli user dir where the web.xml and server.xml will be in a client-gli situation. 2. Small tidy up to Greenstone runtime's GSEntityResolver. 3. Remote Greenstone gliserver.pl needs to also transfer the new server.xml file when zipping up web.xml. 4. Minor touchups to the new README on apache.jar.

Location:
main/trunk
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/lib/README.txt

    r29729 r29730  
     1--------------------------- 
     2THE apache.jar FILE 
     3--------------------------- 
     4 
    15GLI's apache.jar is a custom jar file that collects together apache libraries necessary to compile, build and run GLI. There's no documentation on the various jar files that it contains, but I've guessed by inspecting the contents.  
    26 
    3 Some of the contents are from xercesImpl.jar and xml-apis.jar, which may need to be kept up to date together, since they are related and interdependent jar files. 
     7Some of the contents are from xercesImpl.jar and xml-apis.jar, which may need to be kept up-to-date in tandem, since they are related and interdependent jar files as updates to xalan.jar for instance come with correspondingly updated xerces, xml-apis and other related jars. 
    48 
    59 
    6 Commit 29729 added the contents of xml-apis.jar (sax) and xercesImpl.jar (both found in GS3/web/WEB-INF/lib else packages/tomcat/lib) into apache.jar, replacing the older xerces and xml-apis contents of apache.jar 
     10Commit r29729 adds the contents of xml-apis.jar (sax) and xercesImpl.jar (both found in GS3/web/WEB-INF/lib else packages/tomcat/lib) into apache.jar, replacing the older xerces and xml-apis contained of apache.jar. 
     11This update was necessary to handle commit r29687 where web.xml was split into web.xml and servlets.xml, with the former including the latter as an entity. GLI needs to use an EntityResolver to work with this, but the older xerces and xml-apis in apache.jar would still result in GLI failing to start, unable to parse web.xml because of the way in which servlets.xml was included. The xercesImpl and xml-apis jars in GS3/web/WEB-INF/lib (copied into packages/tomcat/lib) contain versions of these jars that do make the EntityResolver in GLI work. 
    712 
     13 
     14--------------------------- 
     15CONTENTS OF apache.jar 
     16--------------------------- 
    817 
    918Overview of the contents of apache.jar and whether they got updated in the upcoming commit 29729. 
     
    2736            - codec: appears to be from commons-codec,  
    2837            - logging: appears to be from commons-logging. 
    29             - not sure where the 4 other subfolders of commons (beanutils, collections, digester, httpclient) are from. 
     38            - not sure where the 4 other subfolders of commons (beanutils, collections, digester, httpclient) are from. See commit message of http://trac.greenstone.org/log/gli/trunk/lib/apache.jar?rev=14319 for ideas. 
    3039         
    3140 
     
    3342 
    3443 
    35 After unzipping apache.jar, the contents were updated as described above. 
     44--------------------------- 
     45UPDATING apache.jar 
     46--------------------------- 
     47 
     48After unzipping apache.jar, its contents were updated to use the later xerces and xml-apis as described above. 
    3649 
    3750How to recreate the apache.jar: 
  • main/trunk/gli/src/org/greenstone/gatherer/util/XMLTools.java

    r29001 r29730  
    619619            parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true); 
    620620            parser.setFeature("http://apache.org/xml/features/dom/include-ignorable-whitespace", false); 
     621            parser.setEntityResolver(new GLIEntityResolver()); 
    621622            parser.parse(isc); 
    622623            document = parser.getDocument(); 
  • main/trunk/greenstone2/common-src/cgi-bin/gliserver.pl

    r28958 r29730  
    746746    my $java_classpath = &util::filename_cat($ENV{'GSDLHOME'}, "bin", "java", "GLIServer.jar"); 
    747747    my $zip_file_path = &util::filename_cat($collection_directory, $collection_tail_name . "-file-" . $timestamp . ".zip"); 
    748     my $java_args = "\"$zip_file_path\" \"$collection_directory\" \"$file\""; 
     748    my $java_args = "\"$zip_file_path\" \"$collection_directory\" \"$file\" servlets.xml"; 
    749749    $ENV{'LANG'} = $lang_env; 
    750750    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.ZipFiles $java_args";  
     
    787787    } 
    788788 
    789     my $web_inf_directory = &util::filename_cat($ENV{'GSDL3SRCHOME'}, "web", "WEB-INF"); 
     789    my $web_inf_directory = &util::filename_cat($ENV{'GSDL3HOME'}, "WEB-INF"); 
    790790    $gsdl_cgi->checked_chdir($web_inf_directory); 
    791791 
     
    799799    my $java_classpath = &util::filename_cat($ENV{'GSDLHOME'}, "bin", "java", "GLIServer.jar"); 
    800800    my $zip_file_path = &util::filename_cat($web_inf_directory, "webxml" . $timestamp . ".zip"); 
    801     my $java_args = "\"$zip_file_path\" \"$web_inf_directory\" \"$file\""; 
     801    my $java_args = "\"$zip_file_path\" \"$web_inf_directory\" \"$file\" servlets.xml"; 
    802802    $ENV{'LANG'} = $lang_env; 
    803803    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.ZipFiles $java_args";  
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSEntityResolver.java

    r29728 r29730  
    6161        return new InputSource(system_id); 
    6262        } else { 
    63         temp_id = temp_id.substring(temp_id.lastIndexOf("/")+1); 
     63        temp_id = f.getName(); //temp_id = temp_id.substring(temp_id.lastIndexOf("/")+1); 
    6464        } 
    65     } else { 
     65    } else { // not a file 
    6666        if (temp_id.indexOf("/")!= -1) { 
    6767        temp_id = temp_id.substring(temp_id.lastIndexOf("/")+1);