tags:

views:

7

answers:

0

I'm using Rhino to generate XHTML but my urls are being encoded as in:

-http://www.example.com/test.html?a=b&c=d

becomes

-http://www.example.com/test.html?a=b&c=d

Failing test case as follows:

public class E4XUrlTest extends TestCase {
    public void testJavascript() throws Exception {
        final Context context = new ContextFactory().enterContext();
        context.setLanguageVersion(Context.VERSION_1_7);
        try {
            final ScriptableObject scope = new Global(context);
            final Script compiledScript  = context.compileReader(
                    new StringReader("<html><body><a href={'blah.html?id=2345&name=345'}></a></body></html>"), "test", 1, null);
            HashMap<String, Object> variables = new HashMap<String, Object>();
            Set<Entry<String, Object>> entrySet = variables.entrySet();
            for (Entry<String, Object> entry : entrySet) {
                ScriptableObject.putProperty(scope, entry.getKey(), Context.javaToJS(entry.getValue(), scope));
            }
            Object exec = compiledScript.exec(context, scope);
            String html = exec.toString();
            System.out.println(html);
            assertTrue(html.indexOf("id=2345&name") > 0);
        } finally {
            Context.exit();
        }

    }
}

Any ideas?