Hi Denis,
You do not need to specify the protocol in the URL, however it doesn't hurt to do so (especially if you are persisting the URL in some file where the average reader may not understand what it is for).
Basically the RMI methods expect to use RMI to connect. (Funny about that.
) So they don't need the "rmi:" protocol prefix.
The same as web browsers usually expect to be connecting to a web server, so they
usually do not need you to enter the http: protocol prefix. If you type in
www.javaranch.com your browser will normally automatically assume that you mean to use HTTP, and automagically prefix your URL so that it appears as
http://www.javaranch.com. Specifying the protocol is only necessary if you want to use some other protocol - for example, if you want to connect to an FTP server via your web browser, in which case you would prefix the URL with "ftp:" (for example
ftp://homelinux.yi.org/).
Most web browsers (in fact all that I can remember) also do not need the port you are connecting to - they automatically assume that you are connecting to port 80. So you can be explicit and say
http://www.javaranch.com:80/, or you can say
http://www.javaranch.com and your browser will still get to exactly the same place. Specifying the port is only necessary if you want to go to a non standard port (For example, the ISSN web page is on port 8080, not port 80, so if you want to go to their page you have to enter the port number in the URL:
http://www.issn.org:8080/pub/).
The same applies to RMI: by default, all the RMI methods assume that you are going to use RMI, that you are connecting to the local host, and that you are using port 1099. So all the following are equivalent:
rmi://localhost:1099/test//localhost:1099/testrmi://localhost/test/test (And many more, I got bored after the first four
)
But, as mentioned earlier, you
might want to give a fully qualified URL if there is any possibility that someone may look at your properties file directly - in this case having the fully qualified URL would make more sense to the reader.
Regards, Andrew
[Sorry, UBB automatically prefixes http: to URLs with no protocol, so my example of
www.javaranch.com does not really work the way I wanted it to]
[ April 15, 2004: Message edited by: Andrew Monkhouse ]