sunlabs.brazil.template
Class AddHeaderTemplate
java.lang.Object
sunlabs.brazil.template.Template
sunlabs.brazil.template.AddHeaderTemplate (view source)
- All Implemented Interfaces:
- TemplateInterface
public class AddHeaderTemplate
- extends Template
Template class for adding arbitrary mime headers to a reply.
Add a header onto the response, removing the tag from the HTML.
<addheader name1=value1 name2=value2 ...>
where name
is the name of an HTTP header, and
value
is its value. If no value is provided, then
the header is removed. If multiple name/value pairs are provided,
they are processed in arbitrary order.
Special headers.
If a "location" header is added, the status code is automatically
set to "302". If the value doesn't start with "http://" or
"https://", then the
value is turned into an absolute URL
by prepending the the hostname (and the path from the document
root if the value doesn't start with '/'.
Removing location headers is ill-advised.
The special header status is used to set the status code.
If the attribute nocontent
is present, the http header
status is set to 204 no content. This causes the browser to
ignore the contents of the page.
If a last-modified
header is present and the value is an
integer, it is taken to be the time (in ms since the epoch), and
converted to the proper format.
The values are subject to ${...} substitutions.
Note: Setting invalid headers will lead to unpredictable results,
Fields inherited from class sunlabs.brazil.template.Template |
debug |
AddHeaderTemplate
public AddHeaderTemplate()
tag_addheader
public void tag_addheader(RewriteContext hr)
- Process the special
addheader
tag.