Source Code Cross Referenced for JspContext.java in  » 6.0-JDK-Core » Servlet-API-by-tomcat » javax » servlet » jsp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Servlet API by tomcat » javax.servlet.jsp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2004 The Apache Software Foundation
003         *
004         * Licensed under the Apache License, Version 2.0 (the "License");
005         * you may not use this file except in compliance with the License.
006         * You may obtain a copy of the License at
007         *
008         *     http://www.apache.org/licenses/LICENSE-2.0
009         *
010         * Unless required by applicable law or agreed to in writing, software
011         * distributed under the License is distributed on an "AS IS" BASIS,
012         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013         * See the License for the specific language governing permissions and
014         * limitations under the License.
015         */
016        package javax.servlet.jsp;
017
018        import java.util.Enumeration;
019
020        import javax.servlet.jsp.el.ExpressionEvaluator;
021        import javax.servlet.jsp.el.VariableResolver;
022
023        /**
024         * <p>
025         * <code>JspContext</code> serves as the base class for the 
026         * PageContext class and abstracts all information that is not specific
027         * to servlets.  This allows for Simple Tag Extensions to be used
028         * outside of the context of a request/response Servlet.
029         * <p>
030         * The JspContext provides a number of facilities to the 
031         * page/component author and page implementor, including:
032         * <ul>
033         * <li>a single API to manage the various scoped namespaces
034         * <li>a mechanism to obtain the JspWriter for output
035         * <li>a mechanism to expose page directive attributes to the 
036         *     scripting environment
037         * </ul>
038         *
039         * <p><B>Methods Intended for Container Generated Code</B>
040         * <p>
041         * The following methods enable the <B>management of nested</B> JspWriter 
042         * streams to implement Tag Extensions: <code>pushBody()</code> and
043         * <code>popBody()</code>
044         *
045         * <p><B>Methods Intended for JSP authors</B>
046         * <p>
047         * Some methods provide <B>uniform access</B> to the diverse objects
048         * representing scopes.
049         * The implementation must use the underlying machinery
050         * corresponding to that scope, so information can be passed back and
051         * forth between the underlying environment (e.g. Servlets) and JSP pages.
052         * The methods are:
053         * <code>setAttribute()</code>,  <code>getAttribute()</code>,
054         * <code>findAttribute()</code>,  <code>removeAttribute()</code>,
055         * <code>getAttributesScope()</code> and 
056         * <code>getAttributeNamesInScope()</code>.
057         * 
058         * <p>
059         * The following methods provide <B>convenient access</B> to implicit objects:
060         * <code>getOut()</code>
061         *
062         * <p>
063         * The following methods provide <B>programmatic access</b> to the 
064         * Expression Language evaluator:
065         * <code>getExpressionEvaluator()</code>, <code>getVariableResolver()</code>
066         *
067         * @since 2.0
068         */
069
070        public abstract class JspContext {
071
072            /**
073             * Sole constructor. (For invocation by subclass constructors, 
074             * typically implicit.)
075             */
076            public JspContext() {
077            }
078
079            /** 
080             * Register the name and value specified with page scope semantics.
081             * If the value passed in is <code>null</code>, this has the same 
082             * effect as calling 
083             * <code>removeAttribute( name, PageContext.PAGE_SCOPE )</code>.
084             *
085             * @param name the name of the attribute to set
086             * @param value the value to associate with the name, or null if the
087             *     attribute is to be removed from the page scope.
088             * @throws NullPointerException if the name is null
089             */
090
091            abstract public void setAttribute(String name, Object value);
092
093            /**
094             * Register the name and value specified with appropriate 
095             * scope semantics.  If the value passed in is <code>null</code>, 
096             * this has the same effect as calling
097             * <code>removeAttribute( name, scope )</code>.
098             * 
099             * @param name the name of the attribute to set
100             * @param value the object to associate with the name, or null if
101             *     the attribute is to be removed from the specified scope.
102             * @param scope the scope with which to associate the name/object
103             * 
104             * @throws NullPointerException if the name is null
105             * @throws IllegalArgumentException if the scope is invalid
106             * @throws IllegalStateException if the scope is 
107             *     PageContext.SESSION_SCOPE but the page that was requested
108             *     does not participate in a session or the session has been
109             *     invalidated.
110             */
111
112            abstract public void setAttribute(String name, Object value,
113                    int scope);
114
115            /**
116             * Returns the object associated with the name in the page scope or null
117             * if not found.
118             *
119             * @param name the name of the attribute to get
120             * @return the object associated with the name in the page scope 
121             *     or null if not found.
122             * 
123             * @throws NullPointerException if the name is null
124             */
125
126            abstract public Object getAttribute(String name);
127
128            /**
129             * Return the object associated with the name in the specified
130             * scope or null if not found.
131             *
132             * @param name the name of the attribute to set
133             * @param scope the scope with which to associate the name/object
134             * @return the object associated with the name in the specified
135             *     scope or null if not found.
136             * 
137             * @throws NullPointerException if the name is null
138             * @throws IllegalArgumentException if the scope is invalid 
139             * @throws IllegalStateException if the scope is 
140             *     PageContext.SESSION_SCOPE but the page that was requested
141             *     does not participate in a session or the session has been
142             *     invalidated.
143             */
144
145            abstract public Object getAttribute(String name, int scope);
146
147            /**
148             * Searches for the named attribute in page, request, session (if valid),
149             * and application scope(s) in order and returns the value associated or
150             * null.
151             *
152             * @param name the name of the attribute to search for
153             * @return the value associated or null
154             * @throws NullPointerException if the name is null
155             */
156
157            abstract public Object findAttribute(String name);
158
159            /**
160             * Remove the object reference associated with the given name
161             * from all scopes.  Does nothing if there is no such object.
162             *
163             * @param name The name of the object to remove.
164             * @throws NullPointerException if the name is null
165             */
166
167            abstract public void removeAttribute(String name);
168
169            /**
170             * Remove the object reference associated with the specified name
171             * in the given scope.  Does nothing if there is no such object.
172             *
173             * @param name The name of the object to remove.
174             * @param scope The scope where to look.
175             * @throws IllegalArgumentException if the scope is invalid
176             * @throws IllegalStateException if the scope is 
177             *     PageContext.SESSION_SCOPE but the page that was requested
178             *     does not participate in a session or the session has been
179             *     invalidated.
180             * @throws NullPointerException if the name is null
181             */
182
183            abstract public void removeAttribute(String name, int scope);
184
185            /**
186             * Get the scope where a given attribute is defined.
187             *
188             * @param name the name of the attribute to return the scope for
189             * @return the scope of the object associated with the name specified or 0
190             * @throws NullPointerException if the name is null
191             */
192
193            abstract public int getAttributesScope(String name);
194
195            /**
196             * Enumerate all the attributes in a given scope.
197             *
198             * @param scope the scope to enumerate all the attributes for
199             * @return an enumeration of names (java.lang.String) of all the 
200             *     attributes the specified scope
201             * @throws IllegalArgumentException if the scope is invalid
202             * @throws IllegalStateException if the scope is 
203             *     PageContext.SESSION_SCOPE but the page that was requested
204             *     does not participate in a session or the session has been
205             *     invalidated.
206             */
207
208            abstract public Enumeration getAttributeNamesInScope(int scope);
209
210            /**
211             * The current value of the out object (a JspWriter).
212             *
213             * @return the current JspWriter stream being used for client response
214             */
215            abstract public JspWriter getOut();
216
217            /**
218             * Provides programmatic access to the ExpressionEvaluator.
219             * The JSP Container must return a valid instance of an 
220             * ExpressionEvaluator that can parse EL expressions.
221             *
222             * @return A valid instance of an ExpressionEvaluator.
223             * @since 2.0
224             */
225            public abstract ExpressionEvaluator getExpressionEvaluator();
226
227            /**
228             * Returns an instance of a VariableResolver that provides access to the
229             * implicit objects specified in the JSP specification using this JspContext
230             * as the context object.
231             *
232             * @return A valid instance of a VariableResolver.
233             * @since 2.0
234             */
235            public abstract VariableResolver getVariableResolver();
236
237            /**
238             * Return a new JspWriter object that sends output to the
239             * provided Writer.  Saves the current "out" JspWriter,
240             * and updates the value of the "out" attribute in the
241             * page scope attribute namespace of the JspContext.
242             * <p>The returned JspWriter must implement all methods and
243             * behave as though it were unbuffered.  More specifically:
244             * <ul>
245             *   <li>clear() must throw an IOException</li>
246             *   <li>clearBuffer() does nothing</li>
247             *   <li>getBufferSize() always returns 0</li>
248             *   <li>getRemaining() always returns 0</li>
249             * </ul>
250             * </p>
251             *
252             * @param writer The Writer for the returned JspWriter to send
253             *     output to.
254             * @return a new JspWriter that writes to the given Writer.
255             * @since 2.0
256             */
257            public JspWriter pushBody(java.io.Writer writer) {
258                return null; // XXX to implement
259            }
260
261            /**
262             * Return the previous JspWriter "out" saved by the matching
263             * pushBody(), and update the value of the "out" attribute in
264             * the page scope attribute namespace of the JspContext.
265             *
266             * @return the saved JspWriter.
267             */
268            public JspWriter popBody() {
269                return null; // XXX to implement
270            }
271        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.