Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

nextapp.echoservlet
Class Template  view Template download Template.java

java.lang.Object
  extended bynextapp.echoservlet.Template
All Implemented Interfaces:
java.io.Serializable, Service

public class Template
extends java.lang.Object
implements Service, java.io.Serializable

A service which produces templated text output. Templates are used in cases where the server must render a mostly static document that contains text that may vary. This service is similar to StaticText, but offers the ability to have dynamically inserted text at specified points. A dynamic area is specified by adding a "variable name" to the template. Variables names are enclosed in dollar signs.

The following example document shows how a Template can be used:

In the year $Year$, annual sales were $$$AnnualSales$.

This sample has two variables, "Year" and "Annual Sales". The double dollar sign will be rendered as a single dollar sign. The variable data will be extracted from the renderer's VariableData object.


Field Summary
private  nextapp.echoservlet.util.ContentType contentType
           
private  java.lang.String[] fieldNames
           
private  Id id
           
private static java.lang.String MARKERSTRING
           
private  java.lang.String[] staticSections
           
 
Constructor Summary
Template(nextapp.echoservlet.util.ContentType contentType, java.lang.String templateData)
          Deprecated. The Template(String, ContentType, String) constructor should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.
Template(java.lang.String identifier, nextapp.echoservlet.util.ContentType contentType, java.lang.String templateData)
          Creates a content template from the given String.
 
Method Summary
static Template createFromResource(java.lang.String resourceName)
          Deprecated. The createFromResource(String, String) method should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.
static Template createFromResource(java.lang.String identifier, java.lang.String resourceName)
          Creates a Template object by way of a resource name.
 nextapp.echoservlet.util.ContentType getContentType()
          Returns the content type.
 Id getId()
          Returns a unique identifier for this service.
 void service(Connection conn)
          Services an HTTP request.
 java.lang.String toString()
          Renders the content template as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MARKERSTRING

private static final java.lang.String MARKERSTRING
See Also:
Constant Field Values

staticSections

private java.lang.String[] staticSections

fieldNames

private java.lang.String[] fieldNames

contentType

private nextapp.echoservlet.util.ContentType contentType

id

private Id id
Constructor Detail

Template

public Template(nextapp.echoservlet.util.ContentType contentType,
                java.lang.String templateData)
Deprecated. The Template(String, ContentType, String) constructor should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.

Creates a content template from the given String.


Template

public Template(java.lang.String identifier,
                nextapp.echoservlet.util.ContentType contentType,
                java.lang.String templateData)
Creates a content template from the given String.

Method Detail

createFromResource

public static Template createFromResource(java.lang.String resourceName)
Deprecated. The createFromResource(String, String) method should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.

Creates a Template object by way of a resource name. The content type will be determined from the resource's extension. JavaScript resources will be compressed.


createFromResource

public static Template createFromResource(java.lang.String identifier,
                                          java.lang.String resourceName)
Creates a Template object by way of a resource name. The content type will be determined from the resource's extension. JavaScript resources will be compressed.


getContentType

public nextapp.echoservlet.util.ContentType getContentType()
Returns the content type.


getId

public Id getId()
Description copied from interface: Service
Returns a unique identifier for this service.

Specified by:
getId in interface Service

service

public void service(Connection conn)
             throws java.io.IOException
Description copied from interface: Service
Services an HTTP request. Information about the HTTP request as well as methods for issuing a response are available from the provided Connection object.

Specified by:
service in interface Service

toString

public java.lang.String toString()
Renders the content template as a String. Should be used only for debugging purposes.