org.glassfish.jersey.server.mvc.internal
Class DefaultTemplateProcessor<T>

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

@Provider
public abstract class DefaultTemplateProcessor<T>
extends java.lang.Object
implements TemplateProcessor<T>

Implementation of TemplateProcessor common to cases where a base path in template name should be used when resolving a viewable.

Author:
Michal Gajdos (michal.gajdos at oracle.com)

Constructor Summary
protected DefaultTemplateProcessor(Configuration configuration)
          Creates an instance of DefaultTemplateProcessor.
 
Method Summary
protected  java.lang.String getBasePath()
          Get configured base path of this processor's templates.
protected abstract  java.util.List<java.lang.String> getExtensions()
          Get a list of possible file extensions for this template processor.
protected  java.util.List<java.lang.String> getPossibleTemplateNames(java.lang.String template)
          Get all possible template names which should be looked for during resolving a viewable.
protected  java.lang.String getTemplateName(java.lang.String template)
          Get template name prefixed with the base path.
protected  void setBasePathFromProperty(java.lang.String basePathPropertyName)
          Set the base path field of this processor using value obtained from configuration with given basePathPropertyName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.jersey.server.mvc.spi.TemplateProcessor
resolve, writeTo
 

Constructor Detail

DefaultTemplateProcessor

protected DefaultTemplateProcessor(Configuration configuration)
Creates an instance of DefaultTemplateProcessor.

Parameters:
configuration - non-null configuration to obtain properties from.
Method Detail

getBasePath

protected java.lang.String getBasePath()
Get configured base path of this processor's templates.

Returns:
configured base path or an empty string.

getTemplateName

protected java.lang.String getTemplateName(java.lang.String template)
Get template name prefixed with the base path.

Parameters:
template - template name.
Returns:
base path + template name.

getPossibleTemplateNames

protected java.util.List<java.lang.String> getPossibleTemplateNames(java.lang.String template)
Get all possible template names which should be looked for during resolving a viewable.

Parameters:
template - template name.
Returns:
possible template names - template name, combination of template name and extensions.

getExtensions

protected abstract java.util.List<java.lang.String> getExtensions()
Get a list of possible file extensions for this template processor.

Returns:
list of extensions.

setBasePathFromProperty

protected void setBasePathFromProperty(java.lang.String basePathPropertyName)
Set the base path field of this processor using value obtained from configuration with given basePathPropertyName.

Parameters:
basePathPropertyName - name of the configuration property referencing base path in the configuration.


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.