Richard Ding created KNOX-884:
---------------------------------

             Summary: JavaScript rewrite rule results in encoded text
                 Key: KNOX-884
                 URL: https://issues.apache.org/jira/browse/KNOX-884
             Project: Apache Knox
          Issue Type: Bug
          Components: Server
    Affects Versions: 0.11.0
            Reporter: Richard Ding
            Assignee: Richard Ding
             Fix For: 0.12.0


Hadoop added links to datanode web UI in namenode datanodes page (HDFS-10440 & 
HDFS-10493) in the form of JavaScript. In Knox we added rewrite rules to map JS 
text '//{infoAddr}' to 
'https://gateway.host:8443/gateway/default/hdfs/datanode?host={infoAddr}'.

This works with Knox 0.7. But in Knox 0.11, the same rule results in the 
encoded query segment:

{code}
'https://gateway.host:8443/gateway/default/hdfs/datanode?host=%7BinfoAddr%7D'
{code}

and this breaks JavaScript code.

I did some investigation and it seems that the encoding comes from the Expander 
code:

{code}
private static void appendQueryPart(String part, StringBuilder builder) {
   
    try {
      
        builder.append(URLEncoder.encode(part, "UTF-8"));
    
    } catch ( UnsupportedEncodingException e ) {
      
        builder.append(part);
    
    } 
}
{code}





--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to