Questions tagged [uri]

A Uniform Resource Identifier (or URI) is a string of characters used to identify a name or resource. URI is legacy terminology. In most cases, the term URL should be used instead.

A Uniform Resource Identifier (or URI) is a string of characters used to identify a name or resource.

Note: The current URL Standard at https://url.spec.whatwg.org/#url-representation supersedes RFC 3986 and dispenses with the use of the term URI, as documented in its Goals section:

Standardize on the term URL. URI and IRI are just confusing. In practice a single algorithm is used for both so keeping them distinct is not helping anyone. URL also easily wins the search result popularity contest.

But the information below documents URI in terms of the legacy RFC 3986 spec.


Structure

A URI can be a Uniform Resource Locator , a Uniform Resource Name , or both.

RFC 3986 defines a URI as composed of the following parts:

    foo://example.com:8042/over/there?name=ferret#nose
    \_/   \______________/\_________/ \_________/ \__/
     |           |            |            |        |
  scheme     authority       path        query   fragment

Then defining relative URIs (Section 5.2), you can omit any of those sections, always starting from the left. In pseudo-code, it looks like this:

 result = ""

  if defined(scheme) then
     append scheme to result;
     append ":" to result;
  endif;

  if defined(authority) then
     append "//" to result;
     append authority to result;
  endif;

  append path to result;

  if defined(query) then
     append "?" to result;
     append query to result;
  endif;

  if defined(fragment) then
     append "#" to result;
     append fragment to result;
  endif;

  return result;

The URI you are describing is a scheme-less relative URI.

Examples

For example, in the following URI:

https://stackoverflow.com/questions/tagged/uri?sort=newest&pagesize=50#questions

... the components are:

  • scheme: https

  • hierarchical part: //stackoverflow.com/questions/tagged/uri

  • query: sort=newest&pagesize=50

  • fragment: questions

The precise syntax of the individual components varies depending on the scheme. Here are some examples:

  • mailto:nobody@example.com?subject=Hello&body=Is%20anybody%20home%3F

  • data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=

  • urn:ietf:rfc:3986

URL

A URL is a URI but is more specific. In addition to identifying a web resource, a URL specifies the means of acting upon or obtaining the representation, specifying both its primary access mechanism and network location.

For example, the URL http://example.org/wiki/Main_Page refers to a resource identified as /wiki/Main_Page whose representation, in the form of HTML and related code, obtainable via HyperText Transfer Protocol (http) from a network host whose domain name is example.org.

URI Reference

A URI reference may take the form of a full URI, or just the scheme-specific portion of one, or even some trailing component thereof – even the empty string. An optional fragment identifier, preceded by #, may be present at the end of a URI reference. The part of the reference before the # indirectly identifies a resource, and the fragment identifier identifies some portion of that resource.

To derive a URI from a URI reference, software converts the URI reference to 'absolute' form by merging it with an absolute 'base' URI according to a fixed algorithm. The system treats the URI reference as relative to the base URI, although in the case of an absolute reference, the base has no relevance. The base URI typically identifies the document containing the URI reference, although this can be overridden by declarations made within the document or as part of an external data transmission protocol. If the base URI includes a fragment identifier, it is ignored during the merging process. If a fragment identifier is present in the URI reference, it is preserved during the merging process.

Web document markup languages frequently use URI references to point to other resources, such as external documents or specific portions of the same logical document.

Uses of URI references in markup languages

  • In HTML, the value of the src attribute of the img element provides a URI reference, as does the value of the href attribute of the a or link element.
  • In XML, the system identifier appearing after the SYSTEM keyword in a DTD is a fragmentless URI reference.
  • In XSLT, the value of the href attribute of the xsl:import element/instruction is a URI reference; likewise the first argument to the document() function.

Examples of absolute URIs

Examples of URI references

6139 questions
2
votes
2 answers

Can not open downloaded file by it uri

Actually, I use intent to select a pdf file. And I get uri and its path (getPath()) in onActivityResult. The path I got is "content://com.android.providers.downloads.documents/document/2816" which is not as a usual path of pdf file. Can any one help…
Sarith Nob
  • 337
  • 2
  • 13
2
votes
2 answers

Absolute UriSource of a Resource image

