org.norther.tammi.spray.template
Class DefaultPageFilter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultContainer<V>
          extended by org.norther.tammi.core.security.DefaultSecureContainer<V>
              extended by org.norther.tammi.spray.filter.DefaultSecureContainerFilter<V>
                  extended by org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter<TemplateEngine>
                      extended by org.norther.tammi.spray.template.DefaultPageFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Container<TemplateEngine>, Manageable, MBeanDelegate, Refreshable, CacheClient<String,String>, AccessController, SecureContainer<TemplateEngine>, TemplateExecutor, ContainerFilter<TemplateEngine>, ContainerKeyFilter<TemplateEngine>, KeyFilter, SecureContainerFilter<TemplateEngine>, SecureContainerKeyFilter<TemplateEngine>, SecureFilter, PageFilter
Direct Known Subclasses:
DefaultLayoutFilter

public class DefaultPageFilter
extends DefaultSecureContainerKeyFilter<TemplateEngine>
implements PageFilter

A default implementation of PageFilter.

Based on TurbineTemplateService in the Apache Jakarta Turbine project.

Version:
$Id: DefaultPageFilter.java,v 1.28 2010-06-22 17:50:20 cvsimp Exp $
Author:
John D. McNally, Dave Bryson, Jason van Zyl, Daniel Rall, Ilkka Priha
See Also:
Serialized Form

Field Summary
static String TEMPLATE_KEY
          The default key for the template.
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.spray.template.PageFilter
ANY_EXTENSION
 
Fields inherited from interface org.norther.tammi.spray.engine.TemplateExecutor
PROPERTY_ENCODING, PROPERTY_EXTENSION
 
Constructor Summary
DefaultPageFilter()
          Constructs a new filter.
DefaultPageFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 boolean checkPermission(Permission permission, ServletRequest request, ServletResponse response, FilterChain chain)
          Checks whether or not the specified request has a permission to access a template specified in the name of the resource.
 void clearCached()
          Clears all cached entries without notifying.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
          Activates template evaluation.
 CharSequence evaluate(CharSequence raw, String template, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Evaluates the named run-time content.
 CharSequence evaluate(String template, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Evaluates an optionally local template by resolving its optionally localized name and template engine specific extension based on terminal properties of the request.
 CharSequence evaluate(String template, String encoding, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Evaluates an optionally local template with the specified encoding by resolving its optionally localized name and template engine specific extension based on terminal properties of the request.
 void execute(CharSequence raw, String template, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Executes the named run-time content.
 void execute(String template, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Executes an optionally local template by resolving its optionally localized name and template engine specific extension based on terminal properties of the request.
 void execute(String template, String encoding, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Executes an optionally local template with the specified encoding by resolving its optionally localized name and template engine specific extension based on terminal properties of the request.
 void expireCached(long timestamp)
          Expires all cached entries notifying them about expiration.
 void expireFraction(long timestamp, float fraction)
          Expires the specified fraction of cached entries notifying them about expiration.
 ConcurrentMap<String,String> getCache(boolean... create)
          Gets and optionally creates the cache.
 String getDefaultBuilder()
          Gets the default template builder.
 String getErrorTemplate()
          Gets the error template.
 String getPageEncoding(ServletRequest request, ServletResponse response)
          Gets the current page encoding of the specified request.
 String getPageTemplate()
          Gets the default page template.
 String getPageTemplate(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the current page template of the specified request.
 long getRefreshed()
          Gets the last refresh timestamp.
 ObjectName getSharedCacheName()
          Gets the the shared cache of this client.
 ObjectName getTaskLoaderName()
          Gets the the task loader of this filter.
 TemplateEngine getTemplateEngine(String template)
          Gets the referent of the template engine MBean to be applied to the specified template.
 boolean isCachingDisabled()
          Checks whether the caching is disabled.
 boolean isLocalContext()
          Gets local context flag.
 boolean isLocalizedTemplates()
          Gets the localized templates flag.
 void postmanaged()
          This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.
 void refresh()
          Refreshes the MBean.
 void removeCache()
          Removes the cache.
protected  CharSequence resolve(StringBuilder buffer, String encoding, boolean directly, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Resolves the template content either by evaluation or execution.
 CharSequence resolve(String template, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Resolves the named and optionally localized template content.
 CharSequence resolve(String template, String encoding, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Resolves the named and optionally localized template content with the specified encoding.
 String resolveTemplatePath(String template, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Resolves an optionally localized template path for the specified request and response.
 void setCachingDisabled(boolean flag)
          Sets the caching disabled flag.
 void setDefaultBuilder(String name)
          Sets the default template builder.
 void setErrorTemplate(String template)
          Sets the error template.
 void setLocalContext(boolean flag)
          Sets the local context flag.
 void setLocalizedTemplates(boolean flag)
          Sets the localized templates flag.
 void setPageTemplate(String template)
          Sets the default page template.
 void setPageTemplate(String template, ServletRequest request, ServletResponse response, FilterChain chain)
          Sets the current page template of the specified request.
 void setPageTemplate(String template, String encoding, ServletRequest request, ServletResponse response, FilterChain chain)
          Sets the current page template of the specified request with encoding.
 void setSharedCacheName(ObjectName cache)
          Sets the shared cache of this client.
 void setTaskLoaderName(ObjectName loader)
          Sets the task loader of this filter.
 boolean templateExists(String template, ServletRequest request, ServletResponse response, FilterChain chain, boolean... options)
          Checks whether the optionally localized template exists.
 void unmanaged()
          This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter
getFilter, getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultSecureContainerFilter
destroy, getFilterConfig, getRequestMap, getSessionMap, init
 
Methods inherited from class org.norther.tammi.core.security.DefaultSecureContainer
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from class org.norther.tammi.core.base.DefaultContainer
clear, containsKey, get, getContainerKey, getContainerKey, getContainerKey, getMBean, getMBeanHandle, getMBeanHandles, getMBeanInterface, getMBeanInterface, getObjectName, getObjectNames, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, remove, setMBeanInterface, setQueryPattern, setQueryPattern
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.security.AccessController
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from interface org.norther.tammi.core.base.Container
clear, containsKey, get, getContainerKey, getContainerKey, getContainerKey, getMBean, getMBeanInterface, getMBeanInterface, getObjectName, getObjectNames, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, remove, setMBeanInterface, setQueryPattern, setQueryPattern
 
Methods inherited from interface org.norther.tammi.spray.filter.KeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from interface javax.servlet.Filter
destroy, init
 

Field Detail

TEMPLATE_KEY

public static final String TEMPLATE_KEY
The default key for the template.

See Also:
Constant Field Values
Constructor Detail

DefaultPageFilter

public DefaultPageFilter()
Constructs a new filter.


DefaultPageFilter

public DefaultPageFilter(String key)
Constructs a new filter with a key.

Parameters:
key - the filter key.
Method Detail

postmanaged

public void postmanaged()
Description copied from interface: Manageable
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.

Specified by:
postmanaged in interface Manageable
Overrides:
postmanaged in class Adaptee

unmanaged

public void unmanaged()
               throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.

Specified by:
unmanaged in interface Manageable
Overrides:
unmanaged in class Adaptee
Throws:
Exception - if the adaptee refused to be unmanaged.

isCachingDisabled

public boolean isCachingDisabled()
Description copied from interface: CacheClient
Checks whether the caching is disabled.

Specified by:
isCachingDisabled in interface CacheClient<String,String>
Returns:
true if the caching is disabled, true otherwise.

setCachingDisabled

public void setCachingDisabled(boolean flag)
Description copied from interface: CacheClient
Sets the caching disabled flag.

Specified by:
setCachingDisabled in interface CacheClient<String,String>
Parameters:
flag - the caching disabled flag.

expireCached

public void expireCached(long timestamp)
Description copied from interface: CacheClient
Expires all cached entries notifying them about expiration.

Specified by:
expireCached in interface CacheClient<String,String>
Parameters:
timestamp - the timestamp of the expiration.

expireFraction

public void expireFraction(long timestamp,
                           float fraction)
Description copied from interface: CacheClient
Expires the specified fraction of cached entries notifying them about expiration.

Specified by:
expireFraction in interface CacheClient<String,String>
Parameters:
timestamp - the timestamp of the expiration.
fraction - the fraction of entries to expire (0.0..1.0).

clearCached

public void clearCached()
Description copied from interface: CacheClient
Clears all cached entries without notifying.

Specified by:
clearCached in interface CacheClient<String,String>

getCache

public ConcurrentMap<String,String> getCache(boolean... create)
Description copied from interface: CacheClient
Gets and optionally creates the cache.

Specified by:
getCache in interface CacheClient<String,String>
Parameters:
create - true to create a missing cache.
Returns:
the cache or null if disabled.

removeCache

public void removeCache()
Description copied from interface: CacheClient
Removes the cache.

Specified by:
removeCache in interface CacheClient<String,String>

getSharedCacheName

public ObjectName getSharedCacheName()
Description copied from interface: CacheClient
Gets the the shared cache of this client.

Specified by:
getSharedCacheName in interface CacheClient<String,String>
Returns:
the object name of the shared cache or a query.

setSharedCacheName

public void setSharedCacheName(ObjectName cache)
Description copied from interface: CacheClient
Sets the shared cache of this client. If it is not set, the default one will be used.

Specified by:
setSharedCacheName in interface CacheClient<String,String>
Parameters:
cache - the object name of the shared cache or a query.

refresh

public void refresh()
Description copied from interface: Refreshable
Refreshes the MBean.

Specified by:
refresh in interface Refreshable

getRefreshed

public long getRefreshed()
Description copied from interface: Refreshable
Gets the last refresh timestamp.

Specified by:
getRefreshed in interface Refreshable
Returns:
the timestamp of the last refresh.

getErrorTemplate

public String getErrorTemplate()
Description copied from interface: PageFilter
Gets the error template.

Specified by:
getErrorTemplate in interface PageFilter
Returns:
the name of the error template.

setErrorTemplate

public void setErrorTemplate(String template)
Description copied from interface: PageFilter
Sets the error template. The error template will be evaluated if the evaluation of the target template fails.

Specified by:
setErrorTemplate in interface PageFilter
Parameters:
template - the name of the error template.

getPageTemplate

public String getPageTemplate()
Description copied from interface: PageFilter
Gets the default page template.

Specified by:
getPageTemplate in interface PageFilter
Returns:
the name of the default page template.

setPageTemplate

public void setPageTemplate(String template)
Description copied from interface: PageFilter
Sets the default page template. The page template will be evaluated if the request doesn't contain any target template information.

Specified by:
setPageTemplate in interface PageFilter
Parameters:
template - the name of the page template.

getDefaultBuilder

public String getDefaultBuilder()
Description copied from interface: PageFilter
Gets the default template builder.

Specified by:
getDefaultBuilder in interface PageFilter
Returns:
the name of the default builder.

setDefaultBuilder

public void setDefaultBuilder(String name)
Description copied from interface: PageFilter
Sets the default template builder.

Specified by:
setDefaultBuilder in interface PageFilter
Parameters:
name - the name of the default builder.

getPageTemplate

public String getPageTemplate(ServletRequest request,
                              ServletResponse response,
                              FilterChain chain)
Description copied from interface: PageFilter
Gets the current page template of the specified request.

Specified by:
getPageTemplate in interface PageFilter
Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
the template or null.

setPageTemplate

public void setPageTemplate(String template,
                            ServletRequest request,
                            ServletResponse response,
                            FilterChain chain)
Description copied from interface: PageFilter
Sets the current page template of the specified request.

Specified by:
setPageTemplate in interface PageFilter
Parameters:
template - the template.
request - the request.
response - the response.
chain - the filter chain.

setPageTemplate

public void setPageTemplate(String template,
                            String encoding,
                            ServletRequest request,
                            ServletResponse response,
                            FilterChain chain)
Description copied from interface: PageFilter
Sets the current page template of the specified request with encoding.

Specified by:
setPageTemplate in interface PageFilter
Parameters:
template - the template.
encoding - the encoding.
request - the request.
response - the response.
chain - the filter chain.

getPageEncoding

public String getPageEncoding(ServletRequest request,
                              ServletResponse response)
Description copied from interface: PageFilter
Gets the current page encoding of the specified request.

Specified by:
getPageEncoding in interface PageFilter
Parameters:
request - the request.
response - the response.
Returns:
the encoding.

getTaskLoaderName

public ObjectName getTaskLoaderName()
Description copied from interface: PageFilter
Gets the the task loader of this filter.

Specified by:
getTaskLoaderName in interface PageFilter
Returns:
the object name of the task loader or a query.

setTaskLoaderName

public void setTaskLoaderName(ObjectName loader)
Description copied from interface: PageFilter
Sets the task loader of this filter. If it is not set, the default one will be used.

Specified by:
setTaskLoaderName in interface PageFilter
Parameters:
loader - the object name of the task loader or a query.

isLocalContext

public boolean isLocalContext()
Description copied from interface: TemplateExecutor
Gets local context flag.

Specified by:
isLocalContext in interface TemplateExecutor
Returns:
true for a local context, false othrwise.

setLocalContext

public void setLocalContext(boolean flag)
Description copied from interface: TemplateExecutor
Sets the local context flag. Local context is created for the rendered template to prevent local changes to interfere with the global context.

Specified by:
setLocalContext in interface TemplateExecutor
Parameters:
flag - true for a local context, false othrwise.

isLocalizedTemplates

public boolean isLocalizedTemplates()
Description copied from interface: TemplateExecutor
Gets the localized templates flag.

Specified by:
isLocalizedTemplates in interface TemplateExecutor
Returns:
the localized templates flag.

setLocalizedTemplates

public void setLocalizedTemplates(boolean flag)
Description copied from interface: TemplateExecutor
Sets the localized templates flag. Localized template names are formed by inserting the locale string between the plain template name and the template extension.

Specified by:
setLocalizedTemplates in interface TemplateExecutor
Parameters:
flag - the localized templates flag.

getTemplateEngine

public TemplateEngine getTemplateEngine(String template)
Description copied from interface: TemplateExecutor
Gets the referent of the template engine MBean to be applied to the specified template.

Specified by:
getTemplateEngine in interface TemplateExecutor
Parameters:
template - the template.
Returns:
the template engine.

execute

public void execute(String template,
                    ServletRequest request,
                    ServletResponse response,
                    FilterChain chain,
                    boolean... options)
             throws TemplateException
Description copied from interface: PageFilter
Executes an optionally local template by resolving its optionally localized name and template engine specific extension based on terminal properties of the request. Absolute template paths point to the template engine root. Relative paths are relative to the current page template path.

Specified by:
execute in interface TemplateExecutor
Specified by:
execute in interface PageFilter
Parameters:
template - the template.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext, localized templates and encode xml options.
Throws:
TemplateException - if processing fails.

execute

public void execute(String template,
                    String encoding,
                    ServletRequest request,
                    ServletResponse response,
                    FilterChain chain,
                    boolean... options)
             throws TemplateException
Description copied from interface: PageFilter
Executes an optionally local template with the specified encoding by resolving its optionally localized name and template engine specific extension based on terminal properties of the request. Absolute template paths point to the template engine root. Relative paths are relative to the current page template path.

Specified by:
execute in interface TemplateExecutor
Specified by:
execute in interface PageFilter
Parameters:
template - the template.
encoding - the encoding.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext, localized templates and encode xml options.
Throws:
TemplateException - if processing fails.

execute

public void execute(CharSequence raw,
                    String template,
                    ServletRequest request,
                    ServletResponse response,
                    FilterChain chain,
                    boolean... options)
             throws TemplateException
Description copied from interface: PageFilter
Executes the named run-time content.

Specified by:
execute in interface TemplateExecutor
Specified by:
execute in interface PageFilter
Parameters:
raw - the content.
template - a virtual template for identifying the content.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext and encode xml options.
Throws:
TemplateException - if processing fails.

evaluate

public CharSequence evaluate(String template,
                             ServletRequest request,
                             ServletResponse response,
                             FilterChain chain,
                             boolean... options)
                      throws TemplateException
Description copied from interface: PageFilter
Evaluates an optionally local template by resolving its optionally localized name and template engine specific extension based on terminal properties of the request. Absolute template paths point to the template engine root. Relative paths are relative to the current page template path.

Specified by:
evaluate in interface TemplateExecutor
Specified by:
evaluate in interface PageFilter
Parameters:
template - the template.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext, localized templates and encode xml options.
Returns:
the built content.
Throws:
TemplateException - if processing fails.

evaluate

public CharSequence evaluate(String template,
                             String encoding,
                             ServletRequest request,
                             ServletResponse response,
                             FilterChain chain,
                             boolean... options)
                      throws TemplateException
Description copied from interface: PageFilter
Evaluates an optionally local template with the specified encoding by resolving its optionally localized name and template engine specific extension based on terminal properties of the request. Absolute template paths point to the template engine root. Relative paths are relative to the current page template path.

Specified by:
evaluate in interface TemplateExecutor
Specified by:
evaluate in interface PageFilter
Parameters:
template - the template.
encoding - the encoding.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext, localized templates and encode xml options.
Returns:
the built content.
Throws:
TemplateException - if processing fails.

evaluate

public CharSequence evaluate(CharSequence raw,
                             String template,
                             ServletRequest request,
                             ServletResponse response,
                             FilterChain chain,
                             boolean... options)
                      throws TemplateException
Description copied from interface: PageFilter
Evaluates the named run-time content.

Specified by:
evaluate in interface TemplateExecutor
Specified by:
evaluate in interface PageFilter
Parameters:
raw - the content.
template - a virtual template for identifying the content.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext and encode xml options.
Returns:
the evaluated content.
Throws:
TemplateException - if processing fails.

resolve

public CharSequence resolve(String template,
                            ServletRequest request,
                            ServletResponse response,
                            FilterChain chain,
                            boolean... options)
                     throws TemplateException
Description copied from interface: PageFilter
Resolves the named and optionally localized template content. The exact result depends on the implementation allowing different template path resolving, localization and layouting mechanisms.

Specified by:
resolve in interface TemplateExecutor
Specified by:
resolve in interface PageFilter
Parameters:
template - the template.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext, localized templates and encode xml options.
Returns:
the resolved content.
Throws:
TemplateException - if processing fails.

resolve

public CharSequence resolve(String template,
                            String encoding,
                            ServletRequest request,
                            ServletResponse response,
                            FilterChain chain,
                            boolean... options)
                     throws TemplateException
Description copied from interface: PageFilter
Resolves the named and optionally localized template content with the specified encoding. The exact result depends on the implementation allowing different template path resolving, localization and layouting mechanisms.

Specified by:
resolve in interface TemplateExecutor
Specified by:
resolve in interface PageFilter
Parameters:
template - the template.
encoding - the encoding.
request - the request.
response - the response.
chain - the filter chain.
options - the local coxtext, localized templates and encode xml options.
Returns:
the resolved content.
Throws:
TemplateException - if processing fails.

templateExists

public boolean templateExists(String template,
                              ServletRequest request,
                              ServletResponse response,
                              FilterChain chain,
                              boolean... options)
Description copied from interface: PageFilter
Checks whether the optionally localized template exists. The template name is resolved in the same way as in execute and evaluate methods. Absolute template paths point to the template engine root. Relative paths are relative to the current page template path.

Specified by:
templateExists in interface TemplateExecutor
Specified by:
templateExists in interface PageFilter
Parameters:
template - the template.
request - the request.
response - the response.
chain - the filter chain.
options - the localized templates option.
Returns:
true if the template exists, otherwise false.

resolveTemplatePath

public String resolveTemplatePath(String template,
                                  ServletRequest request,
                                  ServletResponse response,
                                  FilterChain chain,
                                  boolean... options)
Description copied from interface: PageFilter
Resolves an optionally localized template path for the specified request and response. Absolute template paths point to the template executor root. Relative paths are relative to the current template path.

Specified by:
resolveTemplatePath in interface TemplateExecutor
Specified by:
resolveTemplatePath in interface PageFilter
Parameters:
template - the name of the template.
request - the template request.
response - the template response.
chain - the filter chain.
options - the localized templates option.
Returns:
the template path or null.

checkPermission

public boolean checkPermission(Permission permission,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain)
Checks whether or not the specified request has a permission to access a template specified in the name of the resource. Absolute template paths point to the template engine root. Relative paths are relative to current page template path.

Specified by:
checkPermission in interface SecureFilter
Overrides:
checkPermission in class DefaultSecureContainerFilter<TemplateEngine>
Parameters:
permission - the permission.
request - the authenticated request.
response - the corresponding response.
chain - the active filter chain.
Returns:
true if the principal has the permission, false otherwise.
Throws:
SecurityException - if the access control list is invalid.

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws ServletException,
                     IOException
Activates template evaluation. The template key is first applied to request attributes to find a template. If the key does not define a template, the filter key, which defaults to 'template', is applied to request parameters. If a template is still not found, the default template will be evaluated.

The default value of the default template is 'Index'. If the default template is also unspecified, the filter does not perform any procesing.

The template extension is concluded from terminal type of the request. The template name is passed to the render method and its return value written to the response.

Specified by:
doFilter in interface Filter
Overrides:
doFilter in class DefaultSecureContainerFilter<TemplateEngine>
Parameters:
request - the request to process.
response - the response to return.
chain - the current filter chain.
Throws:
ServletException - for servlet errors.
IOException - for general errors.

resolve

protected CharSequence resolve(StringBuilder buffer,
                               String encoding,
                               boolean directly,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain,
                               boolean... options)
                        throws TemplateException
Resolves the template content either by evaluation or execution. This method can be overriden by subclasses to implement specific template processing activated from the doFilter method.

Parameters:
buffer - the resolved template path/builder (input/output).
encoding - the encoding.
directly - the direct mode.
request - the request.
response - the response.
chain - the filter chain.
options - the local context, localized templates and encode xml options.
Returns:
the resolved content or null.
Throws:
TemplateException - if processing fails.


Copyright © 2004 The Norther Organization. All rights reserved.