• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

getCodeBase().getHost()  RSS feed

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
what is meaning of this : getCodeBase().getHost()
Thanks in advance,
angela
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angela,
Any time you have a question about what a method does, the best place to look is the API documentation. You can find a copy of it online at
http://java.sun.com/j2se/1.3/docs/api/overview-summary.html
The place to start is to know which class is involved. In this case, I'm assuming that the code you posted came from a class that extends java.applet.Applet, so you'd want to look in the java.applet package at the documentation for the Applet class. As the documentation indicates, getCodeBase() returns the URL from which the applet was downloaded, and if you follow the hyperlink for URL (displayed in the left column of the "Method Summary" table), you can find the documentation for getHost(). As it indicates, that method returns a String representing the name of the host associated with the URL. In other words, the code snippet you posted returns the name of the server from which the applet was downloaded.
------------------
Brett Spell
Author, Professional Java Programming
[This message has been edited by Brett Spell (edited March 22, 2001).]
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Brett,
Angela

Originally posted by Brett Spell:
Angela,
Any time you have a question about what a method does, the best place to look is the API documentation. You can find a copy of it online at
http://java.sun.com/j2se/1.3/docs/api/overview-summary.html
The place to start is to know which class is involved. In this case, I'm assuming that the code you posted came from a class that extends java.applet.Applet, so you'd want to look in the java.applet package at the documentation for the Applet class. As the documentation indicates, getCodeBase() returns the URL from which the applet was downloaded, and if you follow the hyperlink for URL (displayed in the left column of the "Method Summary" table), you can find the documentation for getHost(). As it indicates, that method returns a String representing the name of the host associated with the URL. In other words, the code snippet you posted returns the name of the server from which the applet was downloaded.


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!