Overview | 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.tiles.velocity.context
Class VelocityUtil

    java.lang.Object
      org.apache.tiles.velocity.context.VelocityUtil

    public final class VelocityUtil

extends java.lang.Object

Utilities for Velocity usage in Tiles.

Since:
  2.2.0
Version:
  $Rev: 902965 $ $Date: 2010-01-25 21:12:46 +0100 (lun, 25 gen 2010) $

Field Summary
`static org.apache.velocity.runtime.Renderable` | `EMPTY_RENDERABLE` A renderable object that does not render anything.

Method Summary
`static void` | `evaluateBody(org.apache.velocity.context.InternalContextAdapter context, java.io.Writer writer, org.apache.velocity.runtime.parser.node.Node node)` Evaluates the body writing in the passed writer.
`static java.lang.String` | `getBodyAsString(org.apache.velocity.context.InternalContextAdapter context, org.apache.velocity.runtime.parser.node.Node node)` Evaluates the body (child node at position 1) and returns it as a string.
`static java.util.Map<java.lang.String,java.lang.Object>` | `getParameters(org.apache.velocity.context.InternalContextAdapter context, org.apache.velocity.runtime.parser.node.Node node)` Extracts the parameters from the directives, by getting the child at position 0 supposing it is a map.
`static ArrayStack<java.util.Map<java.lang.String,java.lang.Object>>` | `getParameterStack(org.apache.velocity.context.Context context)` Deprecated. Use Velocity directives.
`static void` | `setAttribute(org.apache.velocity.context.Context velocityContext, javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext, java.lang.String name, java.lang.Object obj, java.lang.String scope)` Sets an attribute in the desired scope.
`static boolean` | `toSimpleBoolean(java.lang.Boolean obj, boolean defaultValue)` Null-safe conversion from Boolean to boolean.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY_RENDERABLE

    public static final org.apache.velocity.runtime.Renderable EMPTY_RENDERABLE

  A renderable object that does not render anything.

  Since:
    2.2.0

Method Detail

### toSimpleBoolean

    public static boolean toSimpleBoolean(java.lang.Boolean obj,
                                          boolean defaultValue)

  Null-safe conversion from Boolean to boolean.

  Parameters:
    `obj` - The Boolean object.
    `defaultValue` - This value will be returned if `obj` is null.
  Returns:
    The boolean value of `obj` or, if null, `defaultValue`.
  Since:
    2.2.0

### getParameterStack

    @Deprecated
    public static ArrayStack<java.util.Map<java.lang.String,java.lang.Object>> getParameterStack(org.apache.velocity.context.Context context)

  Deprecated. Use Velocity directives.

  Returns or creates the parameter stack to use. It is useful to store parameters across tool calls.

  Parameters:
    `context` - The Velocity context.
  Returns:
    The parameter stack.
  Since:
    2.2.0

### setAttribute

    public static void setAttribute(org.apache.velocity.context.Context velocityContext,
                                    javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.ServletContext servletContext,
                                    java.lang.String name,
                                    java.lang.Object obj,
                                    java.lang.String scope)

  Sets an attribute in the desired scope.

  Parameters:
    `velocityContext` - The Velocity context.
    `request` - The HTTP request.
    `servletContext` - The servlet context.
    `name` - The name of the attribute.
    `obj` - The value of the attribute.
    `scope` - The scope. It can be `page`, `request` , `session`, `application`.
  Since:
    2.2.0

### getBodyAsString

    public static java.lang.String getBodyAsString(org.apache.velocity.context.InternalContextAdapter context,
                                                   org.apache.velocity.runtime.parser.node.Node node)
                                            throws java.io.IOException

  Evaluates the body (child node at position 1) and returns it as a string.

  Parameters:
    `context` - The Velocity context.
    `node` - The node to use.
  Returns:
    The evaluated body.
  Throws:
    `java.io.IOException` - If something goes wrong.
  Since:
    2.2.2

### evaluateBody

    public static void evaluateBody(org.apache.velocity.context.InternalContextAdapter context,
                                    java.io.Writer writer,
                                    org.apache.velocity.runtime.parser.node.Node node)
                             throws java.io.IOException

  Evaluates the body writing in the passed writer.

  Parameters:
    `context` - The Velocity context.
    `writer` - The writer to write into.
    `node` - The node to use.
  Throws:
    `java.io.IOException` - If something goes wrong.
  Since:
    2.2.2

### getParameters

    public static java.util.Map<java.lang.String,java.lang.Object> getParameters(org.apache.velocity.context.InternalContextAdapter context,
                                                                                 org.apache.velocity.runtime.parser.node.Node node)

  Extracts the parameters from the directives, by getting the child at position 0 supposing it is a map.

  Parameters:
    `context` - The Velocity context.
    `node` - The node to use.
  Returns:
    The extracted parameters.
  Since:
    2.2.2

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

Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.