KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > script > http > HttpScriptContext


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package javax.script.http;
31
32 import javax.script.ScriptContext;
33 import javax.servlet.Servlet JavaDoc;
34 import javax.servlet.ServletException JavaDoc;
35 import javax.servlet.http.HttpServletRequest JavaDoc;
36 import javax.servlet.http.HttpServletResponse JavaDoc;
37 import java.io.IOException JavaDoc;
38 import java.io.Reader JavaDoc;
39
40 /**
41  * Context information from an engine to the namespace.
42  */

43 public interface HttpScriptContext extends ScriptContext {
44   public static int REQUEST_SCOPE = 0;
45   public static int APPLICATION_SCOPE = 175;
46   public static int SESSION_SCOPE = 150;
47
48   /**
49    * Initialize the context with the current servlet.
50    */

51   public void initialize(Servlet JavaDoc servlet,
52              HttpServletRequest JavaDoc request,
53              HttpServletResponse JavaDoc response)
54     throws ServletException JavaDoc;
55
56   /**
57    * Clears the state of the context.
58    */

59   public void release();
60
61   /**
62    * Returns an attribute from the given scope.
63    */

64   public Object JavaDoc getAttribute(String JavaDoc name, int scope);
65
66   /**
67    * Returns an attribute with the lowest score.
68    */

69   public Object JavaDoc getAttribute(String JavaDoc name);
70
71   /**
72    * Sets an attribute from the given scope.
73    */

74   public void setAttribute(String JavaDoc name, Object JavaDoc value, int scope);
75
76   /**
77    * Returns a reader from the source.
78    */

79   public Reader JavaDoc getScriptSource();
80
81   /**
82    * Returns the http request.
83    */

84   public HttpServletRequest JavaDoc getRequest();
85
86   /**
87    * Returns the http response
88    */

89   public HttpServletResponse JavaDoc getResponse();
90
91   /**
92    * Returns the servlet
93    */

94   public Servlet JavaDoc getServlet();
95
96   /**
97    * Forwards to the relative path.
98    */

99   public void forward(String JavaDoc path)
100     throws ServletException JavaDoc, IOException JavaDoc;
101
102   /**
103    * Includes the relative path.
104    */

105   public void include(String JavaDoc path)
106     throws ServletException JavaDoc, IOException JavaDoc;
107
108   /**
109    * Returns the script enable/disable state.
110    */

111   public boolean disableScript();
112
113   /**
114    * Returns the script session state.
115    */

116   public boolean useSession();
117
118   /**
119    * True if the servlet should display the results.
120    */

121   public boolean displayResults();
122
123   /**
124    * Returns the HTTP request methods allowed.
125    */

126   public String JavaDoc []getMethods();
127
128   /**
129    * Returns the allowed script languages.
130    */

131   public String JavaDoc []getAllowedLanguages();
132 }
133
134
Popular Tags