Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
URI IS 373—Web Standards Todd Will 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 CIS 373---Web Standards-URI 2 of 17 URI – A Uniform Resource Identifier (URI) is a compact string of characters for identifying an abstract or physical resource. CIS 373---Web Standards-URI 3 of 17 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 CIS 373---Web Standards-URI 4 of 17 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. CIS 373---Web Standards-URI 5 of 17 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. CIS 373---Web Standards-URI 6 of 17 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. CIS 373---Web Standards-URI 7 of 17 URI Format • <scheme>://<authority><path>?<query> • Examples: – http://is.njit.edu/ – ftp://afs2.njit.edu – mailto:[email protected]?subject=hi%20there CIS 373---Web Standards-URI 8 of 17 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. CIS 373---Web Standards-URI 9 of 17 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 CIS 373---Web Standards-URI 10 of 17 URL Management • Information Architecture – – – – Simple as possible Predictable/Logical Descriptive Uniform • For larger organization’s sites maintaining discipline can be difficult CIS 373---Web Standards-URI 11 of 17 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 CIS 373---Web Standards-URI 12 of 17 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> CIS 373---Web Standards-URI 13 of 17 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 CIS 373---Web Standards-URI 14 of 17 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 CIS 373---Web Standards-URI 15 of 17 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 CIS 373---Web Standards-URI 16 of 17 For Next Week • Papers and presentation printouts due next week • First set of presentations next week • Questions or problems with papers CIS 373---Web Standards-URI 17 of 17