Request data handling

web::request

web::request ?options? ?key? ?value?

web::request ?key? ?default?

Options are: -count, -set, -lappend, -names, -unset, -reset and -channel

web::request is an accessor to request specific information: either CGI related (stand alone Websh) or Apache related (mod_websh).

web::request
returns a list of all known keys.
web::request key ?default?
returns the value for key. Can be a list. In case that key does not exist, return default, if it is given, or an empty string.
web::request -count key
returns number of items in list for key; returns 0 if key does not exist.
web::request -set key
does the same as web::request key.
web::request -set key value ?value? ?...?
adds the parameter key to the web::request data. Any existing parameters with key are overwritten.
web::request -lappend key value ?value? ?...?
append parameters with the same key to the web::request data. In this case the existing value is not overwritten.
web::request -unset
deletes all parameters from the web::request data.
web::request -unset key
deletes a parameter from the web::request data.
web::request -reset
deletes all parameters from the web::request data (like 'web::request -unset'), removes all static parameters (like 'web::cmdurlcfg -unset'), all form variables (like 'web::formvar -unset'), all query string parameters (like 'web::param -unset'), and all temporary files created by HTTP form upload.
web::request -channel
returns the preset default channel for the current request. (Note that this is not necessarily the currently selected channel.)

web::param

web::param ?options? ?key? ?value? ?...?

Options are: -count, -set, -lappend, -names, and -unset

web::param is an accessor to state information from the querystring. Suppose the querystring is "lang=EN". After web::dispatch has parsed the querystring, web::param lang will report EN. Additionaly, web::param can manage this data and add, append, and delete parameters as needed.

web::param -names
returns a list of all known keys.
web::param key ?default?
returns the value for key. Can be a list. In case that key does not exist, return default, if it is given, or an empty string.
web::param -count key
returns number of items in list of key.
web::param -set key
does the same as 'web::param key'.
web::param -set key value ?value? ?...?
add the parameter key to the web::param data. Any existing parameters with key are overwritten.
web::param -lappend key value ?value? ?...?
append parameters with the same key to the web::param data. In this case the existing value is not overwritten.
web::param -unset
deletes all parameters from the web::param data.
web::param -unset key
delete a parameter from the web::param data.

web::formvar

web::formvar ?options? ?key? ?value?

Exactly like web::param.

web::formvar is an accessor to HTML FORM data. After web::dispatch has parsed the POST data, you can access all form fields using web::formvar.

Example 6. web::param

	  % web::request CONTENT_LENGTH
	  % web::dispatch -querystring "cmd=default&t=100" -postdata "" -cmd ""
	  % web::param -names
	  t cmd
	  % web::param cmd
	  default
	  % web::param -set k v
	  v
	  % web::param -names
	  t cmd k
	  %