1 55 56 package org.apache.commons.el; 57 58 import javax.servlet.jsp.PageContext ; 59 import javax.servlet.jsp.el.VariableResolver ; 60 import javax.servlet.jsp.el.ELException ; 61 62 71 72 public class VariableResolverImpl 73 implements VariableResolver 74 { 75 79 private PageContext mCtx; 80 81 86 public VariableResolverImpl (PageContext pCtx) 87 { 88 mCtx = pCtx; 89 } 90 91 97 public Object resolveVariable (String pName) 98 throws ELException 99 { 100 if ("pageContext".equals (pName)) { 102 return mCtx; 103 } 104 else if ("pageScope".equals (pName)) { 105 return ImplicitObjects. 106 getImplicitObjects (mCtx). 107 getPageScopeMap (); 108 } 109 else if ("requestScope".equals (pName)) { 110 return ImplicitObjects. 111 getImplicitObjects (mCtx). 112 getRequestScopeMap (); 113 } 114 else if ("sessionScope".equals (pName)) { 115 return ImplicitObjects. 116 getImplicitObjects (mCtx). 117 getSessionScopeMap (); 118 } 119 else if ("applicationScope".equals (pName)) { 120 return ImplicitObjects. 121 getImplicitObjects (mCtx). 122 getApplicationScopeMap (); 123 } 124 else if ("param".equals (pName)) { 125 return ImplicitObjects. 126 getImplicitObjects (mCtx). 127 getParamMap (); 128 } 129 else if ("paramValues".equals (pName)) { 130 return ImplicitObjects. 131 getImplicitObjects (mCtx). 132 getParamsMap (); 133 } 134 else if ("header".equals (pName)) { 135 return ImplicitObjects. 136 getImplicitObjects (mCtx). 137 getHeaderMap (); 138 } 139 else if ("headerValues".equals (pName)) { 140 return ImplicitObjects. 141 getImplicitObjects (mCtx). 142 getHeadersMap (); 143 } 144 else if ("initParam".equals (pName)) { 145 return ImplicitObjects. 146 getImplicitObjects (mCtx). 147 getInitParamMap (); 148 } 149 else if ("cookie".equals (pName)) { 150 return ImplicitObjects. 151 getImplicitObjects (mCtx). 152 getCookieMap (); 153 } 154 155 else { 157 return mCtx.findAttribute (pName); 158 } 159 } 160 161 } 163 | Popular Tags |