1 16 package org.apache.commons.chain.web.portlet; 17 18 19 import java.util.Collections ; 20 import java.util.Map ; 21 import javax.portlet.PortletContext; 22 import javax.portlet.PortletRequest; 23 import javax.portlet.PortletResponse; 24 import org.apache.commons.chain.web.WebContext; 25 26 27 36 37 public class PortletWebContext extends WebContext { 38 39 40 42 43 46 public PortletWebContext() { 47 48 ; 49 50 } 51 52 53 61 public PortletWebContext(PortletContext context, 62 PortletRequest request, 63 PortletResponse response) { 64 65 initialize(context, request, response); 66 67 } 68 69 70 72 73 77 private Map applicationScope = null; 78 79 80 83 protected PortletContext context = null; 84 85 86 90 private Map header = null; 91 92 93 97 private Map headerValues = null; 98 99 100 104 private Map initParam = null; 105 106 107 111 private Map param = null; 112 113 114 118 private Map paramValues = null; 119 120 121 124 protected PortletRequest request = null; 125 126 127 131 private Map requestScope = null; 132 133 134 137 protected PortletResponse response = null; 138 139 140 144 private Map sessionScope = null; 145 146 147 149 150 153 public PortletContext getContext() { 154 155 return (this.context); 156 157 } 158 159 160 163 public PortletRequest getRequest() { 164 165 return (this.request); 166 167 } 168 169 170 173 public PortletResponse getResponse() { 174 175 return (this.response); 176 177 } 178 179 180 188 public void initialize(PortletContext context, 189 PortletRequest request, 190 PortletResponse response) { 191 192 this.context = context; 194 this.request = request; 195 this.response = response; 196 197 199 } 200 201 202 208 public void release() { 209 210 applicationScope = null; 212 header = null; 213 headerValues = null; 214 initParam = null; 215 param = null; 216 paramValues = null; 217 requestScope = null; 218 sessionScope = null; 219 220 context = null; 222 request = null; 223 response = null; 224 225 } 226 227 228 229 231 232 public Map getApplicationScope() { 233 234 if ((applicationScope == null) && (context != null)) { 235 applicationScope = new PortletApplicationScopeMap(context); 236 } 237 return (applicationScope); 238 239 } 240 241 242 public Map getHeader() { 243 244 if ((header == null) && (request != null)) { 245 header = Collections.EMPTY_MAP; 247 } 248 return (header); 249 250 } 251 252 253 public Map getHeaderValues() { 254 255 if ((headerValues == null) && (request != null)) { 256 headerValues = Collections.EMPTY_MAP; 258 } 259 return (headerValues); 260 261 } 262 263 264 public Map getInitParam() { 265 266 if ((initParam == null) && (context != null)) { 267 initParam = new PortletInitParamMap(context); 268 } 269 return (initParam); 270 271 } 272 273 274 public Map getParam() { 275 276 if ((param == null) && (request != null)) { 277 param = new PortletParamMap(request); 278 } 279 return (param); 280 281 } 282 283 284 public Map getParamValues() { 285 286 if ((paramValues == null) && (request != null)) { 287 paramValues = new PortletParamValuesMap(request); 288 } 289 return (paramValues); 290 291 } 292 293 294 public Map getRequestScope() { 295 296 if ((requestScope == null) && (request != null)) { 297 requestScope = new PortletRequestScopeMap(request); 298 } 299 return (requestScope); 300 301 } 302 303 304 public Map getSessionScope() { 305 306 if ((sessionScope == null) && (request != null)) { 307 sessionScope = 308 new PortletSessionScopeMap(request.getPortletSession()); 309 } 310 return (sessionScope); 311 312 } 313 314 315 316 } 317 | Popular Tags |