Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.sitemesh
Class FreeMarkerPageFilter

    java.lang.Object
      com.opensymphony.module.sitemesh.filter.PageFilter
          org.apache.struts2.sitemesh.TemplatePageFilter
              org.apache.struts2.sitemesh.FreeMarkerPageFilter

All Implemented Interfaces:
  com.opensymphony.module.sitemesh.RequestConstants, javax.servlet.Filter

    public class FreeMarkerPageFilter

extends TemplatePageFilter

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

- ${title} - content of <title> tag in the decorated page
- ${head} - content of <head> tag in the decorated page
- ${body} - content of t<body> tag in the decorated page
- ${page.properties} - content of the page properties

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: 2006-11-16 03:32:03 -0500 (Thu, 16 Nov 2006) $ $Id: FreeMarkerPageFilter.java 475637 2006-11-16 08:32:03Z mrdon $

Field Summary

Fields inherited from interface com.opensymphony.module.sitemesh.RequestConstants
`DECORATOR, FILTER_APPLIED, PAGE, ROBOT, USING_STREAM`

Constructor Summary
`FreeMarkerPageFilter()`

Method Summary
`protected void` | `applyDecorator(com.opensymphony.module.sitemesh.Page page, com.opensymphony.module.sitemesh.Decorator decorator, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, javax.servlet.ServletContext servletContext, com.opensymphony.xwork2.ActionContext ctx)` Applies the decorator, using the relevent contexts
`protected java.util.Locale` | `getLocale(com.opensymphony.xwork2.ActionInvocation invocation, freemarker.template.Configuration configuration)` Returns the locale used for the `Configuration.getTemplate(String, Locale)` call.
`static void` | `setFreemarkerManager(org.apache.struts2.views.freemarker.FreemarkerManager mgr)`

Methods inherited from class org.apache.struts2.sitemesh.TemplatePageFilter
`applyDecorator, getEncoding, init, setCustomEncoding`

Methods inherited from class com.opensymphony.module.sitemesh.filter.PageFilter
`destroy, doFilter, getFilterConfig, parsePage, setFilterConfig`

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

### setFreemarkerManager

    public static void setFreemarkerManager(org.apache.struts2.views.freemarker.FreemarkerManager mgr)

### applyDecorator

    protected void applyDecorator(com.opensymphony.module.sitemesh.Page page,
                                  com.opensymphony.module.sitemesh.Decorator decorator,
                                  javax.servlet.http.HttpServletRequest req,
                                  javax.servlet.http.HttpServletResponse res,
                                  javax.servlet.ServletContext servletContext,
                                  com.opensymphony.xwork2.ActionContext ctx)
                           throws javax.servlet.ServletException,
                                  java.io.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:
    `javax.servlet.ServletException`
    `java.io.IOException`

### getLocale

    protected java.util.Locale getLocale(com.opensymphony.xwork2.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,

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.