org.norther.tammi.spray.template
Class DefaultLayoutFilter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultContainer
          extended by org.norther.tammi.core.security.DefaultSecureContainer
              extended by org.norther.tammi.spray.filter.AbstractSecureContainerFilter
                  extended by org.norther.tammi.spray.filter.AbstractSecureContainerKeyFilter
                      extended by org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter
                          extended by org.norther.tammi.spray.template.DefaultPageFilter
                              extended by org.norther.tammi.spray.template.DefaultLayoutFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Container, Manageable, MBeanDelegate, Refreshable, CacheClient, AccessController, SecureContainer, TemplateExecutor, ContainerFilter, ContainerKeyFilter, KeyFilter, SecureContainerFilter, SecureContainerKeyFilter, SecureFilter, LayoutFilter, PageFilter

public class DefaultLayoutFilter
extends DefaultPageFilter
implements LayoutFilter

A default implementation of LayoutFilter.

Based on TurbineTemplateService in the Apache Jakarta Turbine project.

Author:
John D. McNally, Dave Bryson, Jason van Zyl, Daniel Rall, Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.spray.template.DefaultPageFilter
TEMPLATE_KEY
 
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
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultLayoutFilter()
          Constructs a new filter.
DefaultLayoutFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 String getLayoutEncoding(ServletRequest request, ServletResponse response)
          Gets the current layout encoding of the specified request.
 String getLayoutTemplate()
          Gets the default layout template.
 String getLayoutTemplate(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the current layout template of the specified request.
protected  CharSequence resolve(StringBuilder buffer, String encoding, boolean local, boolean localized, boolean directly, ServletRequest request, ServletResponse response, FilterChain chain)
          Resolves the template content either by evaluation or execution.
 void setLayoutTemplate(String template)
          Sets the default layout template.
 void setLayoutTemplate(String template, ServletRequest request, ServletResponse response, FilterChain chain)
          Sets the current layout template of the specified request.
 void setLayoutTemplate(String template, String encoding, ServletRequest request, ServletResponse response, FilterChain chain)
          Sets the current layout template of the specified request with encoding.
 
Methods inherited from class org.norther.tammi.spray.template.DefaultPageFilter
checkPermission, checkPermission, clearCached, doFilter, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, execute, execute, execute, execute, execute, execute, execute, execute, expireCached, expireFraction, getCache, getDefaultBuilder, getErrorTemplate, getPageEncoding, getPageTemplate, getPageTemplate, getRefreshed, getTaskLoaderName, getTemplateEngine, isCachingDisabled, isLocalContext, isLocalizedTemplates, postmanaged, refresh, removeCache, resolve, resolve, resolve, resolve, resolveTemplatePath, resolveTemplatePath, setCachingDisabled, setDefaultBuilder, setErrorTemplate, setLocalContext, setLocalizedTemplates, setPageTemplate, setPageTemplate, setPageTemplate, setTaskLoaderName, templateExists, templateExists, unmanaged
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultSecureContainerKeyFilter
getFilter
 
Methods inherited from class org.norther.tammi.spray.filter.AbstractSecureContainerKeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from class org.norther.tammi.spray.filter.AbstractSecureContainerFilter
checkPermission, destroy, getFilterConfig, getRequestMap, getSessionMap, init
 
Methods inherited from class org.norther.tammi.core.security.DefaultSecureContainer
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, 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.spray.template.PageFilter
evaluate, evaluate, evaluate, evaluate, evaluate, execute, execute, execute, execute, execute, getDefaultBuilder, getPageEncoding, getPageTemplate, getPageTemplate, getTaskLoaderName, resolve, resolve, resolveTemplatePath, setDefaultBuilder, setPageTemplate, setPageTemplate, setPageTemplate, setTaskLoaderName, templateExists
 
Methods inherited from interface org.norther.tammi.spray.engine.TemplateExecutor
evaluate, evaluate, evaluate, execute, execute, execute, getErrorTemplate, getTemplateEngine, isLocalContext, isLocalizedTemplates, resolve, resolve, resolveTemplatePath, setErrorTemplate, setLocalContext, setLocalizedTemplates, templateExists
 
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 javax.servlet.Filter
destroy, doFilter, init
 
Methods inherited from interface org.norther.tammi.spray.filter.SecureFilter
checkPermission, checkPermission, checkPermission
 
Methods inherited from interface org.norther.tammi.core.security.AccessController
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from interface javax.servlet.Filter
destroy, doFilter, init
 
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 javax.servlet.Filter
destroy, doFilter, init
 
Methods inherited from interface org.norther.tammi.spray.filter.KeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from interface javax.servlet.Filter
destroy, doFilter, init
 
Methods inherited from interface org.norther.tammi.core.cache.CacheClient
clearCached, expireCached, expireFraction, getCache, isCachingDisabled, removeCache, setCachingDisabled
 
Methods inherited from interface org.norther.tammi.core.base.Refreshable
getRefreshed, refresh
 

Constructor Detail

DefaultLayoutFilter

public DefaultLayoutFilter()
Constructs a new filter.


DefaultLayoutFilter

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

Parameters:
key - the filter key.
Method Detail

getLayoutTemplate

public String getLayoutTemplate()
Description copied from interface: LayoutFilter
Gets the default layout template.

Specified by:
getLayoutTemplate in interface LayoutFilter
Returns:
the name of the default layout template.

setLayoutTemplate

public void setLayoutTemplate(String template)
Description copied from interface: LayoutFilter
Sets the default layout template. The layout template is processed after the target template. The content of the target template is available to the layout template through the content tool.

Specified by:
setLayoutTemplate in interface LayoutFilter
Parameters:
template - the name of the layout template.

getLayoutTemplate

public String getLayoutTemplate(ServletRequest request,
                                ServletResponse response,
                                FilterChain chain)
Description copied from interface: LayoutFilter
Gets the current layout template of the specified request.

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

setLayoutTemplate

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

Specified by:
setLayoutTemplate in interface LayoutFilter
Parameters:
template - the template.
request - the request.
response - the response.
chain - the filter chain.

setLayoutTemplate

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

Specified by:
setLayoutTemplate in interface LayoutFilter
Parameters:
template - the template.
encoding - the encoding.
request - the request.
response - the response.
chain - the filter chain.

getLayoutEncoding

public String getLayoutEncoding(ServletRequest request,
                                ServletResponse response)
Description copied from interface: LayoutFilter
Gets the current layout encoding of the specified request.

Specified by:
getLayoutEncoding in interface LayoutFilter
Parameters:
request - the request.
response - the response.
Returns:
the encoding.

resolve

protected CharSequence resolve(StringBuilder buffer,
                               String encoding,
                               boolean local,
                               boolean localized,
                               boolean directly,
                               ServletRequest request,
                               ServletResponse response,
                               FilterChain chain)
                        throws TemplateException
Resolves the template content either by evaluation or execution. This method overrides the one in PageFilter and implements layout based template processing.

Overrides:
resolve in class DefaultPageFilter
Parameters:
buffer - the resolved template path/builder (input/output).
encoding - the default encoding.
local - the local context option.
localized - the localized option.
directly - the mode.
request - the request.
response - the response.
chain - the filter chain.
Returns:
the resolved content.
Throws:
TemplateException - if processing fails.


Copyright © 2004 The Norther Organization. All rights reserved.