• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing a url to your JWS app

 
Ranch Hand
Posts: 44
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to implement something that would pass a dynamic url to my JWS app as it launches, but should also know when it's being launched locally (from the desktop) as not to load the last dynamic url. If it's launched locally, I want it to prompt the user for the file or url to load. If it's launched via the web, the location will be supplied.

So, what should I use to forward the information to the JWS app?

So far, I've only gotten the <property> tag to work, by using this in my code.

but when I launch it from the desktop, I still get the value - it retains it from the last dynamic web launch.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, of course you do. It's still part of the application's configuration, no matter where it runs from.

The application shouldn't care whether it's run from the web or from a locally cached copy, at least not according to the design of JWS. What's your use case for caring?
 
Jeff Gent
Ranch Hand
Posts: 44
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a visualization app that we're deploying via JWS. I'm trying to tie it into a web page that will call my jnlp along with supplying the url to the file my app is suppose to open. So I thought we could dynamically build the jnlp to supply the link to the web service query that will supply the data to my application. However, my app can also open local files if the user has any. I'd like the user to be able to launch the JWS app from the desktop and be prompted for the file to load, but if they launch it via the web site, it's already being told what file to load, so it just opens it.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you've got two different versions. (One version hard-codes the file to load, the other allows the user to choose.) That would require two different JNLP files.

When you run a JWS application from a website, that causes it to be downloaded and cached on the user's machine. The application can later be run from the cache. It can also be designed so that if there's a new version on the website, it will download and cache that new version. This means that "run from the website" and "run from the user's machine" aren't really meaningful categories in Web Start.

 
Jeff Gent
Ranch Hand
Posts: 44
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Was thinking there might be a way to validate the last file. For example, perhaps I could write a jnlp file with the url and timestamp as variables. I then write that information to a local file or some other location (PersistantService or muffin). Then if the program is launched again and the jnlp url and timestamp equal that stored in the local file, then it is invalid and thus being run from the local system and not the web.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, sounds like that might work. Or you might still consider the two-configuration option: the first provides a URL from the web site, which as you observer will always use that URL no matter where it's run from. The second wouldn't provide any URL, and so it would always prompt the user no matter where it was run from.
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hey, of course your deployed your JNLP file to web application. So do one thing to achieve your purpose you need to crate dynamically JNLP. So for that first you have to required one JSP which actually create Dynamic JNLP for you.

For that create one Servlet which actually set parameters what you required and then pass request to your JSP using,



After setting all your request param create your JSP like,



so that will create dynamic JNLP for you.

 
Jeff Gent
Ranch Hand
Posts: 44
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, rereading Paul's comment again. Can I create two jnlp files for the same application? One that is dynamic, which by default does not have a desktop icon, and loads the file based on the existence of a "property" definition in the jnlp file. Then a second jnlp file that is static, does specify a desktop icon and menu shortcut, and does not contain the "property" definition, thus making the application prompt the user for the file to import. Does this sound correct?
 
Jeff Gent
Ranch Hand
Posts: 44
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I tried this on my VM and it worked.. then I get into the test environment and it doesn't work. I have two JNLP files, one is dynamic and does not have an href. The other is static and contains the <desktop /> tag to indicate a shortcut. The shortcut is never getting created if I run the static jnlp file. It's the same code base.. what's going on?
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeff Gent wrote:It's the same code base.. what's going on?



Oh yeah, I remember this... I wanted to have six JNLP links which differed only in the startup parameters provided to the app. But if all six JNLP files referred to the same jar, then the first one which somebody used would cache the jar locally and the other links would use the cached jar and the parameters from the first one. I had to create six identical copies of the jar with different names, one for each version of the app.
reply
    Bookmark Topic Watch Topic
  • New Topic