title: Incorrectly encoded URL in jnlp file when called from javascript
body: <p>I'm trying to start a Java Web Start application with Javascript, whereas the Javascript code sends a parameter containing a url (<code>window.location.origin</code>) to the jnlp file. My problem is that in the jnlp file the url is incorrectly encoded, i.e. instead of writing <code>http://localhost:7001/root</code> to the file, I get <code>http\x3A\x2F\x2Flocalhost\x3A7001/root</code> and thus can't start my application.</p>
  
  <p>I'm calling the Java Web Start application from a jsp file with javascript (index.jsp):</p>
  
  <pre><code>&lt;%@ page language="java" pageEncoding="ISO-8859-1"%&gt;
  
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
      &lt;script type="text/javascript"&gt;
  
        window.onload = function() {
          window.open('/root/my.jsp?hostname=' +window.location.origin+ '&amp;date=' + Date.now());
        }
    &lt;/head&gt;
    &lt;body&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My jnlp file (webStart.jsp):</p>
  
  <pre><code>&lt;%@ page contentType="application/x-java-jnlp-file"%&gt;
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;jnlp spec="1.5" codebase="${param.hostname}/root/?v=${param.date}"&gt;
    &lt;information&gt;
      &lt;title&gt;title&lt;/title&gt;
      &lt;vendor&gt;vendor&lt;/vendor&gt;
    &lt;/information&gt;
    &lt;security&gt;
      &lt;all-permissions/&gt;
    &lt;/security&gt;
    &lt;resources&gt;
      &lt;j2se version="1.7+"/&gt;
      &lt;jar href="my_application.jar"/&gt;
    &lt;/resources&gt;
    &lt;applet-desc main-class="myPackage.main" name="my-applet" height="1" width ="1"/&gt;
  &lt;/jnlp&gt;
  </code></pre>
  
  <p>My application server is Glassfish 3.1. I tried changing the UTF-8 and ISO-8859-1 encodings, but always get the same result. What else could be the solution to this problem?</p>
  
  <p>Edit: I also tried <code>encodeURIComponent(window.location.origin)</code>, but this didn't change anything.</p>