KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > tools > view > context > ViewContext


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 package org.apache.velocity.tools.view.context;
18
19 import org.apache.velocity.context.Context;
20
21 import javax.servlet.http.HttpServletRequest JavaDoc;
22 import javax.servlet.http.HttpServletResponse JavaDoc;
23 import javax.servlet.ServletContext JavaDoc;
24
25
26 /**
27  * <p>Objects implementing this interface are passed to view tools
28  * upon initialization by the
29  * {@link org.apache.velocity.tools.view.servlet.ServletToolboxManager}.</p>
30  *
31  * <p>The interface provides view tools in a servlet environment
32  * access to relevant context information, like servlet request, servlet
33  * context and the velocity context.</p>
34  *
35  * @author <a HREF="mailto:sidler@teamup.com">Gabe Sidler</a>
36  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
37  *
38  * @version $Id: ViewContext.java,v 1.6 2004/02/18 20:07:58 nbubna Exp $
39  */

40 public interface ViewContext
41 {
42     /** Key used for the HTTP request object. */
43     public static final String JavaDoc REQUEST = "request";
44
45     /** Key used for the HTTP response object. */
46     public static final String JavaDoc RESPONSE = "response";
47
48     /** Key used for the HTTP session object. */
49     public static final String JavaDoc SESSION = "session";
50
51     /** Key used for the servlet context object. */
52     public static final String JavaDoc APPLICATION = "application";
53
54     /** Key used for XHTML setting (tells tools and macros to output XHTML). */
55     public static final String JavaDoc XHTML = "XHTML";
56
57
58     /**
59      * <p>Returns the instance of {@link HttpServletRequest} for this request.</p>
60      */

61     public HttpServletRequest JavaDoc getRequest();
62
63
64     /**
65      * <p>Returns the instance of {@link HttpServletResponse} for this request.</p>
66      */

67     public HttpServletResponse JavaDoc getResponse();
68
69
70     /**
71      * <p>Returns the instance of {@link ServletContext} for this request.</p>
72      */

73     public ServletContext JavaDoc getServletContext();
74
75
76     /**
77      * <p>Searches for the named attribute in request, session (if valid),
78      * and application scope(s) in order and returns the value associated
79      * or null.</p>
80      *
81      * @since VelocityTools 1.1
82      */

83     public Object JavaDoc getAttribute(String JavaDoc key);
84
85
86     /**
87      * <p>Returns a reference to the current Velocity context.</p>
88      */

89     public Context getVelocityContext();
90
91 }
92
Popular Tags