|
|||||
|
||||||
Related Syntax | Other Library Functions |
function |
HttpResponseOutput |
Library: Net, HTTP support (OMHTTP)
Include: omhttp.xin |
define function HttpResponseOutput modifiable stream Response
Argument definitions
Use HttpResponseOutput to format the contents of a response object as a valid HTTP-formatted message and write it to the current output.
You must include the following line at the beginning of your OmniMark program:
include "omhttp.xin"
This function is generally located in a server program and is used by the HttpConnectionSendResponse
function.
include "omtcp.xin" include "omhttpsv.xin" define function ReturnHttpResponse (value TCPConnection connection, read-only stream response-body) as ; local variables local HttpResponse response local stream write-to-client ; set the message body open response{'entity-body'} as buffer using output as response{'entity-body'} do output '<html><head><title>HttpResponseOutput Example</title></head><body>' output response-body output '</body></html>' done close response{'entity-body'} ; send response over the provided TCP connection open write-to-client as TCPConnectionGetOutput connection timeout 10000 using output as write-to-client HttpResponseOutput Response close write-to-client