back to mod_wxjs 

HttpResponse

generated from ../src/mod_wxjs/httpresp.cpp

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

Constants

Properties

Name Type Description
contentType String The content type
encoding String The character encoding. The default encoding is UTF-16.
headers read only Object An object with all output headers. Make sure that you set all headers and cookies before you write any output!
headersSent read only Boolean Returns true when HTTP headers are already sent to the client
status Integer The HTTP status
statusLine String The status line

Methods

createCookie

createCookie(Name, 
             Value) : Cookie
 
Name Type Default Description
Name String The name of the cookie
Value String The value of the cookie

Creates a new Cookie object. Note that this method doesn't put the cookie into the output headers. The example shows how to use the 'Set-Cookie' header:


    var newCookie = response.createCookie('loggedin', 'yes');
    response.headers['Set-Cookie'] = newCookie.toString();
   

print

print()
 

Use this function to print information to the output. This output is send to the client. You can pass as many arguments as you wish. An example:


    var i = 1;
    response.print("<b>Test: ", i, "</b>");
   
Make sure that you set all headers and cookies before you write any output!

write

write(Buffer)
 
Name Type Default Description
Buffer Buffer A buffer to write to the client

Use this function to write a buffer to a client (you can use this to write an image for example).

Make sure that you set all headers and cookies before you write any output!




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