Changeset 28295

Show
Ignore:
Timestamp:
19.09.2013 12:55:08 (6 years ago)
Author:
kjdon
Message:

we can't use getServletName() to work out the servlet name in URL (eg library) as the servlet name is the name from web.xml and may not be the same as the url path. So store library_name from the initialisation params and use that instead.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java

    r28233 r28295  
    7575    protected String default_lang = null; 
    7676 
     77  /** We record the library name for later */ 
     78  protected String library_name = null; 
    7779    /** Whether or not client-side XSLT support should be exposed */ 
    7880    protected boolean supports_client_xslt = false; 
     
    127129        //System.setProperty("java.util.prefs.PreferencesFactory", "org.greenstone.gsdl3.util.DisabledPreferencesFactory"); 
    128130 
    129         String library_name = config.getInitParameter(GSConstants.LIBRARY_NAME); 
     131        library_name = config.getInitParameter(GSConstants.LIBRARY_NAME); 
    130132        String interface_name = config.getInitParameter(GSConstants.INTERFACE_NAME); 
    131133 
     
    756758        String requestedURL = request.getRequestURL().toString(); 
    757759        String baseURL = ""; 
    758         if (requestedURL.indexOf(this.getServletName()) != -1) 
    759         { 
    760             baseURL = requestedURL.substring(0, requestedURL.indexOf(this.getServletName())); 
     760        if (requestedURL.indexOf(library_name) != -1) 
     761        { 
     762            baseURL = requestedURL.substring(0, requestedURL.indexOf(library_name)); 
    761763            xml_request.setAttribute("baseURL", baseURL); 
    762764        } 
    763  
    764765        String fullURL; 
    765766        if (request.getQueryString() != null) 
     
    873874                        queryString = "?" + request.getQueryString().replace("&", "&"); 
    874875                    } 
    875                     urlParam.setAttribute(GSXML.VALUE_ATT, this.getServletName() + queryString); 
     876                    urlParam.setAttribute(GSXML.VALUE_ATT, library_name + queryString); 
    876877                    paramList.appendChild(urlParam); 
    877878