public class TemplateProcessorRegistry extends Object
If no processors are registered, the default script processor is the freemarker processor.
| Constructor and Description |
|---|
TemplateProcessorRegistry() |
| Modifier and Type | Method and Description |
|---|---|
String |
findValidTemplatePath(String path)
Returns a variation on the provided path that exists and
is processable by one of the processors in this registry.
|
protected TemplateProcessor |
getDefaultTemplateProcessor()
Gets the default template processor.
|
String |
getExtensionForProcessor(TemplateProcessor templateProcessor)
Gets the extension for given processor.
|
String[] |
getRegisteredExtensions()
Returns the extensions with registered processors
|
TemplateProcessor |
getTemplateProcessor(String path)
Returns the best fit template processor for the given path
If a template processor cannot be matched to the path, the default
template processor will be returned.
|
TemplateProcessor |
getTemplateProcessorByExtension(String extension)
Gets the template processor registered for the given extension
|
void |
registerTemplateProcessor(TemplateProcessor templateProcessor)
Registers a template processor
|
void |
registerTemplateProcessor(TemplateProcessor templateProcessor,
String extension,
String name)
Registers a template processor
|
void |
reset()
Resets all of the registered template processors
|
void |
setDefaultTemplateProcessor(String defaultTemplateProcessorName)
Sets the name of the default template processor
|
public void setDefaultTemplateProcessor(String defaultTemplateProcessorName)
defaultTemplateProcessorName - the name of the default template processorpublic void registerTemplateProcessor(TemplateProcessor templateProcessor)
templateProcessor - the template processor to registerpublic void registerTemplateProcessor(TemplateProcessor templateProcessor, String extension, String name)
templateProcessor - the template processor to registerextension - Stringname - Stringprotected TemplateProcessor getDefaultTemplateProcessor()
public TemplateProcessor getTemplateProcessor(String path)
path - the pathpublic TemplateProcessor getTemplateProcessorByExtension(String extension)
extension - the extensionpublic String findValidTemplatePath(String path)
First attempts to find a template processor that contains the content located at the given path (using extension information, if available).
If no match is found, iterates over the file extensions and attempts to find a match.
Path can therefore be values like:
testfile.ftl
- matches to file testfile.ftl using freemarker procesor
testfile
- matches for all extensions, potentially looking at
testfile.ftl, testfile.php, etc.
The extension annotated path is returned which will correctly
dispatch to the discovered processor.path - the pathpublic String[] getRegisteredExtensions()
public String getExtensionForProcessor(TemplateProcessor templateProcessor)
templateProcessor - the template processorpublic void reset()
Copyright © 2005–2018 Alfresco Software. All rights reserved.