Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looking up webserver's hostname from applet

 
David Irwin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've designed an applet that connects to a custom server running on the same machine as the webserver. There aren't any issues making the actual connection. The question I have, however, is how to properly find the webserver hostname without hard-coding it into the applet. As I see it (and there are other ways please add) there are two ways to set the desired webserver hostname:

1) As a parameter to the applet coded into the applet on the HTML file. For example: <param name=host value='hostname'>
2) The applet could look up the server's hostname

Option 1 works fine but is there an easy way to look up the webserver's hostname from within an Applet as in option 2?

-Dave
 
Brian Pipa
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applet.getCodeBase()
or
Applet.getDocumentBase()

should work for you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic