Difference Between URL, URI and URN in Java
Last Updated :
15 Jul, 2024
URI stands for Uniform Resource Identifier. URI is a sequence of characters used to identify a resource location or a name or both over the World Wide Web. A URI can be further classified as a locator, a name, or both.
Syntax of URI: Starts with a scheme followed by a colon character, and then by a scheme-specific part.
The most popular URI schemes, are HTTP, HTTPS, and FTP.
URL stands for Uniform Resource Location. URL is a subset of URI that describes the network address or location where the source is available.URL begins with the name of the protocol to be used for accessing the resource and then a specific resource location. URLs build on the Domain Name Service (DNS) to address hosts symbolically and use a file-path-like syntax to identify specific resources at a given host. For this reason, mapping URLs to physical resources is straightforward and is implemented by various Web browsers.
URN stands for Uniform Resource Name. It is a URI that uses a URN scheme.
"urn" scheme: It is followed by a namespace identifier, followed by a colon, followed by namespace specific string
URN does not imply the availability of the identified resource. URNs are location-independent resource identifiers and are designed to make it easy to map other namespaces into URN space.
URI | URL | URN |
---|
URI stands for Uniform Resource Identifier. | URL stands for Uniform Resource Location. | URN stands for Uniform Resource Name. |
URI is a superset of URL & URN | URL is a subset of URI. | URN is a subset of URI. |
It is used to identify a resource on the internet either by location or name or both. | It is used to identify a resource on the internet either by location. | It uniquely identifies the resource by name. |
URI is not always a URL | All URLs are URIs | All URNs are URIs |
URI includes components like scheme, authority, path, query, etc. | URL includes protocol, domain, path, hash, query, string etc. | URN does not include any component. |
Examples: - https://www.example.com/page.html
- urn:isbn:0451450523
| Examples: - https://www.geeksforgeeks.org/
- https://www.example.com/page.html
| Examples: - urn:isbn:0451450523
- urn:ietf:rfc:3986
|
Here is a diagram that shows the relationship between URL, URI, URN:
Similar Reads
Difference Between URI and URN in Java URI stands for Uniform Resource Identifier. It identifies the resource either by name, or by location, or by both. It allows uniform identification of the resources. Here the resource can be anything like documents, images, files, web pages, etc. that can be part of the web architecture. The identif
2 min read
Difference Between URL and URN in Java URL stands for Uniform Resource Location. A URL contains a protocol, server name or IP Address, Port Number, filename, or directory name. URL is a subset of URI as perceived from the image shown below that describes the network address or location where the source is available. URL begins with the n
3 min read
Difference Between URL and URI In Web browsers and Internet connections, it is important to understand the difference between a Uniform Resource Identifier (URI) and a Uniform Resource Location (URL). Both URIs and URLs are pointers to things like web pages, images, documents, or other online content. However, they have distincti
7 min read
Difference Between URL and URI In Web browsers and Internet connections, it is important to understand the difference between a Uniform Resource Identifier (URI) and a Uniform Resource Location (URL). Both URIs and URLs are pointers to things like web pages, images, documents, or other online content. However, they have distincti
7 min read
Difference between URL and Link When you are searching for information on the web, you frequently use terms like URL and link. Also, these two terms can be explained in terms of one another, as they are not defined in the same way. While a URL (Uniform Resource Locator) is the address of a resource on the web, a Link (or Hyperlink
5 min read
Difference Between Domain Name and URL In the world of the internet and websites, Domain Name and URL are very common terms and are used interchangeably, but there is a lot of difference between these two terms. In this article, we will learn what the difference is between a domain name and a URL.What is a Domain Name?It is very hard to
6 min read