590 likes | 1.47k Views
URI -URL-URN. What’s in a name?. What is a URI/URL/URN? Why are they important? What strategies can be used to manage them? Information Architecture Content Negotiation. URI.
E N D
What’s in a name? • What is a URI/URL/URN? • Why are they important? • What strategies can be used to manage them? • Information Architecture • Content Negotiation
URI • A Uniform Resource Identifier (URI) is a compact string of characters for identifying an abstract or physical resource.
Uniform • Uniformity: • Allows different types of resources to be referenced in the same context • Allows new types of resources to be added in the future • Allows identifiers to be reused in many different contexts
Resource • A resource can be anything that has identity, e.g. • Documents • Images • Services, e.g. weather, authentication • People • Books • Conceptual mapping to an entity or set of entities, not necessarily the entity which corresponds to that mapping at any particular instance in time.
Identifier • An identifier is an object that can act as a reference to something that has identity. In the case of URI, the object is a sequence of characters with a restricted syntax.
URI vs URN vs URL • A URI can be further classified as a locator, a name, or both. • "Uniform Resource Locator" (URL)refers to the subset of URI that identify resources via a representation of their primary access mechanism (e.g., their network "location"), rather than identifying the resource by name or by some other attribute(s) of that resource. • "Uniform Resource Name" (URN) refers to the subset of URI that are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable.
URI Format • <scheme>://<authority><path>?<query> • Examples: • http://is.njit.edu/ • ftp://afs2.njit.edu • mailto:txw5999@njit.edu?subject=hi%20there
Cool URI’s Don’t Change • When you change a URI on your server, you can never completely tell who will have links to the old URI. • When someone follows a link and it breaks, they generally lose confidence in the owner of the server. They also are frustrated - emotionally and practically from accomplishing their goal.
URL Usability • Which is better? http://is.njit.edu/index.php?s=courses&c=undergrad&id=144 http://is.njit.edu/courses/undergrad/cis373 http://is.njit.edu/undergrad/cis373 http://is.njit.edu/courses/cis373 http://is.njit.edu/cis373 • Good URL’s can be guessed • Implication: • Creating a URL is like having a baby, you are creating something for which you will be responsible for a long time
URL Management • Information Architecture • Simple as possible • Predictable/Logical • Descriptive • Uniform • For larger organization’s sites maintaining discipline can be difficult
Content Negotiation • Can accomplish two things: • Associate multiple URI’s with the same resource • e.g. different links to CIS 373 in previous slide • Serve different versions of a given resource depending on the client • e.g. serve a different version of a page depending on the browser
mod_rewrite example • Sample contents of file .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RedirectMatch ^/turoff http://web.njit.edu/~turoff RedirectMatch ^/hiltz http://web.njit.edu/~hiltz RedirectMatch ^/bieber http://web.njit.edu/~bieber RewriteRule ^(.+) - [PT,L] RewriteRule ^(.*) index.php </IfModule>
ISAPI_Rewrite • Provides functionality similar to mod_rewrite • 3rd party software that works with IIS since IIS doesn’t have a built-in mechanism for handling URL schemes
What not to put in your URI • Authors name – people can quit, be hired, change authorship • Subject. Tricky to use, but better • Status- Don’t use old, new, draft – keep the most recent document at the same url and archive the older versions • Access. If the level of access to the document changes, then make sure that the url will not break • Use the same name for the document and the url • File name extension. Even html file extension can change if you rewrite your pages in asp or java • Software mechanisms. Don’t put the software you are using in the url – the software can change over time • Disk name – Big no, no
URL and URN • URL : Uniform Resource Locator • “My copy of the book is on the lightstand in my bedroom.” • scheme://authority/path?query • URN : Uniform Resource Name • “I read a neat book;it’s called Pragmatic Programmer.”
URN Syntax • urn:nid:nss • nid = Namespace Id • nss = Namespace Specific String • Examples • urn:ietf:rfc:3187 • urn:isbn:0451450523
URL resource content URN URC URN Resolution URN Converter Web Server
URN Properties • Global scope • Global uniqueness • Persistence • Scalability • Legacy support • Extensibility • Independence
DOI • Digital Object Identifier • Name for an entity on digital networks • doi:naming_authority/identifier • Almost the same role with the URN
DOI and URN • DOI • Managed by International DOI Foundation (IDF) • Fulfills all the functional requirements of URN, but not registered as a formal URN • Internet draft : A spec for DOI as a URI • URN • IETF Standard: RFC • Universal Contents Identifier (UCI):based on URN, 2003 NCA(한국전산원)
Conclusion • URI’s are an important building block of the Internet • It’s important to recognize them for what they can do for your web based applications. • Remember uri’s should be consistent and not change over time