Release 10.1A: OpenEdge Application Server:
Developing WebSpeed Applications

> ## output-content-type

> This function sets and outputs the HTTP Content-Type header with the specified value followed by a blank line. If this function is called more than once per Web request, no output is generated after the first call. The function returns `TRUE` if a header was output and returns `FALSE` otherwise.

> Location: `web\method\cgiutils.i`

> Parameters:

> `INPUT p_type AS CHARACTER`

> The MIME content type. If the input value is blank, then no Content-Type header is output.

> Returns: LOGICAL

> Notes:

> - A Content-type header is mandatory for any content sent to the Web output stream. Otherwise, the Web server will probably return an error to the browser. The Web object templates already execute this function with a default Content-type of `text\html`.

> - Since this function outputs a blank line, it must be executed after `output-http-header`, `set-cookie`, `delete-cookie`, or other HTTP headers.

> Examples:

> Outputs the text\plain MIME type with a charset modifier followed by the name of the browser. The tilde character (`~`) is used to escape the semi-colon to ensure that the semicolon is taken literally, as shown:

>     output-content-type("text\plain~; charset=iso-8859-1":U).
>     {&OUT}
>     'Your web browser is ' HTTP_USER_AGENT SKIP
>     {&END}

> If the Web server supports Server Side Includes (SSI) and is configured to utilize it, the MIME type `application\x-server-parsed-html` can be used to have the WebSpeed output further parsed by the Web server before being sent to the Web browser, as shown:

>     output-content-type("application\x-server-parsed-html":U).
>     {&OUT}
>     '<!--#include virtual="\header.html" -->' SKIP
>     . . .
>     '<!--#include virtual="\footer.html" -->' SKIP
>     {&END}

> ##### See also:

> output-http-header

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095