Changeset 36001


Ignore:
Timestamp:
2022-01-14T10:14:57+13:00 (2 years ago)
Author:
cstephen
Message:

Surface cookie consent parameter as XML param.
Use commons StringUtils in XSLTUtil#getInterfaceStringsAsJavascript

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
3 edited

Legend:

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

    r35897 r36001  
    650650            GSXML.addParameter2ToList(xslt_params, "interface_name", (String) config_params.get(GSConstants.INTERFACE_NAME));
    651651            GSXML.addParameter2ToList(xslt_params, "site_name", (String) config_params.get(GSConstants.SITE_NAME));
     652            GSXML.addParameter2ToList(xslt_params, "cookie_consent", (String) config_params.get(GSConstants.COOKIE_CONSENT));
    652653            Boolean useClientXSLT = (Boolean) config_params.get(GSConstants.USE_CLIENT_SIDE_XSLT);
    653654            GSXML.addParameter2ToList(xslt_params, "use_client_side_xslt", useClientXSLT.toString());
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSConstants.java

    r34112 r36001  
    4545    public static final String UTF8="UTF-8";
    4646    // The default encoding Greenstone expects when reading in its XML files
    47     public static final String XML_FILE_ENCODING=UTF8;
     47    public static final String XML_FILE_ENCODING = UTF8;
     48   
     49    /**
     50     * Gets the name of the cookie consent servlet parameter.
     51     */
     52    public static final String COOKIE_CONSENT = "cookie_consent";
    4853}
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java

    r35998 r36001  
    1717 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    1818 */
     19
     20/**
     21 * Note (cstephen):
     22 * Use of org.apache.commons.lang3.StringUtils can likely be removed when compiling
     23 * for Java 1.13+, due to performance improvements in the standard library.
     24 * https://stackoverflow.com/questions/16228992/commons-lang-stringutils-replace-performance-vs-string-replace
     25 */
     26
    1927package org.greenstone.gsdl3.util;
    2028
     
    882890                if (key.startsWith(prefix))
    883891                {
    884                     int lastDotIndex = key.lastIndexOf(".");
     892                    int lastDotIndex = StringUtils.lastIndexOf(key, '.');
    885893                    // If this is true, the key is nested under nodes that we might have to construct
    886894                    if (lastDotIndex > 0) {
     
    890898                        buildJSObjectGraph(
    891899                            outputStr,
    892                             prependToPrefix + "." + key.substring(0, lastDotIndex), // Strip the actual key from the path
     900                            prependToPrefix + "." + StringUtils.substring(key, 0, lastDotIndex), // Strip the actual key from the path
    893901                            initialisedNodes
    894902                        );
     
    943951        }
    944952
    945         String[] nodes = objectGraph.split("\\.");
     953        String[] nodes = StringUtils.split(objectGraph, '.');
    946954
    947955        if (!preBuiltNodes.contains(nodes[0])) {
Note: See TracChangeset for help on using the changeset viewer.