KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jdon > container > visitor > data > SessionContext


1 /*
2  * Copyright 2003-2006 the original author or authors.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  */

16 package com.jdon.container.visitor.data;
17
18 import java.util.HashMap JavaDoc;
19 import java.util.Map JavaDoc;
20
21 /**
22  * this class inlude those datas that read from the web container or others.
23  * these datas is stateful, and it's scope is one instance per client.
24  * usually they are saved in httpSession of the web container.
25  *
26  * but these datas are different from the components that saved in httpsession.
27  * it is like the stateful components. it include state data.
28  *
29  * the way of visiting the SessionContext that saved in httpSession
30  *
31  * targetMetaRequest.setVisitableName(ComponentKeys.SESSIONCONTEXT_FACTORY);
32  * SessionContext sessionContext = (SessionContext)cm.visit(targetMetaRequest);
33  *
34
35  *
36  * @author <a HREF="mailto:banqiao@jdon.com">banq</a>
37  *
38  */

39
40 public class SessionContext {
41     public final static String JavaDoc NAME = SessionContext.class.getName();
42     
43     private Map JavaDoc arrtibutes = new HashMap JavaDoc();
44     
45     public void setArrtibute(String JavaDoc key, Object JavaDoc object){
46         arrtibutes.put(key, object);
47     }
48     
49     public Object JavaDoc getArrtibute(String JavaDoc key){
50         return arrtibutes.get(key);
51     }
52     
53     public void remove(String JavaDoc key){
54         arrtibutes.remove(key);
55     }
56     
57     public void removeAll(){
58         arrtibutes.clear();
59     }
60     
61     
62 }
63
Popular Tags