is `www.me.com/page.php` and `www.me.com/page.php?

2019-08-21 08:39发布

问题:

From the page http://msdn.microsoft.com/en-us/magazine/dd315413.aspx:

User agents interact with resources, and resources are anything that can be named and represented. Each resource can be addressed via a unique Uniform Resource Identifier (URI).

is www.me.com/page.php and www.me.com/page.php?1 and www.me.com/page.php?2 considered 3 unique URIs ?

I know they are interpreted as different urls. But are they unique in the sense according to the RESTful definition: each resource is accessed through a unique URI

回答1:

The answer is they are unique URLs, but different URLs could refer to the same entity:

This article might help: http://en.wikipedia.org/wiki/Uniform_Resource_Name

URL's are resource locators, there is nothing to say they must point at different "things", they usually do, but not always.

URN's are meant to be unique identifiers, but again, you could have two URNs pointing to the same book using different ID's



回答2:

yes. they are interpreted as different urls. you can have for example shop.php?product=1 and shop.php?product=2. Each url shows a different product.



回答3:

Yes, they are. The query string is part of the URI.



回答4:

"Each resource can be addressed via a unique Uniform Resource Identifier (URI)". This line clear said that all those are unique URI. Because for the first URI you are calling default resource. For the later two you are calling resource with specific id.