$Web Type: Difference between revisions
Jump to navigation
Jump to search
m 1 revision |
Automatically generated page update |
||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Web_Type}} | {{DISPLAYTITLE:$Web_Type}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Set response content type</span> | ||
<var>$Web_Type</var> sets the content type for the response. | <var>$Web_Type</var> sets the content type for the response. | ||
| Line 7: | Line 7: | ||
==Syntax== | ==Syntax== | ||
<p class="syntax" | <p class="syntax"><span class="term">%rc</span> = $Web_Type( type ) | ||
</p> | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
Revision as of 18:18, 10 April 2013
Set response content type
$Web_Type sets the content type for the response.
$Web_Type is a callable $function, and it takes a single required string argument and returns a status code.
Syntax
%rc = $Web_Type( type )
| type | The content type indicator. It must be non-null. Janus Web Server makes no assumptions about what a valid type is, and it will set content type to any user-specified string. The HTTP specification (browsable at http://www.w3.org) states that content type should be case insensitive. |
|---|
Status codes
| Code | Meaning |
|---|---|
| 0 | Content type set |
| -1 | Invalid call, not a Web thread |
| -4 | Missing argument |
Examples
Sample code follows:
%x = $Web_Type('image/gif')
The above line sets the content type to CompuServe GIF format (a binary image).
Note: You can also set the content type for all output presented in response to a given URL or pattern, if it is not already set, by using the TYPE subcommand of the JANUS WEB command. In this case, a $Web_Type call would not be needed unless the type was being changed from that default.