• Post Reply Bookmark Topic Watch Topic
  • New Topic

getCodeBase().getHost()  RSS feed

 
Angela Jessi
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
 
Brett Spell
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.

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!