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 2003/07/31 00:02:54 UTC
cvs commit: jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/context ChainedContext.java
nbubna 2003/07/30 15:02:54
Modified: src/java/org/apache/velocity/tools/view/context
ChainedContext.java
Log:
move req/res/sess/app keys to ViewContext and add getAttribute method
Revision Changes Path
1.4 +14 -23 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ChainedContext.java 28 May 2003 00:17:16 -0000 1.3
+++ ChainedContext.java 30 Jul 2003 22:02:54 -0000 1.4
@@ -129,26 +129,6 @@
*/
private ToolboxContext toolboxContext = null;
- /**
- * Key to the HTTP request object.
- */
- public static final String REQUEST = "request";
-
- /**
- * Key to the HTTP response object.
- */
- public static final String RESPONSE = "response";
-
- /**
- * Key to the HTTP session object.
- */
- public static final String SESSION = "session";
-
- /**
- * Key to the servlet context object.
- */
- public static final String APPLICATION = "application";
-
/**
* Default constructor.
@@ -231,7 +211,18 @@
}
// if not found, wander down the scopes...
- o = request.getAttribute(key);
+ return getAttribute(key);
+ }
+
+
+ /**
+ * <p>Searches for the named attribute in request, session (if valid),
+ * and application scope(s) in order and returns the value associated
+ * or null.</p>
+ */
+ public Object getAttribute(String key)
+ {
+ Object o = request.getAttribute(key);
if (o == null)
{
if (session != null)
@@ -239,7 +230,7 @@
o = session.getAttribute(key);
}
- if ( o == null )
+ if (o == null)
{
o = application.getAttribute(key);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org