Ignore:
Timestamp:
2009-07-13T10:25:21+12:00 (15 years ago)
Author:
oranfry
Message:

initial implementation of support for site-level metadata

File:
1 edited

Legend:

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

    r19771 r19984  
    580580    }
    581581
    582     // get all the <a> elements
    583     NodeList hrefs = data.getElementsByTagName("a");
    584     for (int i=0; i<hrefs.getLength(); i++) {
    585       Element a = (Element)hrefs.item(i);
    586       // ugly hack to get rid of : in the args - interferes with session handling
    587       String href = a.getAttribute("href");
    588       if (!href.equals("")) {
    589         if (href.indexOf("?")!=-1) {
    590           String[] parts = href.split("\\?", -1);
    591           parts[1]=parts[1].replaceAll(":", "%3A");
    592           href = parts[0]+"?"+parts[1];
    593         }
    594         a.setAttribute("href", response.encodeURL(href));
    595       }
    596     }
    597    
    598     // now find any submit bits - get all the <form> elements
    599     NodeList forms = data.getElementsByTagName("form");
    600     for (int i=0; i<forms.getLength(); i++) {
    601       Element form = (Element)forms.item(i);
    602       form.setAttribute("action", response.encodeURL(form.getAttribute("action")));
    603     }
    604     // are these the only cases where URLs occur??
    605     // we should only do this for greenstone urls?
     582    if ( data != null ) {
     583
     584        // get all the <a> elements
     585        NodeList hrefs = data.getElementsByTagName("a");
     586        for (int i=0; hrefs!=null && i<hrefs.getLength(); i++) {
     587          Element a = (Element)hrefs.item(i);
     588          // ugly hack to get rid of : in the args - interferes with session handling
     589          String href = a.getAttribute("href");
     590          if (!href.equals("")) {
     591            if (href.indexOf("?")!=-1) {
     592              String[] parts = href.split("\\?", -1);
     593              parts[1]=parts[1].replaceAll(":", "%3A");
     594              href = parts[0]+"?"+parts[1];
     595            }
     596            a.setAttribute("href", response.encodeURL(href));
     597          }
     598        }
     599       
     600        // now find any submit bits - get all the <form> elements
     601        NodeList forms = data.getElementsByTagName("form");
     602        for (int i=0; forms!=null && i<forms.getLength(); i++) {
     603          Element form = (Element)forms.item(i);
     604          form.setAttribute("action", response.encodeURL(form.getAttribute("action")));
     605        }
     606        // are these the only cases where URLs occur??
     607        // we should only do this for greenstone urls?
     608    }
    606609   
    607610  }
Note: See TracChangeset for help on using the changeset viewer.