I have a WPF project. If I store image in {ProjectRoot}\Images\image.png, and compile it as Resource then I can access it from a xaml (this xaml is located at Root) as BitmapImage by BitmapImage UriSource="Images/image.png". But if I move the xaml…
Louis Rhys
  • 34,517
  • 56
  • 153
  • 221
2
votes
2 answers

In HTTP, is a query allowed when only giving a path as Request-URI?

I am having a problem implementing a simple web server. According to the spec, a HTTP/1.1 request starts with this line: Request-Line = Method SP Request-URI SP HTTP-Version CRLF In this line, there is a Request-URI which is defined as…
flyx
  • 35,506
  • 7
  • 89
  • 126
2
votes
0 answers

How to use URN URI

I know the difference between URI, URL and URN I know that URN is a URI that identifies a ressource by name in particular namespace my question is : How to use URN URI's and when ? for exple this URN : urn:isbn:9780141036144 , how can i access to…
Fakh Ri
  • 140
  • 2
  • 8
2
votes
2 answers

ansible uri equivalent of curl command

curl 'http://admin:admin@127.0.0.1:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary…
testuser
  • 29
  • 1
  • 4
2
votes
1 answer

Ruby URI cannot handle link-local IPv6 addresses with explicitly specified outgoing interface?

I'm trying to get done some RESTful stuff with Ruby std. libraries, 'uri' and 'net/https.' I'd like to reach link-local IPv6 address with explicitly specified outgoing interface, for example fe80::cba7:32b1:741d:5c41%ens192. Whent I'm trying to…
Stepan Vrany
  • 1,026
  • 9
  • 14
2
votes
3 answers

How can I pass a long array through to another page?

I have a form for uploading an excel file, and a method that parses said file using Roo. What I want to happen is this: user uploads excel file, and is redirected to a page that lists the first ten lines of the file. I can get the first ten lines,…
Jeff Caros
  • 919
  • 5
  • 12
  • 32
2
votes
0 answers

save android device current ringtone into storage

I wanted to know if there is any way that I could save my device's current ringtone programmatically. I'm getting my current ringtone like below: Uri defaultRintoneUri = RingtoneManager.getActualDefaultRingtoneUri( getApplicationContext(),…
Majid
  • 201
  • 2
  • 14
2
votes
1 answer

How to get file URI when opening file with intent.action.VIEW?

User click on .txt file in file explorer and get dialog "Open with..." and there is listed my app. When I try to open file I want to get its absolute path. All I get is content:// URI I/ActivityManager: START u0 {act=android.intent.action.VIEW…
Personal Jesus
  • 133
  • 2
  • 10
2
votes
2 answers

PreAuthorize("isAuthenticated()") not working on RestController

I found many similar questions but none has solved my problem my problem is: PreAuthorize("isAuthenticated()") not working on my RestController. my configuration security is:
HJK
  • 39
  • 1
  • 1
  • 5
2
votes
2 answers

Sitecore: Value cannot be null. Parameter name: uri

Exception: System.ArgumentNullException Message: Value cannot be null. Parameter name: uri Source: Sitecore.Kernel I was editing a placeholder item in a local Sitecore 8.1 (rev. 151207) instance when I got this error. Now I can't edit, delete, or…
Squish
  • 43
  • 1
  • 4
2
votes
1 answer

Spring UriComponents thread safety

I've gone through as much of the source code as I can bear for UriComponents and it appears to be thread-safe but was hoping that someone else can confirm this. Essentially, I am creating a single instance of UriComponents using…
user1491636
  • 2,355
  • 11
  • 44
  • 71
2
votes
1 answer

Is there an overview to see which UriComponents returns what for an Uri?

Since msdn only provides a partial overview (as seen here) and i was looking for a complete sample i'll share the answer here.
Dbl
  • 5,634
  • 3
  • 41
  • 66
2
votes
1 answer

Maven-version-plugin, ruleset, rule & ignoreVersions tags

I am trying to use maven-version-plugin to automatically update all my dependencies. Nevertheless, I don't want alpha or beta versions. Thus, I have created a "rule file" to exclude these versions. Here it is:
Abrikot
  • 965
  • 1
  • 9
  • 21
2
votes
0 answers

IPad not supporting target ="_self"

I am trying to use Skype for business URIs to open on an IPad from safari browser. But whenever I click on link its not showing popup for opening Skype for business app. It's working fine for chrome and other browsers on IPad, but not for safari.…
user5005797
1 2 3
99
100