sunlabs.brazil.template
Class AddHeaderTemplate

java.lang.Object
  extended by sunlabs.brazil.template.Template
      extended by 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,


Field Summary
 
Fields inherited from class sunlabs.brazil.template.Template
debug
 
Constructor Summary
AddHeaderTemplate()
           
 
Method Summary
 void tag_addheader(RewriteContext hr)
          Process the special addheader tag.
 
Methods inherited from class sunlabs.brazil.template.Template
done, init
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddHeaderTemplate

public AddHeaderTemplate()
Method Detail

tag_addheader

public void tag_addheader(RewriteContext hr)
Process the special addheader tag.


Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.