You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by nb...@apache.org on 2004/04/15 22:25:34 UTC

cvs commit: jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/context ChainedContext.java

nbubna      2004/04/15 13:25:34

  Modified:    src/java/org/apache/velocity/tools/view/context
                        ChainedContext.java
  Log:
  style/format tweaks only
  
  Revision  Changes    Path
  1.7       +23 -49    jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/context/ChainedContext.java
  
  Index: ChainedContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/context/ChainedContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ChainedContext.java	18 Feb 2004 20:07:58 -0000	1.6
  +++ ChainedContext.java	15 Apr 2004 20:25:34 -0000	1.7
  @@ -18,14 +18,13 @@
   
   import java.util.HashMap;
   
  -import org.apache.velocity.VelocityContext;
  -import org.apache.velocity.context.Context;
  -
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
   import javax.servlet.ServletContext;
   
  +import org.apache.velocity.VelocityContext;
  +import org.apache.velocity.context.Context;
   
   /**
    * <p>Velocity context implementation specific to the Servlet environment.</p>
  @@ -66,41 +65,22 @@
   public class ChainedContext extends VelocityContext implements ViewContext
   {
   
  -    /**
  -     * A local reference to the current servlet request.
  -     */ 
  +    /* the current toolbox, request, response, and session */
  +    private ToolboxContext toolboxContext;
       private HttpServletRequest request;
  -    
  -    /**
  -     * A local reference to the current servlet response.
  -     */
       private HttpServletResponse response;
  -    
  -    /**
  -     * A local reference to the servlet session.
  -     */
       private HttpSession session;
  -    
  -    /**
  -     * A local reference to the servlet context.
  -     */
  -    private ServletContext application;
   
  -    /**
  -     * The toolbox. 
  -     */ 
  -    private ToolboxContext toolboxContext = null;
  +    /* the servlet context */
  +    private ServletContext application;
   
   
  -    /**
  -     * Default constructor.
  -     */
  -    public ChainedContext(Context ctx, 
  +    public ChainedContext(Context ctx,
                             HttpServletRequest request,
                             HttpServletResponse response,
                             ServletContext application)
       {
  -        super(null, ctx );
  +        super(null, ctx);
   
           this.request = request;
           this.response = response;
  @@ -116,28 +96,26 @@
        */
       public void setToolbox(ToolboxContext box)
       {
  -        toolboxContext = box;
  -        // just in case the servlet toolbox manager
  -        // had to create a new session to hold session tools
  -        // let's make sure this context's session ref is current
  -        session = request.getSession(false);
  +        this.toolboxContext = box;
  +        /* just in case the servlet toolbox manager
  +         * had to create a new session to hold session tools
  +         * let's make sure this context's session ref is current */
  +        this.session = request.getSession(false);
       }
   
   
       /**
        * <p>Looks up and returns the object with the specified key.</p>
  -     * 
        * <p>See the class documentation for more details.</p>
        *
        * @param key the key of the object requested
  -     * 
        * @return the requested object or null if not found
        */
       public Object internalGet( String key )
       {
           Object o = null;
   
  -        // search the toolbox
  +        /* search the toolbox */
           if (toolboxContext != null)
           {
               o = toolboxContext.get(key);
  @@ -147,32 +125,32 @@
               }
           }
   
  -        // make the four scopes of the Apocalypse Read only
  -        if ( key.equals( REQUEST ))
  +        /* make the four scopes of the Apocalypse Read only */
  +        if (key.equals(REQUEST))
           {
               return request;
           }
  -        else if( key.equals(RESPONSE) )
  +        else if(key.equals(RESPONSE))
           {
               return response;
           }
  -        else if ( key.equals(SESSION) )
  +        else if (key.equals(SESSION))
           {
               return session;
           }
  -        else if ( key.equals(APPLICATION))
  +        else if (key.equals(APPLICATION))
           {
               return application;
           }
   
  -        // try the local hashtable
  +        /* try the local hashtable */
           o = super.internalGet(key);
           if (o != null)
           {
               return o;
           }
   
  -        // if not found, wander down the scopes...
  +        /* if not found, wander down the scopes... */
           return getAttribute(key);
       }
   
  @@ -211,7 +189,6 @@
           return request;
       }
   
  -
       /**
        * <p>Returns the current servlet response.</p>
        */
  @@ -220,7 +197,6 @@
           return response;
       }
   
  -
       /**
        * <p>Returns the servlet context.</p>
        */
  @@ -229,7 +205,6 @@
           return application;
       }
   
  -
       /**
        * <p>Returns a reference to the Velocity context (this object).</p>
        */
  @@ -238,5 +213,4 @@
           return this;
       }
   
  -
  -}  // ChainedContext
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org