KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > modules > input > SessionModule


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

16
17 package org.apache.cocoon.components.modules.input;
18
19 import org.apache.avalon.framework.configuration.Configuration;
20 import org.apache.avalon.framework.thread.ThreadSafe;
21 import org.apache.cocoon.environment.ObjectModelHelper;
22
23 import java.util.Map JavaDoc;
24
25 /**
26  * SessionModule provides access to Session object properties.
27  * To get access to session properties use XPath syntax, e.g. to get the session
28  * id use <code>'id'</code> as the attribute name.<br/>
29  * More complex expressions with functions are also supported, e.g.:
30  * <pre>
31  * 'substring(id, 8)'
32  * </pre>
33  * will return the substring of id property of the session object.
34  * <strong>NOTE:</strong> The module does not create a new session.
35  *
36  * @author <a HREF="mailto:kpiroumian@apache.org">Konstantin Piroumian</a>
37  * @version CVS $Id: SessionModule.java 30932 2004-07-29 17:35:38Z vgritsenko $
38  */

39 public class SessionModule extends AbstractJXPathModule
40     implements ThreadSafe {
41
42     protected Object JavaDoc getContextObject(Configuration modeConf,
43                                       Map JavaDoc objectModel) {
44
45         return ObjectModelHelper.getRequest(objectModel).getSession(false);
46     }
47 }
48
Popular Tags