org.jpublish
Class JPublishContext

java.lang.Object
  |
  +--org.apache.velocity.context.InternalContextBase
        |
        +--org.apache.velocity.context.AbstractContext
              |
              +--org.apache.velocity.VelocityContext
                    |
                    +--org.jpublish.JPublishContext
All Implemented Interfaces:
java.lang.Cloneable, org.apache.velocity.context.Context, org.apache.velocity.context.InternalEventContext, org.apache.velocity.context.InternalHousekeepingContext, java.io.Serializable

public final class JPublishContext
extends org.apache.velocity.VelocityContext

The JPublishContext overrides the Velocity context to add name checking as a security measure so that code cannot replace standard variables.

Author:
Anthony Eden
See Also:
Serialized Form

Constructor Summary
JPublishContext(java.lang.Object owner)
           
 
Method Summary
 void disableCheckReservedNames(java.lang.Object owner)
           
 void enableCheckReservedNames(java.lang.Object owner)
          Enable the reserved name check so that external code cannot overwrite JPublish defined variables.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Put the given value into the context.
 java.lang.Object remove(java.lang.String key)
          Remove the given value from the context.
 
Methods inherited from class org.apache.velocity.VelocityContext
clone, internalContainsKey, internalGet, internalGetKeys, internalPut, internalRemove
 
Methods inherited from class org.apache.velocity.context.AbstractContext
attachEventCartridge, containsKey, get, getChainedContext, getCurrentResource, getCurrentTemplateName, getEventCartridge, getKeys, getTemplateNameStack, icacheGet, icachePut, popCurrentTemplateName, pushCurrentTemplateName, remove, setCurrentResource
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPublishContext

public JPublishContext(java.lang.Object owner)
Method Detail

put

public final java.lang.Object put(java.lang.String key,
                                  java.lang.Object value)
Put the given value into the context. If the key cannot be inserted into the context because it conflicts with a reserved name then a ReservedNameException will be thrown.
Overrides:
put in class org.apache.velocity.context.AbstractContext
Parameters:
key - The key
value - The value
Returns:
The previous value or null if there was no previous value

remove

public final java.lang.Object remove(java.lang.String key)
Remove the given value from the context. If the key cannot be removed from the context because it is a reserved name then a ReservedNameException will be thrown.
Parameters:
key - The key
Returns:
The removed value or null if there was no removed value

enableCheckReservedNames

public final void enableCheckReservedNames(java.lang.Object owner)
Enable the reserved name check so that external code cannot overwrite JPublish defined variables.
Parameters:
owner - The owner of the context. Only the owner can

disableCheckReservedNames

public final void disableCheckReservedNames(java.lang.Object owner)


Copyright (C) 2001 Anthony Eden. All Rights Reserved.