Class FetchTemplate

  extended by sunlabs.brazil.template.Template
      extended by sunlabs.brazil.sunlabs.FetchTemplate (view source)
All Implemented Interfaces:

public class FetchTemplate
extends Template

Template class for substituting html pages into an html page. This class is used by the TemplateHandler. This does not perform traditional server-side include processing, whose normal purpose is to include standard headers and footers. That functionality is provided instead by including the content into the template, and not the other way around.

This include incorporates entire pages from other sites, either directly as part of the page content, or into a property, for further processing.

NOTE: This version depends on the behavior of JDK1.4. It does not use the Brazil Request class, but the URL class instead. Thus it has advantages that it automatically follows some redirects, and can handle additional protocols, such as "https" and "ftp", but it does not cache connections, and the proxy may not be set of a per request basis. Attributes:

Absolute url to fetch, and insert here
Post data if any. If set, an http POST is issued. The post data is expected to be in www-url-encoded format. [DEPRECATED, use "method" and "body" instead]
The request method. If not set, GET is used, unless "body" is supplied, in which case POST is the default.
The message body, if any.
Text to insert if URL can't be obtained.
The name of the variable to put the result in. If this is specified, the content is not included in place.
The proxy:port to use as a proxy (if any). If specified, it overrides the proxy property, in request.props.
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: [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 header status will contain the http status line.
By default, redirects are followed (at least redirects to the same protocol). Setting "nofollow=true" disables following redirects.
If true, then all non point-to-point http headers are copied into the request. [Note, this is the opposite default from the IncludeTemplate(), but it retains better backward compatibility.
A white space delimited list of additional header names do be added to the set of HTTP headers accompanying the request. The header values are looked up in the request properties. Example:
     <set namespace=local name=X-extra value="header value">
     <set namespace=local name=cookie value="jsessionid=123">
     <fetch .... addheaders="X-extra cookie">
Would cause the following headers to be added to the request:
     X-extra: header value
     cookie: jsessionid=123
Headers whose values that are undefined, or the empty string are not set. [Note, this mechanism for adding headers in different from that used by the IncludeTemplate(), which is unfortunate]. do be added to the set of HTTP headers accompanying the request. The
If true, and the connection is HTTPs, the server hostname will be trusted even if the host implied by the URL doesn't match it's certificate.
Note: This used to be called the IncludeTemplate, but was renamed to avoid confusion with the other IncludeTemplate. This template will be deprecated when the IncludeTemplate completely sub-sumes this functionalitty.

Field Summary
Fields inherited from class sunlabs.brazil.template.Template
Constructor Summary
Method Summary
 void tag_fetch(RewriteContext hr)
          Alternate name so we can use both the Include and Fetch templates in the same page.
 void tag_include(RewriteContext hr)
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


public FetchTemplate()
Method Detail


public void tag_include(RewriteContext hr)


public void tag_fetch(RewriteContext hr)
Alternate name so we can use both the Include and Fetch templates in the same page.

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