sunlabs.brazil.sunlabs
Class FetchTemplate

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

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:

href
Absolute url to fetch, and insert here
post
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]
method
The request method. If not set, GET is used, unless "body" is supplied, in which case POST is the default.
body
The message body, if any.
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.
proxy
The proxy:port to use as a proxy (if any). If specified, it overrides the proxy property, in request.props.
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: [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.
nofollow
By default, redirects are followed (at least redirects to the same protocol). Setting "nofollow=true" disables following redirects.
addclientheaders
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.
addheaders
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
trustHost
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
debug
 
Constructor Summary
FetchTemplate()
           
 
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

FetchTemplate

public FetchTemplate()
Method Detail

tag_include

public void tag_include(RewriteContext hr)

tag_fetch

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.