Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Swing client w/ WebStart & J2ee

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm writing a swing client that is deployed via Java Web Start and
communicates to a backend weblogic server. My problem is that when I
start the application I want to be able to communicate back to the server
that application jnlp was launced from so I don't have to hard code the
server in the client code.

For example. I have a .war file on the weblogic server that contains
a web page which references the .jnlp file. The application launches
fine from the .jnlp and is cached correctly, however, within the application
I then want to talk to the server via j2ee but don't have the server
name and port #. My thought is that it is in the .jnlp file locally since
the .jnlp file is create using the webstart servlet code and contains the
server name, but how can my app find this out?

Thanks in advance for any help.
Steve
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are on the right track. Connection information can be included in the JNLP file as a property. In your code, you can access the property simply through System.getProperty(String). For details, read up on the JNLP file Format.
http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html
 
Steve Trudel
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Carl,

That helped alot. After I posted the message I found a snippet
of code that accesses BasicService to get the codebase but then I thought
that there may be a possiblity that the .war file may be on a different
server from the j2ee services so your response solves that.

URL codebase = ((BasicService)ServiceManager.lookup("javax.jnlp.BasicService")).getCodeBase();
System.out.println("CodeBase: " + codebase.toString());

I used the following to find the property that you led me to create
Properties plist = System.getProperties();
plist.list(System.out);

Thanks Again!
Steve
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic