Water 5-System Interfaces-HTTP
class request_or_response.uri
Contract
Parameter keyDefault valueType
obj""string
user_infoopt
hostopt
port80integer
protocoloptstring
pathnulltype.<one_of string thing/>
queryopttype.<one_of string thing/>
auth_type"Basic"string
usernameopt
passwordopt
fragmentnull
nameopt
headeropt
protocol_version1.0double
content_typeopt
method"get"type.<one_of "get" "post" "put" "options" "delete" "head"/>
use_cachesfalseboolean
path_string""string
bodyopt
extension""string
ofofinstances
body_string""string
Water Contract
<class request_or_response.uri
  obj           =""
  user_info     =opt
  host          =opt
  port          =80=number.integer
  protocol      =opt=string
  path          =null=<type.one_of string thing/>
  query         =opt=<type.one_of string thing/>
  auth_type     ="Basic"
  username      =opt
  password      =opt
  fragment      =null
  name          =opt
  header        =opt
  protocol_version=1.0
  content_type  =opt
  method        ="get"=<type.one_of "get" "post" "put" "options" "delete" "head"/>
  use_caches    =false
  path_string   =""
  body          =opt
  extension     =""
  of            =<instances system=<request_or_response.uri host="system" protocol="logical" name="system" physical_uri=<request_or_response.uri host="" protocol="file" path=<vector "" "Users" "mseelig" "Documents" "workspace" "steam_working"/> path_string="/Users/mseelig/Documents/workspace/steam_working"/>/> water_test=<request_or_response.uri host="water_test" protocol="logical" name="water_test" physical_uri=<request_or_response.uri path=<vector "" "Users" "mseelig" "Documents" "workspace" "steam_working" "test"/> path_string="/Users/mseelig/Documents/workspace/steam_working/test"/>/> user=<request_or_response.uri host="user" protocol="logical" name="user" physical_uri=<request_or_response.uri host="" protocol="file" path=<vector "" "Users" "mseelig" "water_user_folder"/> path_string="/Users/mseelig/water_user_folder"/>/> water_runtime=<request_or_response.uri host="water_runtime" protocol="logical" name="water_runtime" physical_uri=<request_or_response.uri host="" protocol="file" path=<vector "" "Users" "mseelig" "Documents" "workspace" "steam_working"/> path_string="/Users/mseelig/Documents/workspace/steam_working"/>/> _name="of" water_ide=<request_or_response.uri host="water_ide" protocol="logical" name="water_ide" physical_uri=<request_or_response.uri host="" protocol="file" path=<vector "" "Users" "mseelig" "Documents" "workspace" "steam_working"/> path_string="/Users/mseelig/Documents/workspace/steam_working"/>/> product=<request_or_response.uri host="product" protocol="logical" name="product" physical_uri=<request_or_response.uri host="" protocol="file" path=<vector "" "Users" "mseelig" "Documents" "workspace" "steam_working"/> path_string="/Users/mseelig/Documents/workspace/steam_working"/>/> water_reference_doc=<request_or_response.uri host="water_reference_doc" protocol="logical" name="water_reference_doc" physical_uri=<request_or_response.uri path=<vector "" "Users" "mseelig" "Documents" "workspace" "steam_working" "doc"/> path_string="/Users/mseelig/Documents/workspace/steam_working/doc"/>/>/>
  body_string   =""
/>
A Water URI supports the URI specification from the W3C. A URI is a uniform resource identifier and is used for identifying resources on the Web. A URI can be created in many different ways: Parts of a URI encoded in a URI string:
<uri "http://www.clearmethods.com:8080/prod/buy?item=10"/>.<to_uri/>
"http://www.clearmethods.com:8080/prod/buy?item=10"
Parts of a URI specified as separate fields:
<uri port=8080 host="www.clearmethods.com" protocol="http"
      query=<thing item=10/> path=<vector "" "prod" "buy"/>
 />.<to_uri/>
"http://www.clearmethods.com:8080/prod/buy?item=10"
Example of combining two URIs together:
<uri "http://www.clearmethods.com"/>.<uri "foo/bar"/>.<to_uri/>
"http://www.clearmethods.com/foo/bar"
A Water URI can have additional information such as the HTTP method (GET, POST, etc.), HTTP header values, and body content.
<uri "http://www.clearmethods.com"
      method="post" 
      header=<thing Accept="*/*"/>
      content_type="application/x-www-form-urlencoded"
      body=<thing item=10/>
 />
<thing host="www.clearmethods.com" protocol="http" path=<vector/> header=<thing Accept="*/*"/> content_type="application/x-www-form-urlencoded" method="post" path_string="" body=<thing item=10/> body_string="item=10"/>.<set _encoded_set_key_parent=uri/> 
You can create relative URIs that do not have a protocol or host:
<uri "foo/bar"/>.<to_uri/>"foo/bar"
URIs are intended to be read-only (immutable) data structures. Once you create them, you should not modify them, but you can create new URIs from existing URIs.
wob.<set a_uri=
  <uri "http://merlin:password@nitric.com:80/internal/foo?bar=2&baz=3#someplace"/>
 />
a_uri.protocol"http"
a_uri.user_info"merlin:password"
a_uri.host"nitric.com"
a_uri.port80
a_uri.path
<vector "" "internal" "foo"/>
a_uri.path_string"/internal/foo"
a_uri.query_string"bar=2&amp;baz=3"
a_uri.query
<thing bar=2 baz=3/>
a_uri.fragment"someplace"
<uri "foo/bar?a=2&b=3"/>.query_string
"b=3&amp;a=2"
<uri "foo/bar?a=2&b=xxx"/>.query
<thing a=2 b="xxx"/>
<uri "foo/bar?"/>.query_string
""
<uri "foo/bar?"/>.query
<thing/>
<uri "foo/bar"/>.query_string""
<uri "foo/bar"/>.queryopt
In file protocols user_info, host, port, and query are all irrelevant. user_info, host and query are the empty string. Port is ignored. Note that the "file" protocol is used for folders as well, though Water does have both file and folder resource objects.