back to mod_wxjs 

HttpRequest

generated from ../src/mod_wxjs/httpreq.cpp

The HTTP request. There is only one instance of this class and it's automatically instantiated: 'request'.

Constants

Properties

Name Type Description
URI read only String The path portion of the URI
args read only String The QUERY_ARGS extracted from this request
cookies read only String array An array with cookies
filename read only String The name of the requested file
files read only Array Array with UploadFile objects
get read only Object A table with all get values
headers read only Object A table with all input headers
hostname read only String The hostname
method read only String Request method (GET, POST, HEAD, ...)
methodNumber read only Integer Request method number(M_GET, M_POST, ...)
pathInfo read only String The PATH_INFO extracted from this request
post read only Object A table with all posted values
protocol read only String The protocol of the request
remoteIP read only String Client's IP Address
time read only Date Time when the request started
time read only Date Time when the request started
time read only Date Time when the request started
unparsedURI read only String The URI without any parsing performed
user read only Object An object that has the following properties: scheme, hostinfo, user, password, hostname, port, path, query and fragment.
user read only String If an authentication check was made, this gets set to the user name.

Methods

getCookie

getCookie(Name) : Cookie
 
Name Type Default Description
Name String The name of the cookie

Returns a cookie object. The following example shows how to read all cookies.


    for(c in request.cookies)
    {
      cookie = request.getCookie(c);
    }
   

uploadFile

uploadFile(element, 
           file, 
           maxLength = -1, 
           override = false) : boolean
 
Name Type Default Description
element String The name of the upload element
file String The name of the file on the server
maxLength Integer -1 The max. length of the file
override Boolean false Override the existing file?

Use this method to upload a file. When you want to limit the size of the file, use the maxLength argument (-1 means don't check). When the maxLength argument is omitted, there is no check on the contentlength. Make sure mod_wxjs has write permissions! The example shows how to upload all files:


    for(f in request.files)
    {
      request.uploadFile(f, "c:\\temp\\" + request.files[f].filename, -1, true);
    }
   




Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.