Source Code Cross Referenced for TagLibraryValidator.java in  » 6.0-JDK-Core » Servlet-API-by-tomcat » javax » servlet » jsp » tagext » 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.tagext 
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
017        package javax.servlet.jsp.tagext;
018
019        import java.util.Map;
020
021        /**
022         * Translation-time validator class for a JSP page. 
023         * A validator operates on the XML view associated with the JSP page.
024         *
025         * <p>
026         * The TLD file associates a TagLibraryValidator class and some init
027         * arguments with a tag library.
028         *
029         * <p>
030         * The JSP container is reponsible for locating an appropriate
031         * instance of the appropriate subclass by
032         *
033         * <ul>
034         * <li> new a fresh instance, or reuse an available one
035         * <li> invoke the setInitParams(Map) method on the instance
036         * </ul>
037         *
038         * once initialized, the validate(String, String, PageData) method will
039         * be invoked, where the first two arguments are the prefix
040         * and uri for this tag library in the XML View.  The prefix is intended
041         * to make it easier to produce an error message.  However, it is not
042         * always accurate.  In the case where a single URI is mapped to more 
043         * than one prefix in the XML view, the prefix of the first URI is provided.
044         * Therefore, to provide high quality error messages in cases where the 
045         * tag elements themselves are checked, the prefix parameter should be 
046         * ignored and the actual prefix of the element should be used instead.  
047         * TagLibraryValidators should always use the uri to identify elements 
048         * as beloning to the tag library, not the prefix.
049         *
050         * <p>
051         * A TagLibraryValidator instance
052         * may create auxiliary objects internally to perform
053         * the validation (e.g. an XSchema validator) and may reuse it for all
054         * the pages in a given translation run.
055         *
056         * <p>
057         * The JSP container is not guaranteed to serialize invocations of
058         * validate() method, and TagLibraryValidators should perform any
059         * synchronization they may require.
060         *
061         * <p>
062         * As of JSP 2.0, a JSP container must provide a jsp:id attribute to
063         * provide higher quality validation errors.
064         * The container will track the JSP pages
065         * as passed to the container, and will assign to each element
066         * a unique "id", which is passed as the value of the jsp:id
067         * attribute.  Each XML element in the XML view available will
068         * be extended with this attribute.  The TagLibraryValidator
069         * can then use the attribute in one or more ValidationMessage
070         * objects.  The container then, in turn, can use these
071         * values to provide more precise information on the location
072         * of an error.
073         *
074         * <p>
075         * The actual prefix of the <code>id</code> attribute may or may not be 
076         * <code>jsp</code> but it will always map to the namespace
077         * <code>http://java.sun.com/JSP/Page</code>.  A TagLibraryValidator
078         * implementation must rely on the uri, not the prefix, of the <code>id</code>
079         * attribute.
080         */
081
082        abstract public class TagLibraryValidator {
083
084            /**
085             * Sole constructor. (For invocation by subclass constructors, 
086             * typically implicit.)
087             */
088            public TagLibraryValidator() {
089            }
090
091            /**
092             * Set the init data in the TLD for this validator.
093             * Parameter names are keys, and parameter values are the values.
094             *
095             * @param map A Map describing the init parameters
096             */
097            public void setInitParameters(Map map) {
098                initParameters = map;
099            }
100
101            /**
102             * Get the init parameters data as an immutable Map.
103             * Parameter names are keys, and parameter values are the values.
104             *
105             * @return The init parameters as an immutable map.
106             */
107            public Map getInitParameters() {
108                return initParameters;
109            }
110
111            /**
112             * Validate a JSP page.
113             * This will get invoked once per unique tag library URI in the
114             * XML view.  This method will return null if the page is valid; otherwise
115             * the method should return an array of ValidationMessage objects.
116             * An array of length zero is also interpreted as no errors.
117             *
118             * @param prefix the first prefix with which the tag library is 
119             *     associated, in the XML view.  Note that some tags may use 
120             *     a different prefix if the namespace is redefined.
121             * @param uri the tag library's unique identifier
122             * @param page the JspData page object
123             * @return A null object, or zero length array if no errors, an array
124             * of ValidationMessages otherwise.
125             */
126            public ValidationMessage[] validate(String prefix, String uri,
127                    PageData page) {
128                return null;
129            }
130
131            /**
132             * Release any data kept by this instance for validation purposes.
133             */
134            public void release() {
135                initParameters = null;
136            }
137
138            // Private data
139            private Map initParameters;
140
141        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.