Coverage Report - org.apache.commons.el.VariableResolverImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
VariableResolverImpl
0%
0/26
0%
0/22
12
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.commons.el;
 18  
 
 19  
 import javax.servlet.jsp.PageContext;
 20  
 import javax.servlet.jsp.el.ELException;
 21  
 import javax.servlet.jsp.el.VariableResolver;
 22  
 
 23  
 /**
 24  
  *
 25  
  * <p>This is the JSTL-specific implementation of VariableResolver.
 26  
  * It looks up variable references in the PageContext, and also
 27  
  * recognizes references to implicit objects.
 28  
  * 
 29  
  * @author Nathan Abramson - Art Technology Group
 30  
  * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: mbenson $
 31  
  **/
 32  
 
 33  
 public class VariableResolverImpl
 34  
   implements VariableResolver
 35  
 {
 36  
   //-------------------------------------
 37  
   // Member variables
 38  
   //-------------------------------------
 39  
 
 40  
   private PageContext mCtx;
 41  
 
 42  
   //-------------------------------------
 43  
   /**
 44  
    *
 45  
    * Constructor
 46  
    **/
 47  
   public VariableResolverImpl (PageContext pCtx)
 48  0
   {
 49  0
     mCtx = pCtx;
 50  0
   }
 51  
   
 52  
   //-------------------------------------
 53  
   /**
 54  
    *
 55  
    * Resolves the specified variable within the given context.
 56  
    * Returns null if the variable is not found.
 57  
    **/
 58  
   public Object resolveVariable (String pName)
 59  
     throws ELException
 60  
   {
 61  
     // Check for implicit objects
 62  0
     if ("pageContext".equals (pName)) {
 63  0
       return mCtx;
 64  
     }
 65  0
     else if ("pageScope".equals (pName)) {
 66  0
       return ImplicitObjects.
 67  
         getImplicitObjects (mCtx).
 68  
         getPageScopeMap ();
 69  
     }
 70  0
     else if ("requestScope".equals (pName)) {
 71  0
       return ImplicitObjects.
 72  
         getImplicitObjects (mCtx).
 73  
         getRequestScopeMap ();
 74  
     }
 75  0
     else if ("sessionScope".equals (pName)) {
 76  0
       return ImplicitObjects.
 77  
         getImplicitObjects (mCtx).
 78  
         getSessionScopeMap ();
 79  
     }
 80  0
     else if ("applicationScope".equals (pName)) {
 81  0
       return ImplicitObjects.
 82  
         getImplicitObjects (mCtx).
 83  
         getApplicationScopeMap ();
 84  
     }
 85  0
     else if ("param".equals (pName)) {
 86  0
       return ImplicitObjects.
 87  
         getImplicitObjects (mCtx).
 88  
         getParamMap ();
 89  
     }
 90  0
     else if ("paramValues".equals (pName)) {
 91  0
       return ImplicitObjects.
 92  
         getImplicitObjects (mCtx).
 93  
         getParamsMap ();
 94  
     }
 95  0
     else if ("header".equals (pName)) {
 96  0
       return ImplicitObjects.
 97  
         getImplicitObjects (mCtx).
 98  
         getHeaderMap ();
 99  
     }
 100  0
     else if ("headerValues".equals (pName)) {
 101  0
       return ImplicitObjects.
 102  
         getImplicitObjects (mCtx).
 103  
         getHeadersMap ();
 104  
     }
 105  0
     else if ("initParam".equals (pName)) {
 106  0
       return ImplicitObjects.
 107  
         getImplicitObjects (mCtx).
 108  
         getInitParamMap ();
 109  
     }
 110  0
     else if ("cookie".equals (pName)) {
 111  0
       return ImplicitObjects.
 112  
         getImplicitObjects (mCtx).
 113  
         getCookieMap ();
 114  
     }
 115  
 
 116  
     // Otherwise, just look it up in the page context
 117  
     else {
 118  0
       return mCtx.findAttribute (pName);
 119  
     }
 120  
   }
 121  
                                         
 122  
   //-------------------------------------
 123  
 }