org.apache.struts2.sitemesh

## Class FreemarkerDecoratorServlet

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - freemarker.ext.servlet.FreemarkerServlet
      - - org.apache.struts2.sitemesh.FreemarkerDecoratorServlet

- All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

  Deprecated.
  Sitemesh 2 based plugin is not supported anymore

      @Deprecated
      public class FreemarkerDecoratorServlet
      extends freemarker.ext.servlet.FreemarkerServlet

  This is a SiteMesh FreeMarker view servlet.

  It overrides the SiteMesh servlet to rely on the Freemarker Manager in Struts instead of creating it's own manager

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected freemarker.template.Configuration` | `config` Deprecated.
    `protected boolean` | `debug` Deprecated.
    `protected FreemarkerManager` | `freemarkerManager` Deprecated.
    `protected boolean` | `nocache` Deprecated.
    `static long` | `serialVersionUID` Deprecated.
    `protected String` | `templatePath` Deprecated.

    - ### Fields inherited from class freemarker.ext.servlet.FreemarkerServlet

      `INIT_PARAM_BUFFER_SIZE, INIT_PARAM_CLASSPATH_TLDS, INIT_PARAM_CONTENT_TYPE, INIT_PARAM_EXCEPTION_ON_MISSING_TEMPLATE, INIT_PARAM_META_INF_TLD_LOCATIONS, INIT_PARAM_NO_CACHE, INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE, INIT_PARAM_OVERRIDE_RESPONSE_LOCALE, INIT_PARAM_RESPONSE_CHARACTER_ENCODING, INIT_PARAM_TEMPLATE_PATH, INIT_PARAM_VALUE_ALWAYS, INIT_PARAM_VALUE_DO_NOT_SET, INIT_PARAM_VALUE_FORCE_PREFIX, INIT_PARAM_VALUE_FROM_TEMPLATE, INIT_PARAM_VALUE_LEGACY, INIT_PARAM_VALUE_NEVER, INIT_PARAM_VALUE_WHEN_TEMPLATE_HAS_MIME_TYPE, KEY_APPLICATION, KEY_APPLICATION_PRIVATE, KEY_INCLUDE, KEY_JSP_TAGLIBS, KEY_REQUEST, KEY_REQUEST_PARAMETERS, KEY_REQUEST_PRIVATE, KEY_SESSION, META_INF_TLD_LOCATION_CLASSPATH, META_INF_TLD_LOCATION_CLEAR, META_INF_TLD_LOCATION_WEB_INF_PER_LIB_JARS, SYSTEM_PROPERTY_CLASSPATH_TLDS, SYSTEM_PROPERTY_META_INF_TLD_SOURCES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FreemarkerDecoratorServlet()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected freemarker.template.Configuration` | `createConfiguration()` Deprecated. Create the instance of the freemarker Configuration object.
    `protected Locale` | `deduceLocale(String templatePath, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Deprecated. Returns the locale used for the `Configuration.getTemplate(String, Locale)` call.
    `void` | `doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Deprecated.
    `void` | `doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Deprecated.
    `void` | `init()` Deprecated.
    `protected boolean` | `preTemplateProcess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, freemarker.template.Template template, freemarker.template.TemplateModel templateModel)` Deprecated. Called before the execution is passed to template.process().

    - ### Methods inherited from class freemarker.ext.servlet.FreemarkerServlet

      `createDefaultClassPathTlds, createDefaultMetaInfTldSources, createDefaultObjectWrapper, createModel, createObjectWrapper, createRequestParametersHashModel, createTaglibFactory, createTemplateLoader, getConfiguration, getDefaultOverrideResponseContentType, getObjectWrapper, getTemplatePath, initializeServletContext, initializeSession, postTemplateProcess, preprocessRequest, processEnvironment, requestUrlToTemplatePath, setConfigurationDefaults`

    - ### Methods inherited from class javax.servlet.http.HttpServlet

      `doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service`

    - ### Methods inherited from class javax.servlet.GenericServlet

      `destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### serialVersionUID

          public static final long serialVersionUID

      Deprecated.
      See Also:
        Constant Field Values

    - #### freemarkerManager

          protected FreemarkerManager freemarkerManager

      Deprecated.

    - #### templatePath

          protected String templatePath

      Deprecated.

    - #### nocache

          protected boolean nocache

      Deprecated.

    - #### debug

          protected boolean debug

      Deprecated.

    - #### config

          protected freemarker.template.Configuration config

      Deprecated.

  - ### Constructor Detail

    - #### FreemarkerDecoratorServlet

          public FreemarkerDecoratorServlet()

      Deprecated.

  - ### Method Detail

    - #### init

          public void init()
                    throws javax.servlet.ServletException

      Deprecated.
      Overrides:
        `init` in class `freemarker.ext.servlet.FreemarkerServlet`
      Throws:
        `javax.servlet.ServletException`

    - #### doGet

          public void doGet(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws javax.servlet.ServletException,
                            IOException

      Deprecated.
      Overrides:
        `doGet` in class `freemarker.ext.servlet.FreemarkerServlet`
      Throws:
        `javax.servlet.ServletException`
        `IOException`

    - #### doPost

          public void doPost(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException

      Deprecated.
      Overrides:
        `doPost` in class `freemarker.ext.servlet.FreemarkerServlet`
      Throws:
        `javax.servlet.ServletException`
        `IOException`

    - #### deduceLocale

          protected Locale deduceLocale(String templatePath,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)

      Deprecated.
      Returns the locale used for the `Configuration.getTemplate(String, Locale)` call. The base implementation simply returns the locale setting of the configuration. Override this method to provide different behaviour, i.e. to use the locale indicated in the request.
      Overrides:
        `deduceLocale` in class `freemarker.ext.servlet.FreemarkerServlet`

    - #### createConfiguration

          protected freemarker.template.Configuration createConfiguration()

      Deprecated.

      Create the instance of the freemarker Configuration object.

      this implementation

      - obtains the default configuration from Configuration.getDefaultConfiguration()
      - sets up template loading from a ClassTemplateLoader and a WebappTemplateLoader
      - sets up the object wrapper to be the BeansWrapper
      - loads settings from the classpath file /freemarker.properties
      Overrides:
        `createConfiguration` in class `freemarker.ext.servlet.FreemarkerServlet`

    - #### preTemplateProcess

          protected boolean preTemplateProcess(javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.http.HttpServletResponse response,
                                               freemarker.template.Template template,
                                               freemarker.template.TemplateModel templateModel)
                                        throws javax.servlet.ServletException,
                                               IOException

      Deprecated.

      Called before the execution is passed to template.process(). This is a generic hook you might use in subclasses to perform a specific action before the template is processed. By default does nothing. A typical action to perform here is to inject application-specific objects into the model root

      Example: Expose the Serlvet context path as "baseDir" for all templates:

              ((SimpleHash) data).put("baseDir", request.getContextPath() + "/");
              return true;

      Overrides:
        `preTemplateProcess` in class `freemarker.ext.servlet.FreemarkerServlet`
      Parameters:
        `request` - the actual HTTP request
        `response` - the actual HTTP response
        `template` - the template that will get executed
      Returns:
        true to process the template, false to suppress template processing.
      Throws:
        `javax.servlet.ServletException`
        `IOException`
      See Also:
        `FreemarkerServlet.preTemplateProcess(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, freemarker.template.Template, freemarker.template.TemplateModel)`

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.