org.glassfish.jersey.servlet.mvc.internal
Class JspTemplateProcessor

java.lang.Object
  extended by org.glassfish.jersey.server.mvc.internal.DefaultTemplateProcessor<String>
      extended by org.glassfish.jersey.servlet.mvc.internal.JspTemplateProcessor
All Implemented Interfaces:
TemplateProcessor<String>

public class JspTemplateProcessor
extends DefaultTemplateProcessor<String>

A JSP template processor able to process resources obtained through servlet context.

Author:
Paul Sandoz (paul.sandoz at oracle.com), Michal Gajdos (michal.gajdos at oracle.com)

Constructor Summary
JspTemplateProcessor(Configuration config)
          Creates new template processor for JSP.
 
Method Summary
protected  List<String> getExtensions()
          Get a list of possible file extensions for this template processor.
 String resolve(String name, MediaType mediaType)
          Resolve a template name to a template reference.
 void writeTo(String templateReference, Viewable viewable, MediaType mediaType, OutputStream out)
          Process a template and write the result to an output stream.
 
Methods inherited from class org.glassfish.jersey.server.mvc.internal.DefaultTemplateProcessor
getBasePath, getPossibleTemplateNames, getTemplateName, setBasePathFromProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspTemplateProcessor

public JspTemplateProcessor(@Context
                            Configuration config)
Creates new template processor for JSP.

Parameters:
config - configuration to obtain init param from.
Method Detail

resolve

public String resolve(String name,
                      MediaType mediaType)
Description copied from interface: TemplateProcessor
Resolve a template name to a template reference.

Parameters:
name - the template name.
mediaType - requested media type of the template.
Returns:
the template reference, otherwise null if the template name cannot be resolved.

getExtensions

protected List<String> getExtensions()
Description copied from class: DefaultTemplateProcessor
Get a list of possible file extensions for this template processor.

Specified by:
getExtensions in class DefaultTemplateProcessor<String>
Returns:
list of extensions.

writeTo

public void writeTo(String templateReference,
                    Viewable viewable,
                    MediaType mediaType,
                    OutputStream out)
             throws IOException
Description copied from interface: TemplateProcessor
Process a template and write the result to an output stream.

Parameters:
templateReference - the template reference. This is obtained by calling the TemplateProcessor.resolve(String, javax.ws.rs.core.MediaType) method with a template name and media type.
viewable - the viewable that contains the model to be passed to the template.
mediaType - media type the templateReference should be transformed into.
out - the output stream to write the result of processing the template.
Throws:
IOException - if there was an error processing the template.


Copyright © 2007-2013 Oracle Corporation. All Rights Reserved. Use is subject to license terms.