@httpdContentType([MIME_TYPE], [RFC_2822_DATE])

Inserts "Content-Type" into HTTP header section and optionally makees page uncacheable.

The following parameters are recognized:

[MIME_TYPE]

The MIME type to associate with the content that will be returned by the server. If omitted, we will default to "text/html".

[RFC_2822_DATE]

If you want to mark the results as non-cacheable to the client's browser, you need to pass a RFC 2822 formatted date (if not you can omit this option). The following system command will generate the properly formatted string: RFC_2822_DATE="$(TZ=GMT /bin/date --rfc-2822)";.

Example of using the macro:

# Get date in RFC 2822 format
RFC_2822_DATE="$(TZ=GMT /bin/date --rfc-2822)";

# Send back HTTPD header making results non-cacheable

@bashCgiOutBegin()
@httpdContentType("text/plain","${RFC_2822_DATE}")

@bashCgiOutEnd()

# Send information
/bin/cat /proc/cpuinfo

Assuming the com.ccg.macros.at.All class is within your CLASSPATH and the config/html.at macros file has been generated (Hint: run make atmacros in the wui directory), a developer should be able to run the above example by copy/pasting from below:

[root@probe root]# java com.ccg.macros.at.All <<EOF
@include("config/html.at",,"d")

# Get date in RFC 2822 format
RFC_2822_DATE="$(TZ=GMT /bin/date --rfc-2822)";

# Send back HTTPD header making results non-cacheable

@bashCgiOutBegin()
@httpdContentType("text/plain","${RFC_2822_DATE}")

@bashCgiOutEnd()

# Send information
/bin/cat /proc/cpuinfo

EOF

This macro is defined as:

Content-Type: @fnb("@param(0)","text/html")@ifEqual("@param(1)","",,"
Date: @param(1)
Expires: @param(1)
Last-Modified: @param(1)
Cache-Control: no-cache, must-revalidate
Pragma: no-cache")