Problem of Dynamic JNLP

I pass parameters to jsp with request and use jsp to create jnlp with the parameters.
i use
http://www.exam.com:8001/csec/Start.jsp?name=aaa
to pass name to jnlp
the first time i can get the parameter!
But when the jsp is reloaded,jnlp will lose the parameter,it will be null
i can't slove the problem,
who can help me ,thanks
Start.jsp
outj.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
outj.println("<jnlp spec=\"1.0+\" codebase=\"http://www.exam.com:8001/csec"
+ "\"" + " href=\"Start.jsp\">");
String para = request.getParameter("name");
null

Hello Akihabara,
I am contacting you because you had the same issue before.
I am having a Application.jar which has 3 different versions. I have created a version.xml to specify about the version of the application.jar.
Now, I want my user to choose which version he wants to download.
for example: if he has the application_1.1.jar then he should be given a text box (in a JSP page) to enter which version he wants to download. if he enters 1.2 then that particular version should be downloaded.
Normally if we want to use versioning then we specify the the version in the JNLP file (EX: <jar href="application.jar" version="1.2" main="true" download="eager" /> )
I also want the java web start to do "JarDiff" while downloading so that it downloads only the pdated files.
( Normally to implement JarDiff we have to mention the "current-version" field in the jnlp file ( Ex: <jar href="application.jar" version="1.2" main="true" download="eager" current-version="1.1" /> )
I am using JnlpDownloadServlet to process the jnlp file. ( To get dynamic codebase and context path)
Instead of hard-coding the version field and current version fileld in the JNLP file can i generate a dynamic JNLP which would insert the above values for those fields.
In a previous post you solved the similar problem using a servlet as you mentioned over there. Did you use JnlpDownloadServlet also? or You had your own servlet?
Can you guide me regarding this issue.
Thanks,
Anjali

Similar Messages

  • How to run the dynamic jnlp generate by jsp, but cache one is not dynamic?

    Hi Web Start expert,
    I need some urgent help on this issue. I want to pass some session info from my protal web app to my java app through web start. I have tried to use a servlet or jsp to generate a dynamic JNLP which will include all the necessary properties. It works fine if I don't include a href attribute in my jnlp tag. but I won't be able to launch the application off line. So I include the href to point to a static jnlp file resides in the same directory where jars are installed. This time when web start launches, my Java application does not seem to recognize all the login properties I passed through web application, and launch the Login Dialog. What I want to do is, if I come from the portal, since I had signed on to the portal, I don't need to login again to the java app. but when next time I click on the offline shortcut on my desktop for my Java app, I need to sign on to launch my Java app that was cached on the client machine. What is the best way to do this? Please help!
    Thanks in advance.
    Jenny

    The problem here is, when you acess the servlet from the browser, the servlet generates the jnlp file with the properties based on the full reference to the servelt (ie: http://myhost.com/servlet?arguments=xxx;yyy).
    If you put the href in the jnlp file:
    <jnlp codebase="http://myhost.com" href="servlet">, When Java Web Start is invoked, it will re-download the jnlp file using just "http://myhost.com/servlet", This will cause the servlet to generate jnlp file w/o the propertys that were based on the arguments and parameters to the url.
    On the other hand, if you try to add the arguments and parameters to the href wirh <jnlp codebase="http://myhost.com" href="servlet?arguments=xxx;yyy"> two problems occur.
    1.) java web start (all versions thru 1.4.2) will generate the cache directory based on the whole string "servlet?arguments=xxx;yyy" this means that every invocation is a seperately cached app, and you will get lots of entries in the download applications page in the Application Manager.
    2.) on some platforms, generating cache directory with "?" or ";" can cause IOExceptions.
    These problems will be addressed in 1.5:
    1 - the cache directory will be based only on the string up to the first "?" or ";".
    2 - jnlp files w/o href, will still be shown in the downloaded applications, and can be launched offline (if offline-allowed)
    In the mean time the only work around I have heard, is someone tried modifying the servlet, to first download the jnlp file with the correct parameters and args but with href="servlet", but caching the jnlp file generated, and then when java web start requested the servlet with no args, a few seconds later, sending it back the cached version.
    /Dietz

  • Why jws doesn't start when i use jsp as dynamic jnlp?

    hello everyone,
    i use a jsp as dynamic jnlp to resolve the relative codebase problem,but jws can not start. while i use jnlp, there is no problem.i check the http head the jsp reterned,it seems no problem (it returns "application/x-java-jnlp-file" content type), but jws does not start and the browser opens it as a plan text. below is the http head the jsp and jnlp returned, i can not see any obvious difference that prevent jws start. hope somobody can help me, thanks.
    the jsp http head:
    HTTP/1.1 200 OK
    Content-Type: application/x-java-jnlp-file
    Date: Wed, 07 Aug 2002 02:52:31 GMT
    Server: Apache Tomcat/4.0.2 (HTTP/1.1 Connector)
    Connection: close
    Set-Cookie: JSESSIONID=EDAB1A3175B3D319BA33AE090EB973BF;Path=/webims
    the jnlp http head:
    HTTP/1.1 200 OK
    Content-Type: application/x-java-jnlp-file
    Content-Length: 372
    Date: Wed, 07 Aug 2002 02:49:58 GMT
    Server: Apache Tomcat/4.0.2 (HTTP/1.1 Connector)
    Connection: close
    Last-Modified: Wed, 07 Aug 2002 02:35:19 GMT
    ETag: "372-1028687719000"
    the response body is same. here is part of the jsp file:
    <%@ page contentType="application/x-java-jnlp-file"%>
    <%
    StringBuffer codebaseBuffer = new StringBuffer();
    codebaseBuffer.append(!request.isSecure() ? "http://" : "https://");
    codebaseBuffer.append(request.getServerName());
    if (request.getServerPort() != (!request.isSecure() ? 80 : 443))
    codebaseBuffer.append(':');
    codebaseBuffer.append(request.getServerPort());
    codebaseBuffer.append(request.getContextPath());
    %>
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp codebase="<%=codebaseBuffer.toString()%>" href="<%=request.getRequestURI()%>">

    I get the same problem since I moved to Tomcat 4.1.18.
    The difference is that when I look at a jnlp, I get
    Date: Tue, 18 Mar 2003 10:58:25 GMT
    Server: Apache/1.3.26 (Unix) mod_jk/1.2.0 mod_ssl/2.8.10 OpenSSL/0.9.6b PHP/4.2.3 FrontPage/5.0.2.2510
    Content-Length: 1355
    Content-Type: application/x-java-jnlp-file
    Last-Modified: Mon, 17 Mar 2003 15:58:46 GMT
    Client-Date: Tue, 18 Mar 2003 10:58:25 GMT
    Client-Peer: 192.197.110.222:80
    and at a jsp:
    Date: Tue, 18 Mar 2003 11:06:10 GMT
    Server: Apache/1.3.26 (Unix) mod_jk/1.2.0 mod_ssl/2.8.10 OpenSSL/0.9.6b PHP/4.2.3 FrontPage/5.0.2.2510
    Content-Type: application/x-java-jnlp-file;charset=ISO-8859-1
    Client-Date: Tue, 18 Mar 2003 11:06:10 GMT
    Client-Peer: 192.197.110.222:80
    Set-Cookie: JSESSIONID=026BF3209EC094A4045F1D37C2A0E98B;Path=/
    Could the difference be ;charset=ISO-8859-1
    How to remove that, in my jsp I just have :
    <% response.setContentType("application/x-java-jnlp-file"); %>
    Help
    Benoit

  • Dynamic JNLP causes exception on 1st run after java install

    I have a dynamic JNLP file (php) which runs my software. It works just fine, except for the 1st time it is run after a user has installed Java.
    I get the exception; "The following field was missing from the jnlp file: <jnlp>". When I look at the jnlp code in JWS in the "Launch File" tab of the error message, I see that the JNLP is not there - but the page the user would see if he was not logged into the system (as if JWS has cached the file or something).
    If I close it down, press F5 to refresh, and run it again everything works fine.
    I'm running the dyanmic.jnlp?dummy=randomnumber943934 to prevent caching. In addition, these headers are sent: (php code)
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // HTTP/1.1
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    // HTTP/1.0
    header("Pragma: no-cache");.. so nothing should be cached. But I'm not sure that's where the problem is - cause it only happens the first time after a java install.
    Any clues?

    I think you're dynamicallt created jnlp is invalid in someway; I can use the following without any problems:
    <?php
    header("Content-type: application/x-java-jnlp-file");
    echo "<?xml version=\"1.0\" ?>\n";
    $codebase = trim(stripslashes(urldecode($_REQUEST["codebase"])));
    $href = trim(stripslashes(urldecode($_REQUEST["href"])));
    echo "<jnlp spec=\"1.0+\" codebase=\"$codebase\" href=\"$href\">\n";
    ?>
    </jnlp>
    you should try and test the output of your generated code, something like this should work:
    test.php
    <html>
    <body>
    <textarea rows=20 cols=70>
    <?php
    include 'mydynamicscript.php';
    ?>
    </textarea>
    </body>
    </html>
    The first time a jnlp is called it is downloaded into the browser cache and javaws.exe is executed on it from that location, this in turn downloads the jnlp again from the passed codebase & href attributes into the jws cache. Subsequent calls the jnlp are extracted from the copy in the webstart cache, and often downloaded from the codebase & href attributes when it detects possible changes. In your case these jnlp files seem to differ.
    - Richard

  • Jnlpdownloadservlet and dynamic jnlp file

    Problem: we want the version handling (+ jardiff) of JnlpDownLoadServlet, but we also need to construct the jnlp file dynamically (for example: a .jsp file). It seems to me there are two solutions, neither of them good: a) hack the JnlpDownloadServlet (or roll our own), intercepting the jnlp-file-reading code to forward to the jsp page that generates the jnlp xml data and use the generated response as the file contents.
    b) generate each jnlp file dynamically and then store it in a temporary location for the JnlpDownloadServlet to pick up. This entails aging the temporary jnlp files and deleting them so the server doesn't get clogged with dead jnlp files.
    Is there a third possibility? Or something in the pipe for the near future?
    (Note: Web Start Services is not a solution for this task since WSS doesn't support jar versioning, and since the $$properties mechanism does not appear to be ideal for passing a lot of dynamic jnlp information.)
    Thanks in advance for any advice.

    My jsp page actually generates the list of jars for the application. It also passes some info specific to the user session by means of the jnlp file. Since we are doing games, the list of applications keeps growing. By generating the resource elements dynamically for a game, we can reduce maintenance (as opposed to having a large number of jnlp files with mostly duplicate code) -- especially when a version is updated.
    Till we can move to 1.5, I plan to use the temporary file creation method.
    Thanks, --John                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Dynamic JNLP - displaying using java web start

    Hi,
    I am creating a dynamic JNLP in a servlet at the server side. Please see below.
    String someJnlpString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
                                                "<jnlp .....    >    </jnlp>";       
            String attachment = "inline; filename=\"launch.jnlp";           
            String ct = "application/x-java-jnlp-file";
            OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream());
            response.setContentType(ct);
            response.setHeader("Cache-Control", "max-age=30");
            response.setHeader("Content-disposition", attachment);
            out.write(someJnlpString);{code}
      Then in my JSP, I am trying to open this JNLP  by using the following code
    {code}        window.open('servlet/DisplayImage?arg=first-arg");The exception that I am getting is JNLParseException could not parse launch file. Error at line 0. If I open the downloaded file then its working.
    Can somebody please advise me how can I directly open that JNLP from the servlet by using java web start?
    Thanks a ton,
    Subhash

    I am able to run it now after clearing the java cache

  • Problem in dynamically generating the file upload field

    Hello all
    I am using netbeans 5.5 and visualwebpack for my jsf project.
    i have a problem in dynamically generating the file upload field and using it.
    I have a panel say "panelA" which holds file upload fields.
    Depending upon the count value i generate the file upload field using following code snippet:
    Upload upload1 = new Upload();
    upload1.setId("upload1");
    getPanelA.getChildren().add(upload1);
    The page successfully shows up the file upload fields. While the user clicks the submit button, i have used following logic to perform upload:
    List components = getPanelA().getChildren();
    for(int i = 0; i<components.size(); i++){
    if(components.get(i) instanceof Upload){
    UploadedFile uploadedFile = ((Upload)components.get(i)).getUploadedFile();
    I am getting this UploadedFile object null.
    How can i solve this problem.

    Anyway,
    I solved the problem.
    Actually i was using label property of the upload field due to which i got null pointer exception.
    I removed the label property of the upload field and things worked as i wanted.

  • Dynamic JNLP and JWS Application Manager

    All,
    I have a Swing application that communicates to the server via Servlets. I have packaged the entire application into a WAR file and I am using JWS to distribute to the users.
    The "main" method of my application accepts two parameters, one of which is dynamic based on information from the web server. To be able to calculate the value of that parameter, I decided to dynamically create and serve my JNLP file through a servlet. The parameter is then passed into the application via the <argument> tag in the served JNLP file.
    That part works great. However, once the application is installed, it doesn't show up in JWS Application Manager. My best guess is because there is not a "physical" JNLP file for reference.
    Can anyone out there confirm or deny my guess? And, more importantly, can anyone give me an idea on how to keep the dynamic JNLP file and get it to install in the JWS Application Manager?
    Thanks!

    Got it fixed. Apparently, the JWS Application Manager "view" setting wasn't correct. Once it was working, the application was showing up fine.

  • After Effects won't close/Problems with dynamic links

    When I quit After Effects the icon still shows up and it says that it is still open, even force quit will not work. Also having problems with dynamically linked files between after effects and Premiere pro. Rendering in Premiere doesn't work unless I go to AE, save the project, then go back to Premiere. I have OSX Mavericks 10.9.2, a late 2012 mac pro, and AE CC 12.2.1.5

    Kevin: would appreciate further thoughts on this.
    I am using Pr2014, version 8.0.0 I am using AE2014, version 13.0.2.3. When I was on earlier versions of each, I had no problem importing AE comps into Pr. I'd choose import in Pr, then select the AE project, then select the comp. But with my new and improved versions of AE and Pr, I keep getting "importer reported a generic error."
    I also tried to go the other way. I selected in Pr the clips I wanted to work on in AE, and then tried "replace with AE comp" but got the "generic error" message again..
    Finally, I attempted to create a Dynamic Link from Pr via the File menu, but with each of the options from there, I got "failed to connect to AE Dynamic Link"
    Any advice you can share, would be most welcome.

  • Serving dynamic JNLP gotchas

    I'm planning on providing a means by which users will, upon hitting a certain URL, be served with a JNLP file that is appropriate to their environment. For example, if the user (authenticated in our case via an enhanced version of the MOD_NTLM Apache module) is in a group that should be performing beta testing, he/she could potentially be presented with a JNLP file that enables the testing of the beta version of the application.
    There have been many concerns raised on this forum regarding the dynamic generation of JNLP files. One of particular concern to me was: http://forum.java.sun.com/thread.jsp?forum=38&thread=476755 I'm not quite sure, though, which of these issues are truly still issues with the latest 1.4.x of Web Start [1.5 won't be an option for us until it is officially released].
    Can anyone provide a summary of the known issues with dynamically serving up JNLP files and their known work-arounds? If there is an FAQ (by Sun or anyone else) that captures these issues, I'd greatly appreciate it if anyone could point me to it.
    Also, if you have any advice on which dynamic mechanism (servlet, servlet filter, JSP, other?) seems to work best or cause the least amount of issues, I'd appreciate the feedback.
    Thanks in advance,
    Mike

    You might wonna try to post your questions about serving dynamic JNLP gotchas to the Java Developers group. You can find it online @ http://groups.yahoo.com/group/webstart
    - Gerald

  • Solving u0091Out of Memoryu0092 problem u0096 Using JNLP

    Hi all,
    I am just following the below mentioned blog /people/keerti.nayak/blog/2007/03/05/solving-145out-of-memory146-problem-150-using-jnlp
    I got stuck @ step 2.
    can anyone tell me... whats the exact path of the launcher file.
    Regards
    Biplab

    Hi,
    If you place the Mouse on the Integration Repository,
    You will be able to see the path on the bottom left side of the screen, which is marked as Red in the Blog
    In my case the path is----http://sxddev:50000/rep/start/repository.jnlp
    Regards
    Seshagiri

  • Dynamic JNLP files?

    I have a number of small, embedded devices running a Cherokee web server, each with their own IP address and hostname. Each of these devices has a standard image that includes a few applets. Is there a way to make a standard JNLP file that could go in the image but would still work? My concern is that the codebase is going to be different for device...

    A way to generate dynamic JNLP's is by using a servlet.
    The servlet path is the JNLP target for the client, and the servlet itself outputs the JNLP contents with the JNLP content-type.
    Jacco

  • Dynamic JNLP file problem

    Okay this topic can be deleted, I'm not sure how to do it myself.
    The problem wasn't Java related at all.
    Thanks.
    Edited by: Cluber on Sep 12, 2011 5:15 PM

    Okay this topic can be deleted, I'm not sure how to do it myself.
    The problem wasn't Java related at all.
    Thanks.
    Edited by: Cluber on Sep 12, 2011 5:15 PM

  • Issue with IE and dynamic JNLP (JSP)

    I'm trying to create a JNLP file using JSP to insert a dynamic argument into the webstarted (new word?) program. The link works fine in Firefox and Opera, but IE throws an error and says that it could not download the file. Here's my setup:
    JSP file (JNLP)
    LaunchClient.jsp
    <%@page contentType="application/x-java-jnlp-file"%>
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc.//DTD JNLP 1.5//EN" "http://www.netbeans.org/jnlp/DTD/jnlp.dtd">
    <%
        String projectRefID = request.getParameter("projectRefID");
    %>
    <jnlp codebase="http://127.0.0.1:8080/tssa/">
      <information>
        <title>AppTest</title>
        <vendor>Company, Inc.</vendor>
        <homepage href="homepage.html"/>
        <description> </description>
        <icon href="default"/>
        <offline-allowed/>
      </information>
      <resources>
        <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
      </resources>
      <resources>
        <jar download="eager" href="jars/AppTest.jar" main="false"/>
      </resources>
      <application-desc main-class="apptest.Main">
        <argument><%= projectRefID %></argument>
      </application-desc>
    </jnlp>My link to the above page looks like this:
    <a href="LaunchClient.jsp?projectRefID=<%=currProject.getReferenceIdentifier()%>" >CLICKME</a>I've added the following mime mappings to my web.xml:
        <mime-mapping>
            <extension>jnlp</extension>
            <mime-type>application/x-java-jnlp-file</mime-type>
        </mime-mapping>
        <mime-mapping>
            <extension>jar</extension>
            <mime-type>application/java-archive</mime-type>
        </mime-mapping>I've also tried using a servlet mapping so the link will still have a .jnlp extension as follows:
      <servlet>
        <servlet-name>JnlpMapping</servlet-name>
        <jsp-file>/restricted/LaunchClient.jsp</jsp-file>
      </servlet>
      <servlet-mapping>
        <servlet-name>JnlpMapping</servlet-name>
        <url-pattern>/restricted/myProgram.jnlp</url-pattern>
      </servlet-mapping>My link then points to myProgram.jnlp instead of LaunchClient.jsp. But that has the same results (works in firefox/opera but not in IE). Does anyone see why IE is complaining? Do I have to break down and write a servlet?
    --Also: I'm using Sun Application Server PE 9
    Message was edited by:
    QSilver002

    I had the same problem. The resolution is preety simple. You can't set header Cache-Control to no-cache, becouse IE tries to cache it before running. That's why any java error occurs, just can't find the file error. What supprised me is that you can't even save the file with right click "Save the target as..", which seems to be little strange. Any other page of type type/html with this header make no problem with that.
    Conclusion:
    IE makes some special trick with a file of type application/x-java-jnlp-file. Cache-Control to no-cache couses not only disability of running the ws directly, but also saving it locally, which doesn't happen with text/html type of page.
    Sevage

  • Dynamic jnlp - automatic launch

    I realize there are some posts on this topic, but nothing recent and nothing particularly concrete. Any insight is much appreciated.
    I am dynamically building a jnlp so that I can pass dynamic arguments into my webstart app. I am getting the file download dialog that asks me to either open or save my jnlp file. I am running Tomcat 6. I am using https. I have played with various settings based suggesstions in these forums. My response object looks like this:
    resp.setHeader("Content-disposition", "attachment; filename=supply.jnlp"  );
                resp.setHeader("Cache-Control", null);
                resp.setCharacterEncoding(null);
                resp.setHeader("Set-Cookie", null);
                resp.setHeader("Vary", null);
                resp.setDateHeader("Last-Modified", new Date().getTime()); my web.xml looks like this:
    <servlet>
         <servlet-name>SupplyJNLPServlet</servlet-name>
         <servlet-class>mil.atc.supply.servlet.SupplyJnlpBuilderServlet</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>SupplyJNLPServlet</servlet-name>
         <url-pattern>/SupplyJNLP</url-pattern>
    </servlet-mapping>
    <servlet>
         <servlet-name>JnlpDownloadServlet</servlet-name>
         <display-name>JnlpDownloadServlet</display-name>
         <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>JnlpDownloadServlet</servlet-name>
         <url-pattern>*.jnlp</url-pattern>
    </servlet-mapping>
    <mime-mapping>
         <extension>jnlp</extension>
         <mime-type>application/x-java-jnlp-file</mime-type>
    </mime-mapping>
    The jnlp mime type is configured on my IIS server - I am using the Apache ASAPI filters.
    Once again, thanks for any help.

    dcfrank65, or anyone else... did you ever discover a solution to this problem?
    I too have an issue whereby opening a dynamically generated jnlp file over HTTP works fine, but opening it over HTTPS causes IE to prompt whether the file should be opened or saved. As you already discovered, there do seem to be quite a few threads covering this topic, but none with a definitive answer. In my case, the JNLP file is being rendered by ASP.NET code running on IIS.
    For the record, at the risk of becoming immediately unpopular (!), AndrewThompson64's comment about how dcrank65 failed to ask a question seems unnecessarily obtuse, since dcfrank65 did previous say:
    "I don't want to be prompted to open or save, I want my jnlp file to be executed and the webstart application to run with no further action from my user. +So I am asking for ideas to accomplish this+."
    This is a fairly clear and concise request for information, regardless of whether it was phrased as a question. So, dcfrank's response, though a little strong, seems justified.

Maybe you are looking for