com.sun.jersey.spi.template
Interface TemplateProcessor


public interface TemplateProcessor

A template processor.

Implementations of this interface shall be capable of resolving a template name into a fully qualified template name that identifies a template supported by the implementation. And, processing the template, identified by the fully qualified template name, the results of which are written to an output stream.

Implementations can register a template processor as a provider, for example, annotating the implementation class with Provider or registering an instance as a singleton with ResourceConfig or Application.

Such template processors could be JSP template processors (supported by the Jersey servlet and filter implementations) or say Freemarker or Velocity template processors (not implemented).

Author:
Paul.Sandoz@Sun.Com

Method Summary
 java.lang.String resolve(java.lang.String name)
          Resolve a template name into a fully qualified template name that identifies a template.
 void writeTo(java.lang.String fullyQualifedName, java.lang.Object model, java.io.OutputStream out)
          Process a template and write the result to an output stream.
 

Method Detail

resolve

java.lang.String resolve(java.lang.String name)
Resolve a template name into a fully qualified template name that identifies a template.

Parameters:
name - the template name
Returns:
the fully qualified template name, otherwise null if the template name cannot be resolved.

writeTo

void writeTo(java.lang.String fullyQualifedName,
             java.lang.Object model,
             java.io.OutputStream out)
             throws java.io.IOException
Process a template and write the result to an output stream.

Parameters:
fullyQualifedName - the fully qualified template name identifying a template. This is obtained by calling the resolve method with a template name.
model - the model to be passed to the template.
out - the output stream to write the result of processing the template.
Throws:
java.io.IOException - if there was an error processing the template.


Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved.