File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes URI vs URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "URI vs URL" Watch "URI vs URL" New topic
Author

URI vs URL

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi,

Whats the diff between URL & URI...

Is it diff terms for same thing?

Tx
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
I am not sure but a guess:

URI - universal resource indicator - it's the query string (the string after ?, which identify a particular resource).

URL - universal resource locator - it's the whole string ( server name (IP) + URI).

correct?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Not quite right

Uniform Resource Identifier (URI)
Uniform Resource Locators (URL)

Refer to this RFC :
http://www.faqs.org/rfcs/rfc2396.html
And more :
http://www.w3.org/TR/uri-clarification/
[ May 08, 2006: Message edited by: Satou kurinosuke ]

[My Blog]
All roads lead to JavaRanch
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Thanks Rathi...and Satou..

balakrishna nannaka
Greenhorn

Joined: May 08, 2006
Posts: 3
url is not there only uri exists for convieneance we call the path that includes server as url and actual resource as uri .
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
I'm not sure anyone really hit this on the head so far...

A URL is, as given earlier, a Uniform Resource Locator - it's what we colloquially call a "web address" and defines the host name and port of a server and the path to a resource on that server (including any extra query string data).

A URI is the general term given to all Resource Identifiers. A URL is a special case of a URI, but there are others, most notably a Uniform Resource Name (URN).

URNs are primarily intended for naming of resources and defining namespaces without reference to a path in a file system. They take the form:

urn:{namespace}:{otherdata}

where {namespace} is chosen by and assigned to the organisation and {otherdata} is chosen by the organisation to sub-categorise. For example, RFC 3121 gives the example:

urnasis:names:tc:docbook:dtd:xml:docbook:5.0b1

This is a urn (first bit) owned by the Oasis group (second phrase) and part of their "names" namespace, residing under the category "tc:docbook:dtd:xml:docbook" with version "5.0b1".

You might ask what use this is - in practise URNs are rarely used because there is no authorative body for their administration. Unlike domain names there is no main registration process, which makes it unclear who owns what namespaces. So URLs are in fact used in many places to define a namespace where in fact perhaps a URN would be better.

One example of a URN in J2EE is when declaring a tag library in a JSP document (the XML variety) where you want to refer to an explicit TLD or a tag file directory. In that case you can use these:

urn:jsptld:{path}
urn:jsptagdir:{path}

where {path} is the path to the TLD or the tag directory respectively.

So URNs do have limited use locally within applications, but their widespread use is much reduced. I don't know why many of the servlet methods talk about URIs when nearly always they actually mean URLs - perhaps they are left open for the possibility of using URNs etc. in the future?
[ May 08, 2006: Message edited by: Charles Lyons ]

Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URI vs URL