Changeset 8162


Ignore:
Timestamp:
2004-09-27T16:12:54+12:00 (20 years ago)
Author:
nzdl
Message:

added in a very ugly hack to escape : if present in url - this interferes with url encoding for session handling. need to make this nicer and handle other characters too

File:
1 edited

Legend:

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

    r6301 r8162  
    232232            Element param = this.doc.createElement(GSXML.PARAM_ELEM);
    233233            param.setAttribute(GSXML.NAME_ATT, name);
    234             param.setAttribute(GSXML.VALUE_ATT, GSXML.xmlSafe((String)session.getAttribute(name)));
     234            String value =  GSXML.xmlSafe((String)session.getAttribute(name));
     235            // ugly hack to undo : escaping
     236            value = value.replaceAll("%3A", "\\:");
     237            param.setAttribute(GSXML.VALUE_ATT,value);
    235238            xml_param_list.appendChild(param);
    236239        }
     
    251254    /** this goes through each URL and adds in a session id if needed--
    252255     * its needed if the browser doesn't accept cookies
     256     * also escapes things if needed
    253257     */
    254258    protected void encodeURLs(Element data, HttpServletResponse response) {
     
    261265    for (int i=0; i<hrefs.getLength(); i++) {
    262266        Element a = (Element)hrefs.item(i);
    263         a.setAttribute("href", response.encodeURL(a.getAttribute("href")));
     267        // ugly hack to get rid of : in the args - interferes with session handling
     268        String href = a.getAttribute("href");
     269        if (href.indexOf("?")!=-1) {
     270        String[] parts = href.split("\\?", -1);
     271        parts[1]=parts[1].replaceAll(":", "%3A");
     272        href = parts[0]+"?"+parts[1];
     273        }
     274        a.setAttribute("href", response.encodeURL(href));
    264275    }
    265276   
Note: See TracChangeset for help on using the changeset viewer.