Changeset 16798

Show
Ignore:
Timestamp:
14.08.2008 20:17:05 (11 years ago)
Author:
ak19
Message:

getHrefOID() method modified: The href_url lookup key for internal links within HTML pages needs to be URL encoded first before looking it up in the database since it is stored URL encoded.

Files:
1 modified

Legend:

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

    r15770 r16798  
    496496 
    497497    protected String getHrefOID(String href_url){ 
     498    // URL encode the href_url since that's how the href key is stored in the database 
     499    try { 
     500        // URLEncoder encodes spaces as + instead of %20, but the key will be %20 
     501        href_url = java.net.URLEncoder.encode(href_url, "UTF8"); 
     502        href_url = href_url.replace("+", "%20"); 
     503    }catch(Exception e) { 
     504        logger.warn("Tried to encode href_url into URL but failed with: " + e.getMessage()); 
     505    } 
     506     
    498507        return this.coll_db.docnum2OID(href_url); 
    499508    }