swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Topics   Other Library Functions  
function  

HttpResponseOutput

 
 

Library: HTTP support (OMHTTP)
Include: omhttp.xin

Declaration

define function HttpResponseOutput
     modifiable stream Response

Argument definitions

Response
is the HTTP response to be sent.


Purpose

Use HttpResponseOutput to format the contents of a response object as a valid HTTP-formatted message and write it to the current output.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omhttp.xin"

Usage Notes

This function is generally located in a server program and is used by the HttpConnectionSendResponse function.

Example


  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

    Related Topics
 
Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.