|
|||||
FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Simple cache entry that validates against last modified and length attributes of the specified file.
Field Summary | |
---|---|
Map |
cache
|
Date |
date
|
TemplateEngine |
engine
|
boolean |
generateBy
|
long |
hit
|
long |
lastModified
|
long |
length
|
Template |
template
|
Constructor Summary | |
TemplateCacheEntry(File file, Template template)
|
|
TemplateCacheEntry(File file, Template template, boolean timestamp)
|
Method Summary | |
---|---|
def |
TemplateServlet()
Simple file name to template cache map. |
Template |
getTemplate(File file)
Gets the template created by the underlying engine parsing the request. |
void |
init(ServletConfig config)
Initializes the servlet from hints the container passes. |
TemplateEngine |
initTemplateEngine(ServletConfig config)
|
void |
service(HttpServletRequest request, HttpServletResponse response)
Services the request with a response. |
void |
setVariables(ServletBinding binding)
|
String |
toString()
|
boolean |
validate(File file)
Checks the passed file attributes against those cached ones. |
Constructor Detail |
---|
public TemplateCacheEntry(File file, Template template)
public TemplateCacheEntry(File file, Template template, boolean timestamp)
Method Detail |
---|
public def TemplateServlet()
Template getTemplate(File file)
This method looks up a simple (weak) hash map for an existing template object that matches the source file. If the source file didn't change in length and its last modified stamp hasn't changed compared to a precompiled template object, this template is used. Otherwise, there is no or an invalid template object cache entry, a new one is created by the underlying template engine. This new instance is put to the cache for consecutive calls.
public void init(ServletConfig config)
Delegates to sub-init methods and parses the following parameters:
TemplateEngine initTemplateEngine(ServletConfig config)
public void service(HttpServletRequest request, HttpServletResponse response)
First the request is parsed for the source file uri. If the specified file could not be found or can not be read an error message is sent as response.
void setVariables(ServletBinding binding)
public String toString()
public boolean validate(File file)
true
if all measured values match, else false