KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > tools > view > servlet > ServletToolInfo


1 /*
2  * Copyright 2003 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
18 package org.apache.velocity.tools.view.servlet;
19
20
21 import org.apache.velocity.tools.view.ViewToolInfo;
22 import org.apache.velocity.tools.view.context.ViewContext;
23
24
25 /**
26  * <p>ToolInfo implementation that holds scope information for tools
27  * used in a servlet environment. The ServletToolboxManager uses
28  * this to allow tool definitions to specify the scope/lifecycle
29  * of individual view tools.</p>
30  *
31  * <p>Example of toolbox.xml definitions for servlet tools:<pre>
32  * &lt;tool&gt;
33  * &lt;key&gt;link&lt;/key&gt;
34  * &lt;scope&gt;request&lt;/scope&gt;
35  * &lt;class&gt;org.apache.velocity.tools.struts.StrutsLinkTool&lt;/class&gt;
36  * &lt;/tool&gt;
37  * &lt;tool&gt;
38  * &lt;key&gt;math&lt;/key&gt;
39  * &lt;scope&gt;application&lt;/scope&gt;
40  * &lt;class&gt;org.apache.velocity.tools.generic.MathTool&lt;/class&gt;
41  * &lt;/tool&gt;
42  * &lt;tool&gt;
43  * &lt;key&gt;user&lt;/key&gt;
44  * &lt;scope&gt;session&lt;/scope&gt;
45  * &lt;class&gt;com.mycompany.tools.MyUserTool&lt;/class&gt;
46  * &lt;/tool&gt;
47  * </pre></p>
48  *
49  * @author <a HREF="mailto:nathan@esha.com">Nathan Bubna</a>
50  *
51  * @version $Id: ServletToolInfo.java,v 1.6 2004/02/18 20:07:02 nbubna Exp $
52  */

53 public class ServletToolInfo extends ViewToolInfo
54 {
55
56     /** @deprecated use ViewContext.REQUEST */
57     public static final String JavaDoc REQUEST_SCOPE = ViewContext.REQUEST;
58     /** @deprecated use ViewContext.SESSION */
59     public static final String JavaDoc SESSION_SCOPE = ViewContext.SESSION;
60     /** @deprecated use ViewContext.APPLICATION */
61     public static final String JavaDoc APPLICATION_SCOPE = ViewContext.APPLICATION;
62         
63     private String JavaDoc scope;
64
65
66     public ServletToolInfo() {}
67
68
69     public void setScope(String JavaDoc scope) {
70         this.scope = scope;
71     }
72
73
74     /**
75      * @return the scope of the tool
76      */

77     public String JavaDoc getScope()
78     {
79         return scope;
80     }
81
82 }
83
Popular Tags