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 VelocityDecoratorServlet

    java.lang.Object
      javax.servlet.GenericServlet
          javax.servlet.http.HttpServlet
              org.apache.velocity.tools.view.servlet.VelocityViewServlet
                  org.apache.struts2.sitemesh.VelocityDecoratorServlet

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

    public class VelocityDecoratorServlet

extends org.apache.velocity.tools.view.servlet.VelocityViewServlet

This is a SiteMesh Velocity view servlet.

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

See Also:
  Serialized Form

Field Summary
`protected String` | `defaultContentType`
`protected VelocityManager` | `velocityManager`

Fields inherited from class org.apache.velocity.tools.view.servlet.VelocityViewServlet
`CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, DEFAULT_PROPERTIES_PATH, DEFAULT_TOOLBOX_PATH, DEFAULT_TOOLS_PROPERTIES, INIT_PROPS_KEY, SERVLET_CONTEXT_KEY, TOOLBOX_KEY, toolboxManager`

Constructor Summary
`VelocityDecoratorServlet()`

Method Summary
`protected org.apache.velocity.context.Context` | `createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Creates and returns an initialized Velocity context.
`org.apache.velocity.Template` | `handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.velocity.context.Context context)`
`void` | `init(javax.servlet.ServletConfig config)` Initializes servlet, toolbox and Velocity template engine.
`protected void` | `setContentType(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Sets the content type of the response.

Methods inherited from class org.apache.velocity.tools.view.servlet.VelocityViewServlet
`doGet, doPost, doRequest, error, findInitParameter, getResponseWriter, getTemplate, getTemplate, getVelocityEngine, getVelocityProperty, initToolbox, initVelocity, loadConfiguration, mergeTemplate, performMerge, requestCleanup, setVelocityEngine`

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

### velocityManager

    protected VelocityManager velocityManager

### defaultContentType

    protected String defaultContentType

Constructor Detail

### VelocityDecoratorServlet

    public VelocityDecoratorServlet()

Method Detail

### init

    public void init(javax.servlet.ServletConfig config)
              throws javax.servlet.ServletException

  Initializes servlet, toolbox and Velocity template engine. Called by the servlet container on loading.

  NOTE: If no charset is specified in the default.contentType property (in your velocity.properties) and you have specified an output.encoding property, then that will be used as the charset for the default content-type of pages served by this servlet.

  Specified by:
    `init` in interface `javax.servlet.Servlet`
  Overrides:
    `init` in class `org.apache.velocity.tools.view.servlet.VelocityViewServlet`
  Parameters:
    `config` - servlet configuation
  Throws:
    `javax.servlet.ServletException`

### handleRequest

    public org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest request,
                                                      javax.servlet.http.HttpServletResponse response,
                                                      org.apache.velocity.context.Context context)
                                               throws Exception

  Overrides:
    `handleRequest` in class `org.apache.velocity.tools.view.servlet.VelocityViewServlet`
  Throws:
    `Exception`

### createContext

    protected org.apache.velocity.context.Context createContext(javax.servlet.http.HttpServletRequest request,
                                                                javax.servlet.http.HttpServletResponse response)

  Creates and returns an initialized Velocity context.

  Overrides:
    `createContext` in class `org.apache.velocity.tools.view.servlet.VelocityViewServlet`
  Parameters:
    `request` - servlet request from client
    `response` - servlet reponse to client

### setContentType

    protected void setContentType(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)

  Sets the content type of the response. This is available to be overriden by a derived class.

  The default implementation is :

          response.setContentType(defaultContentType);

  where defaultContentType is set to the value of the default.contentType property, or "text/html" if that is not set.

  Overrides:
    `setContentType` in class `org.apache.velocity.tools.view.servlet.VelocityViewServlet`
  Parameters:
    `request` - servlet request from client
    `response` - servlet reponse to client

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–2018 Apache Software Foundation. All rights reserved.