|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvelosurf.util.TemplateNameFilter
public class TemplateNameFilter
This class is a forwarding filter which allows to hide ".vtl" from resource URLs. It works by building a cache of all template names in the webapp, and adding
The purpose of this feature is to allow URLs to be independant of the status of the resource: regular file or template file, allowing this status to transparently change over time. You can store all resources in the same directory tree, templates having an additional ".vtl" like in "foo.html.vtl" or "bar.js.vtl".
In development mode, you can choose either to reset the cache periodically, or manually with the "reset-cache" URI, or both.
Initialization parameters:
| Field Summary | |
|---|---|
private long |
lastReset
|
private static int |
RESET_MANUAL
|
private static int |
RESET_NONE
|
private static int |
RESET_PERIODIC
|
private int |
resetMethod
|
private long |
resetPeriod
|
private java.lang.String |
resetUri
|
private javax.servlet.ServletContext |
servletContext
|
private java.lang.String |
templateExtension
|
private java.util.Set |
templates
|
| Constructor Summary | |
|---|---|
TemplateNameFilter()
|
|
| Method Summary | |
|---|---|
private void |
buildsTemplateNamesList()
Builds the cache, which consists of a hash set containing all template names. |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
|
void |
init(javax.servlet.FilterConfig filterConfig)
init the filter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private javax.servlet.ServletContext servletContext
private java.lang.String templateExtension
private static final int RESET_NONE
private static final int RESET_MANUAL
private static final int RESET_PERIODIC
private int resetMethod
private java.lang.String resetUri
private long resetPeriod
private java.util.Set templates
private long lastReset
| Constructor Detail |
|---|
public TemplateNameFilter()
| Method Detail |
|---|
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
init in interface javax.servlet.FilterfilterConfig - filter configuration
javax.servlet.ServletExceptionprivate void buildsTemplateNamesList()
public void doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
throws javax.servlet.ServletException,
java.io.IOException
doFilter in interface javax.servlet.Filterjavax.servlet.ServletException
java.io.IOExceptionpublic void destroy()
destroy in interface javax.servlet.Filter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||