Interface DocStream
access this type via: ws.DocStream (provides, requires or uses)
Interface to write HTTP response data to a client request, including setting session cookie state.
Functions
DocStream(storeTCPSocket s, storeHeader headers[], storeHeader responseHeaders[])
Header[] getRequestHeaders()
void setSessionKey(char key[], char value[])
char[] getSessionKey(char key[])
void remSessionKey(char key[])
void write(char str[])
void writeStatus(int code, char reason[], Header headers[])
void endStream()
DocStream(storeTCPSocket s, storeHeader headers[], storeHeader responseHeaders[])
Construct a new doc stream. This is done automatically by a web framework.
Header[] getRequestHeaders()
Get the list of request headers send by the client.
void setSessionKey(char key[], char value[])
Set a piece of session state, identified by a given key, to equal a given value. This causes a cookie to be set, so that this session state is available on subsequent web requests. This function must be called before any use of write() or writeStatus().
char[] getSessionKey(char key[])
Get a piece of session state, identified by a given key, as previously set by setSessionKey.
returns: The value of the session state key, as previously set by setSessionKey, or null if no such key exists.
void remSessionKey(char key[])
Delete a piece of session state, identified by a given key. The deleted session state will no longer be available to subsequent web requests. This function must be called before any use of write() or writeStatus().
void write(char str[])
Send data to the connected client. By default, content is assumed to be text (HTML) and uses chunked encoding; other content types should be indicated by first using writeStatus().
void writeStatus(int code, char reason[], Header headers[])
Set status code of the request, set all headers (such as 'content-type' and 'content-length') and send them to the client. This function is only effective the first time that it is used per request.
void endStream()
Indicate that sending of response data is complete. This function is automatically called by the web framework and so does not need to be used by the web app. After this function has been called, no further data can be sent in response to this request.