cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 7868] - [PATCH] protected createCocoon() in CocoonServlet
Date Mon, 15 Apr 2002 12:44:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7868>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7868

[PATCH] protected createCocoon() in CocoonServlet





------- Additional Comments From bloritsch@apache.org  2002-04-15 12:44 -------
The Context object is like a Map (in fact the underlying implementation is just
that: a Map).  As long as the components have a reference to the *same* context
object, the values will automatically be updated.  Try this to veryfy:

class Main
{
    public static void main(String[] args)
    {
        HashMap myMap = new HashMap();

        Test test1 = new Test(myMap);

        myMap.put ("key", "value");

        Test test2 = new Test(myMap);

        myMap.put ("test2", "value2");

        System.out.println("Outputing Test1");
        test1.dump();

        System.out.println();
        System.out.println("Outputing Test2");
        test2.dump();
    }
}

class Test
{
     HashMap theMap;

     public Test(HashMap map)
     {
         theMap = map;
     }

     public void dump()
     {
         Iterator i = theMap.keySet.iterator();
         while (i.hasNext())
         {
             Object key = i.next();
             System.out.println( key + " = " theMap.get( key );
         }
     }
}


When executed you should get the same results for both Test1 and Test2
(BTW, you may have to adjust my typing a little--I programmed from memory).

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message