• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

RMI

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It may be silly question, but whats the difference between "rmi://etc" and "//etc" ?
It seems that both work on Mac and Windows, but why in Sun documentation it is said that:

Each method of the Naming class takes as one of its arguments a name that is a java.lang.String in URL format (without the scheme component)


In documentation to other RMI methods this is constantly repeated.
In RMI tutorial:

Also, you don't need to specify a protocol in the URL.


So I dont need or I should not?
Thanks
PS. Pls dont tell me that difference between them is 4 letters
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

PS. Pls dont tell me that difference between them is 4 letters


Darn, you know my tricks.
Mark
 
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's my guess:
You don't need to specify the protocol (which is what "rmi:" is in the URL) because you're registering, or looking up, a remote object. The protocol used to retrieve the object has no bearing on it's name.
As I said, it's my guess. If anybody else wants to supply the correct answer, please do so. I'm curious.
Burk
 
Denis Spirin
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[to Mark]
"I was gratified to be able to answer promptly. I said I don't know." Mark Twain.
"The important thing is not to stop questioning." Albert Einstein.

[ April 16, 2004: Message edited by: Denis Spirin ]
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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/test
  • rmi://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 ]
     
    Denis Spirin
    Ranch Hand
    Posts: 72
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Andrew,
    thank you for the answer! Ive never seen explanation about "rmi:" anywhere, Sun only mentions default port and host, bu not protocol. Anyway, I compared documentation for 1.3
    and 1.4 versions. In 1.4 "without the scheme component" appears, but it is absent in 1.3.
    Thats one of the reasons why on documntation we can earn 70 points
    Regards
     
    I need a new interior decorator. This tiny ad just painted every room in my house purple.
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic