Water 5-System Interfaces-HTTP
class resource
Contract
Parameter keyDefault valueType
a_uriopt
contractopt
typeopt
a_responsenull
http_messageopt
base_protocolfalseboolean
nameopt
protocol_name"file"string
ofofinstances
Parameter kindDefault valueType
Other keyed argumentsopt
Water Contract
<class resource
  a_uri         =opt
  contract      =opt
  type          =opt
  a_response    =null
  http_message  =opt
  base_protocol =false=boolean
  name          =opt
  protocol_name ="file"
  of            =<instances _name="of"/>
  _part_name_key="name"
  _other_keyed  =opt=wob="_add_to_environment"
/>
A resource is a web resource that is similar in concept to a file resource. It represents a connection and/or permission to access a remote web resource. If a file resource requires a path to a file, the web resource requires a URI to identify the location of the resource.
<resource "http://localhost:9090"/>
To request the value of the resource as a string, get content .
<server root=<H1>Water</H1> port=9090/>
<resource "http://localhost:9090"/>.content
"<h1>Water</h1>"
The following example creates a simple server to serve out the number 42, and uses a 'resource' to get the result as a number using execute . execute will first get the contents as a string, then execute the string to return a Water object.
<server root=42 port=9090/>
<resource "http://localhost:9090/"/>.<execute/>
42
The following web resource represents a method:
<server <method get_quote arg=req> arg </> port=9090/>
thing.<set remote_get_quote=<resource "http://localhost:9090/"/> />
Calling a remote web resource with arguments has exactly the same structure as calling a local method.
thing.<remote_get_quote arg=100/>
100
Defining a web resource takes an optional contract. The contract is either a class or method . The contract is used to type-check the arguments before making a remote request.
<method get_quote arg=req=string> arg </>
<server get_quote port=9090/>
thing.<set remote_get_quote=
     <resource "http://localhost:9090/" contract=get_quote/> 
/>
thing.<remote_get_quote arg=6/>
error