sunlabs.brazil.template
Class IncludeTemplate
java.lang.Object
sunlabs.brazil.template.Template
sunlabs.brazil.template.IncludeTemplate (view source)
- All Implemented Interfaces:
- TemplateInterface
public class IncludeTemplate
- extends Template
Convert the html tag "include" in to text for an included
html page.
Attributes processed
- href
- Absolute url to fetch, and insert here
- method
- The request method. Defaults to GET (or POST if a message
body is supplied.
- body
- Message body, if any. If "method", is not set, an http
POST is issued.
- type
- Content type of message body. If not specfied, it is
taken from the request headers.
- alt
- Text to insert if URL can't be obtained.
- name
- The name of the variable to put the result in.
If this is specified, the content is not included in place.
The template prefix is automatically prepended to the name.
- proxy
- The proxy:port to use as a proxy (if any).
If specified, it overrides the
proxy
property,
in request.props
.
- addheaders
- A white space delimited set of token names that
represent additional http headers to add to the target request.
For each token, the values [token].name and
[token].value in the
request.props
are used for the header name and value
respectively.
- showheaders
- If true, all http headers to and from the target
will be displayed on stderr.
- noClientHeaders
- If true no client http headers are used in this
request (see note below).
- encoding
- The character encoding to use if it can't be
automatically determined. Defaults to the default platform encoding.
- getheaders
- The name of the variable prefix to use to
extract the http response headers.
If this not specified, no response headers are retrieved.
The result will be properties of the form:
[prefix].[getheaders].[header_name]=[header_value]
.
If multiple entries exist for a particular header name, the values
are combined as per HTTP conventions (e.g. v1, v2, ... vn).
The pseudo headers status
and encoding
will contain the http status line and charset encoding, respectively.
- error
- If name is specified and the result
could not be obtained, the error message is placed here.
- queryList
- A list of property names whose names and values
will be added to the url as query parameters. The values are properly
url-encoded.
Example: <include href=http://www.foo.com/index.html>
NOTE:
There are two common scenarios for using this template.
in the first, an http resource is retrieved on behalf of the client
browser: this template functions as a "proxy" for that resource.
In the second scenario, the resource is retrieved as a side-effect
of the initial browser request, such as to retrieve additional
information to incorporate into the page. In this scenario, it is
important to set noClientHeaders
or bad things
can happen when the http headers from the client become inconsistent
with the request to the resource being retrieved.
Fields inherited from class sunlabs.brazil.template.Template |
debug |
IncludeTemplate
public IncludeTemplate()
tag_include
public void tag_include(RewriteContext hr)
comment
public void comment(RewriteContext hr)
- Treat comments of the form:
<!#include ...>
as if they were include tags.