com.opensymphony.webwork.sitemesh
Class FreeMarkerPageFilter

java.lang.Object
  extended by com.opensymphony.sitemesh.webapp.SiteMeshFilter
      extended by com.opensymphony.module.sitemesh.filter.PageFilter
          extended by com.opensymphony.webwork.sitemesh.TemplatePageFilter
              extended by com.opensymphony.webwork.sitemesh.FreeMarkerPageFilter
All Implemented Interfaces:
Filter

public class FreeMarkerPageFilter
extends TemplatePageFilter

Applies FreeMarker-based sitemesh decorators. The following variables are available to the decorating freemarker page :-

With the following decorated page :-

  <html>
      <meta name="author" content="tm_jee" />
      <head>
          <title>My Title</title>
          <link rel="stylesheet" type="text/css" href="mycss.css" />
          <style type="text/javascript" language="javascript" src="myjavascript.js"></script>
      </head>
      <body<
          <h1>Sample</h1>
      </body>
  </html>
  

Properties Content
${title} My Title
${head} <link rel="stylesheet" type="text/css" href="mycss.css" /> <style type="text/javascript" language="javascript" src="myjavascript.js"></script>
${body} <h1>Sample</h1>
${page.properties.meta.author} tm_jee

Version:
$Date: 2007-01-07 20:20:56 +0800 (Sun, 07 Jan 2007) $ $Id: FreeMarkerPageFilter.java 2792 2007-01-07 12:20:56Z tmjee $
Author:
patrick, tm_jee

Constructor Summary
FreeMarkerPageFilter()
           
 
Method Summary
protected  void applyDecorator(com.opensymphony.module.sitemesh.Page page, com.opensymphony.module.sitemesh.Decorator decorator, HttpServletRequest req, HttpServletResponse res, ServletContext servletContext, ActionContext ctx)
          Applies the decorator, using the relevent contexts
protected  Locale getLocale(ActionInvocation invocation, freemarker.template.Configuration configuration)
          Returns the locale used for the Configuration.getTemplate(String, Locale) call.
 
Methods inherited from class com.opensymphony.webwork.sitemesh.TemplatePageFilter
applyDecorator, getEncoding, init
 
Methods inherited from class com.opensymphony.sitemesh.webapp.SiteMeshFilter
destroy, doFilter, initContentProcessor, initDecoratorSelector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeMarkerPageFilter

public FreeMarkerPageFilter()
Method Detail

applyDecorator

protected void applyDecorator(com.opensymphony.module.sitemesh.Page page,
                              com.opensymphony.module.sitemesh.Decorator decorator,
                              HttpServletRequest req,
                              HttpServletResponse res,
                              ServletContext servletContext,
                              ActionContext ctx)
                       throws ServletException,
                              IOException
Applies the decorator, using the relevent contexts

Specified by:
applyDecorator in class TemplatePageFilter
Parameters:
page - The page
decorator - The decorator
req - The servlet request
res - The servlet response
servletContext - The servlet context
ctx - The action context for this request, populated with the server state
Throws:
ServletException
IOException

getLocale

protected Locale getLocale(ActionInvocation invocation,
                           freemarker.template.Configuration configuration)
Returns the locale used for the Configuration.getTemplate(String, Locale) call. The base implementation simply returns the locale setting of the action (assuming the action implements LocaleProvider) or, if the action does not the configuration's locale is returned. Override this method to provide different behaviour,


WebWork Project Page