Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BDCC49EB1 for ; Thu, 19 Jul 2012 11:43:28 +0000 (UTC) Received: (qmail 96891 invoked by uid 500); 19 Jul 2012 11:43:27 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 96553 invoked by uid 500); 19 Jul 2012 11:43:27 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 96527 invoked by uid 99); 19 Jul 2012 11:43:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jul 2012 11:43:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jul 2012 11:43:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 97237238897F for ; Thu, 19 Jul 2012 11:43:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1363305 [3/3] - in /commons/proper/chain/trunk: apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/ apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/agility/impl/ apps/cookbook-examples/s... Date: Thu, 19 Jul 2012 11:42:55 -0000 To: commits@commons.apache.org From: simonetripodi@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120719114302.97237238897F@eris.apache.org> Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java?rev=1363305&r1=1363304&r2=1363305&view=diff ============================================================================== --- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java (original) +++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ServletWebContext.java Thu Jul 19 11:42:53 2012 @@ -16,7 +16,6 @@ */ package org.apache.commons.chain2.web.servlet; - import org.apache.commons.chain2.web.WebContext; import javax.servlet.ServletContext; @@ -25,7 +24,6 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import java.util.Map; - /** *

Concrete implementation of {@link WebContext} suitable for use in * Servlets and JSP pages. The abstract methods are mapped to the appropriate @@ -34,22 +32,18 @@ import java.util.Map; * * @version $Id$ */ - public class ServletWebContext extends WebContext { private static final long serialVersionUID = 5852676730841544890L; - // ------------------------------------------------------------ Constructors - /** *

Construct an uninitialized {@link ServletWebContext} instance.

*/ public ServletWebContext() { } - /** *

Construct a {@link ServletWebContext} instance that is initialized * with the specified Servlet API objects.

@@ -61,134 +55,108 @@ public class ServletWebContext extends W public ServletWebContext(ServletContext context, HttpServletRequest request, HttpServletResponse response) { - initialize(context, request, response); - } - // ------------------------------------------------------ Instance Variables - /** *

The lazily instantiated Map of application scope * attributes.

*/ private Map applicationScope = null; - /** *

The ServletContext for this web application.

*/ private ServletContext context = null; - /** *

The lazily instantiated Map of header name-value * combinations (immutable).

*/ private Map header = null; - /** *

The lazily instantitated Map of header name-values * combinations (immutable).

*/ private Map headerValues = null; - /** *

The lazily instantiated Map of context initialization * parameters.

*/ private Map initParam = null; - /** *

The lazily instantiated Map of cookies.

*/ private Map cookieValues = null; - /** *

The lazily instantiated Map of request * parameter name-value.

*/ private Map param = null; - /** *

The lazily instantiated Map of request * parameter name-values.

*/ private Map paramValues = null; - /** *

The HttpServletRequest for this request.

*/ private HttpServletRequest request = null; - /** *

The lazily instantiated Map of request scope * attributes.

*/ private Map requestScope = null; - /** *

The HttpServletResponse for this request.

*/ private HttpServletResponse response = null; - /** *

The lazily instantiated Map of session scope * attributes.

*/ private Map sessionScope = null; - // ---------------------------------------------------------- Public Methods - /** *

Return the {@link ServletContext} for this context.

* * @return The ServletContext for this context. */ public ServletContext getContext() { - - return (this.context); - + return (this.context); } - /** *

Return the {@link HttpServletRequest} for this context.

* * @return The HttpServletRequest for this context. */ public HttpServletRequest getRequest() { - - return (this.request); - + return (this.request); } - /** *

Return the {@link HttpServletResponse} for this context.

* * @return The HttpServletResponse for this context. */ public HttpServletResponse getResponse() { - - return (this.response); - + return (this.response); } - /** *

Initialize (or reinitialize) this {@link ServletWebContext} instance * for the specified Servlet API objects.

@@ -200,17 +168,14 @@ public class ServletWebContext extends W public void initialize(ServletContext context, HttpServletRequest request, HttpServletResponse response) { - // Save the specified Servlet API object references this.context = context; this.request = request; this.response = response; // Perform other setup as needed - } - /** *

Release references to allocated resources acquired in * initialize() of via subsequent processing. After this @@ -218,7 +183,6 @@ public class ServletWebContext extends W * initialize() will return undefined results.

*/ public void release() { - // Release references to allocated collections applicationScope = null; header = null; @@ -234,104 +198,82 @@ public class ServletWebContext extends W context = null; request = null; response = null; - } - - // ------------------------------------------------------ WebContext Methods - /** * See the {@link WebContext}'s Javadoc. * * @return Application scope Map. */ public Map getApplicationScope() { - if ((applicationScope == null) && (context != null)) { applicationScope = new ServletApplicationScopeMap(context); } return (applicationScope); - } - /** * See the {@link WebContext}'s Javadoc. * * @return Header values Map. */ public Map getHeader() { - if ((header == null) && (request != null)) { header = new ServletHeaderMap(request); } return (header); - } - /** * See the {@link WebContext}'s Javadoc. * * @return Header values Map. */ public Map getHeaderValues() { - if ((headerValues == null) && (request != null)) { headerValues = new ServletHeaderValuesMap(request); } return (headerValues); - } - /** * See the {@link WebContext}'s Javadoc. * * @return Initialization parameter Map. */ public Map getInitParam() { - if ((initParam == null) && (context != null)) { initParam = new ServletInitParamMap(context); } return (initParam); - } - /** * See the {@link WebContext}'s Javadoc. * * @return Request parameter Map. */ public Map getParam() { - if ((param == null) && (request != null)) { param = new ServletParamMap(request); } return (param); - } - /** * See the {@link WebContext}'s Javadoc. * * @return Request parameter Map. */ public Map getParamValues() { - if ((paramValues == null) && (request != null)) { paramValues = new ServletParamValuesMap(request); } return (paramValues); - } - /** * See the {@link WebContext}'s Javadoc. * @@ -339,27 +281,22 @@ public class ServletWebContext extends W * @since Chain 1.1 */ public Map getCookies() { - if ((cookieValues == null) && (request != null)) { cookieValues = new ServletCookieMap(request); } return (cookieValues); - } - /** * See the {@link WebContext}'s Javadoc. * * @return Request scope Map. */ public Map getRequestScope() { - if ((requestScope == null) && (request != null)) { requestScope = new ServletRequestScopeMap(request); } return (requestScope); - } @@ -369,13 +306,10 @@ public class ServletWebContext extends W * @return Session scope Map. */ public Map getSessionScope() { - if ((sessionScope == null) && (request != null)) { sessionScope = new ServletSessionScopeMap(request); } return (sessionScope); - } - }