{"id":11,"date":"2011-08-24T12:35:21","date_gmt":"2011-08-24T12:35:21","guid":{"rendered":"http:\/\/www.w3.org\/community\/native-web-apps\/?p=11"},"modified":"2011-10-09T19:37:53","modified_gmt":"2011-10-09T19:37:53","slug":"dereferencing-widgets","status":"publish","type":"post","link":"https:\/\/www.w3.org\/community\/native-web-apps\/2011\/08\/24\/dereferencing-widgets\/","title":{"rendered":"Dereferencing widgets:\/\/"},"content":{"rendered":"<p>So, somewhat ignoring the fact that we were going to plot and scheme about what Installable Web Apps could be&#8230; and Web APIs&#8230;\u00a0I&#8217;ve had a first crack at making widget:\/\/ behave more like a HTTP request. This should solve a bunch of problems, including allowing widgets to work with inner package XHR (YaY! <a href=\"http:\/\/jquerymobile.com\/\" target=\"_blank\" rel=\"nofollow\">jquery mobile<\/a>\u00a0FTW!).<\/p>\n<p>From the updated <a title=\"Widget URI\" href=\"http:\/\/dev.w3.org\/2006\/waf\/widgets-uri\/\" target=\"_blank\" rel=\"nofollow\">Widget URI Spec<\/a> (I rewrote most of it!):<\/p>\n<blockquote><p>This section describes how a user agent is supposed to respond requests to retrive resources from a widget URI. The purpose is to make responses &#8220;look and feel&#8221; as much as possible like regular HTTP requests.<\/p>\n<p>To dereference a widget <a>URI<\/a> to a file in a widget package a <a>user agent <\/a>MUST apply the rules for dereferencing a widget URI.<\/p>\n<p>The rules for dereferencing a widget URI are as follows:<\/p>\n<ol>\n<li>If the request is not a GET request, return a 501 Not Implemented response and terminate this algorithm.<\/li>\n<li>If the <em> URI<\/em> uses the scheme &#8216;widget&#8217;, but is not a valid <a>widget URI<\/a>, return a 400 Bad Request response and terminate this algorithm.<\/li>\n<li>If the <em> URI<\/em> uses the scheme &#8216;widget&#8217;, but the authority does not match the one assigned to this package, return a 403 Not Allowed response and terminate this algorithm (i.e., prevent inter-widget content access).<\/li>\n<li>If the user agent implements [[!Widgets]] (for the purpose of internationalization):\n<ol>\n<li>Let <var>potential-file<\/var> be the result of running the <a href=\"http:\/\/www.w3.org\/TR\/widgets\/#rule-for-finding-a-file-within-a-widget-package-0\">rule for finding a\u00a0file within a widget package<\/a> using the <var>path<\/var> component as its parameter.<\/li>\n<\/ol>\n<\/li>\n<li>Otherwise,\n<ol>\n<li>Let\u00a0<var>path<\/var>\u00a0be the path to the\u00a0file\u00a0being sought by the user agent.<\/li>\n<li>Let <var>potential-file<\/var> be the result of attempting locate the file at path<\/li>\n<\/ol>\n<\/li>\n<li>If <var>potential-file<\/var> is not found, return a 404 Not Found response.<\/li>\n<li>If retrieving <var>potential-file<\/var> results in a error (e.g., the file is corrupt), return a 500 Internal Server Error with an optional message describing the error in the response body.<\/li>\n<li>Let <var>content-type<\/var> be the result of applying <a href=\"http:\/\/www.w3.org\/TR\/widgets\/#rule-for-identifying-the-media-type-of-a-file\">the rule for identifying teh media type of a file<\/a> using <var>potential-file<\/var> as an argument.<\/li>\n<li>Ruturn a 200 OK response, with the value of content-type as the Content-Type header, and with <var>potential-file<\/var> as the response body.<\/li>\n<\/ol>\n<\/blockquote>\n<p>Boom! done \ud83d\ude42 Ok, not done&#8230; but it&#8217;s a good strawman. Let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, somewhat ignoring the fact that we were going to plot and scheme about what Installable Web Apps could be&#8230; and Web APIs&#8230;\u00a0I&#8217;ve had a first crack at making widget:\/\/ behave more like a HTTP request. This should solve a &hellip; <a href=\"https:\/\/www.w3.org\/community\/native-web-apps\/2011\/08\/24\/dereferencing-widgets\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":233,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"","footnotes":""},"categories":[1,6],"tags":[5],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-uncategorized","category-w3cwidgets","tag-w3c-widgets"],"_links":{"self":[{"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/users\/233"}],"replies":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":2,"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":59,"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/posts\/11\/revisions\/59"}],"wp:attachment":[{"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.w3.org\/community\/native-web-apps\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}