Libraries anvil net Response

class Response
extends anvil.lang.object
The HTTP response to the client terminal/browser.

Methods

void addCookie(Cookie cookie)
ADds the specified cookie to response. It can be calle multiple times to set more than one cookie.

string encode(string url)
Encodes and returns HttpSession parameters to given url.
Parameters url - 
Returns encoded url

void flush()
Flushes any pending data to client, including status code and headers
Throws IOError -  If an IO error occurs

OutputStream getOutputStream()
Returns the output stream suitable for writing data to the response.
Throws IOError -  If an IO error occurs

void sendError(int code)
void sendError(int code, string message)
Sends an errors response to client using specified status code and message. After this method is called response is considered committed and should be written to.
Parameters code -  HTTP error response code
message -  Optional message, if not given, default messages are used.
Throws IOError -  If an IO error occurs

void sendRedirect(string url)
Creates temporary redirection (302) to given url.
Throws IOError -  If an IO error occurs

void setContentLength(int contentLength)
Sets the content length.
Parameters contentLength -  Length of content

void setContentType(string contentType)
Sets the content type.
Parameters contentType -  Mime type of content

void setHeader(string name, string stringvalue)
void setHeader(string name, int intvalue)
Sets the value of given response header.
Parameters name -  name
stringvalue -  string value
intvalue -  int value value

void setStatus(int code)
Sets the status of response when there is not error.
Parameters code -  HTTP response code