Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/ErrorData.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/ErrorData.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/ErrorData.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,131 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +/** + * Contains information about an error, for error pages. + * The information contained in this instance is meaningless if not used + * in the context of an error page. To indicate a JSP is an error page, + * the page author must set the isErrorPage attribute of the page directive + * to "true". + * + * @see PageContext#getErrorData + * @since JSP 2.0 + */ + +public final class ErrorData { + + private Throwable throwable; + private int statusCode; + private String uri; + private String servletName; + + /** + * Creates a new ErrorData object. + * + * @param throwable The Throwable that is the cause of the error + * @param statusCode The status code of the error + * @param uri The request URI + * @param servletName The name of the servlet invoked + */ + public ErrorData( Throwable throwable, int statusCode, String uri, + String servletName ) + { + this.throwable = throwable; + this.statusCode = statusCode; + this.uri = uri; + this.servletName = servletName; + } + + /** + * Returns the Throwable that caused the error. + * + * @return The Throwable that caused the error + */ + public Throwable getThrowable() { + return this.throwable; + } + + /** + * Returns the status code of the error. + * + * @return The status code of the error + */ + public int getStatusCode() { + return this.statusCode; + } + + /** + * Returns the request URI. + * + * @return The request URI + */ + public String getRequestURI() { + return this.uri; + } + + /** + * Returns the name of the servlet invoked. + * + * @return The name of the servlet invoked + */ + public String getServletName() { + return this.servletName; + } +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/HttpJspPage.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/HttpJspPage.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/HttpJspPage.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,99 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +import javax.servlet.*; +import javax.servlet.http.*; +import java.io.IOException; + +/** + * The HttpJspPage interface describes the interaction that a JSP Page + * Implementation Class must satisfy when using the HTTP protocol. + * + *

+ * The behaviour is identical to that of the JspPage, except for the signature + * of the _jspService method, which is now expressible in the Java type + * system and included explicitly in the interface. + * + * @see JspPage + */ + +public interface HttpJspPage extends JspPage { + + /** The _jspService()method corresponds to the body of the JSP page. This + * method is defined automatically by the JSP container and should never + * be defined by the JSP page author. + *

+ * If a superclass is specified using the extends attribute, that + * superclass may choose to perform some actions in its service() method + * before or after calling the _jspService() method. See using the extends + * attribute in the JSP_Engine chapter of the JSP specification. + * + * @param request Provides client request information to the JSP. + * @param response Assists the JSP in sending a response to the client. + * @throws ServletException Thrown if an error occurred during the + * processing of the JSP and that the container should take + * appropriate action to clean up the request. + * @throws IOException Thrown if an error occurred while writing the + * response for this page. + */ + public void _jspService(HttpServletRequest request, + HttpServletResponse response) + throws ServletException, IOException; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspApplicationContext.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspApplicationContext.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspApplicationContext.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,183 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +import javax.el.ELResolver; +import javax.el.ExpressionFactory; +import javax.el.ELContextListener; + +/** + * Stores application-scoped information relevant to JSP containers. + * + *

The JSP container must create a single instance of + * JspApplicationContext for each + * ServletContext instance.

+ * + *

An instance of JspApplicationContext is obtained by + * invoking the static {@link JspFactory#getJspApplicationContext} method, + * passing the ServletContext of the corresponding web + * application.

+ * + *

The JspApplicationContext provides the following services + * to JSP applications: + *

+ *

+ * + * @see javax.servlet.ServletContext + * @see JspFactory + * @see javax.el.ELResolver + * @see javax.el.ExpressionFactory + * @see javax.el.ELContextListener + * @since JSP 2.1 + */ +public interface JspApplicationContext { + + /** + * Adds an ELResolver to affect the way EL variables + * and properties are resolved for EL expressions appearing in JSP pages + * and tag files. + * + *

For example, in the EL expression ${employee.lastName}, an + * ELResolver determines what object "employee" + * references and how to find its "lastName" property.

+ * + *

When evaluating an expression, the JSP container will consult a + * set of standard resolvers as well as any resolvers registered via + * this method. The set of resolvers are consulted in the following + * order: + *

+ * + *

It is illegal to register an ELResolver after the + * application has received any request from the client. If an + * attempt is made to register an ELResolver after that time, + * an IllegalStateException is thrown.

+ * This restriction is + * in place to allow the JSP container to optimize for the common + * case where no additional ELResolvers are in the chain, + * aside from the standard ones. It is permissible to add + * ELResolvers before or after initialization to + * a CompositeELResolver that is already in the chain.

+ * + *

It is not possible to remove an ELResolver registered + * with this method, once it has been registered.

+ * + * @param resolver The new ELResolver + * @throws IllegalStateException if an attempt is made to + * call this method after all ServletContextListeners + * have had their contextInitialized methods invoked. + */ + public void addELResolver(ELResolver resolver); + + /** + * Returns a factory used to create ValueExpressions and + * MethodExpressions so that EL expressions can be + * parsed and evaluated. + * + * @return A concrete implementation of the + * an ExpressionFactory. + */ + public ExpressionFactory getExpressionFactory(); + + /** + * Registers a ELContextListeners so that context objects + * can be added whenever a new ELContext is created. + * + *

At a minimum, the ELContext objects created will + * contain a reference to the JspContext for this request, + * which is added by the JSP container. + * This is sufficient for all the + * default ELResolvers listed in {@link #addELResolver}. + * Note that JspContext.class is used as the key to ELContext.putContext() + * for the JspContext object reference.

+ * + *

This method is generally used by frameworks and applications that + * register their own ELResolver that needs context other + * than JspContext. The listener will typically add the + * necessary context to the ELContext provided in the + * event object. Registering a listener that adds context allows the + * ELResolvers in the stack to access the context they + * need when they do a resolution.

+ * + * @param listener The listener to be notified when a new + * ELContext is created. + */ + public void addELContextListener(ELContextListener listener); +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspContext.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspContext.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspContext.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,338 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +import java.util.Enumeration; + +import javax.servlet.jsp.el.ExpressionEvaluator; +import javax.servlet.jsp.el.VariableResolver; + +import javax.el.ELContext; + +/** + *

+ * JspContext serves as the base class for the + * PageContext class and abstracts all information that is not specific + * to servlets. This allows for Simple Tag Extensions to be used + * outside of the context of a request/response Servlet. + *

+ * The JspContext provides a number of facilities to the + * page/component author and page implementor, including: + *

+ * + *

Methods Intended for Container Generated Code + *

+ * The following methods enable the management of nested JspWriter + * streams to implement Tag Extensions: pushBody() and + * popBody() + * + *

Methods Intended for JSP authors + *

+ * Some methods provide uniform access to the diverse objects + * representing scopes. + * The implementation must use the underlying machinery + * corresponding to that scope, so information can be passed back and + * forth between the underlying environment (e.g. Servlets) and JSP pages. + * The methods are: + * setAttribute(), getAttribute(), + * findAttribute(), removeAttribute(), + * getAttributesScope() and + * getAttributeNamesInScope(). + * + *

+ * The following methods provide convenient access to implicit objects: + * getOut() + * + *

+ * The following methods provide programmatic access to the + * Expression Language evaluator: + * getExpressionEvaluator(), getVariableResolver() + * + * @since JSP 2.0 + */ + +public abstract class JspContext { + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public JspContext() { + } + + /** + * Register the name and value specified with page scope semantics. + * If the value passed in is null, this has the same + * effect as calling + * removeAttribute( name, PageContext.PAGE_SCOPE ). + * + * @param name the name of the attribute to set + * @param value the value to associate with the name, or null if the + * attribute is to be removed from the page scope. + * @throws NullPointerException if the name is null + */ + + abstract public void setAttribute(String name, Object value); + + /** + * Register the name and value specified with appropriate + * scope semantics. If the value passed in is null, + * this has the same effect as calling + * removeAttribute( name, scope ). + * + * @param name the name of the attribute to set + * @param value the object to associate with the name, or null if + * the attribute is to be removed from the specified scope. + * @param scope the scope with which to associate the name/object + * + * @throws NullPointerException if the name is null + * @throws IllegalArgumentException if the scope is invalid + * @throws IllegalStateException if the scope is + * PageContext.SESSION_SCOPE but the page that was requested + * does not participate in a session or the session has been + * invalidated. + */ + + abstract public void setAttribute(String name, Object value, int scope); + + /** + * Returns the object associated with the name in the page scope or null + * if not found. + * + * @param name the name of the attribute to get + * @return the object associated with the name in the page scope + * or null if not found. + * + * @throws NullPointerException if the name is null + */ + + abstract public Object getAttribute(String name); + + /** + * Return the object associated with the name in the specified + * scope or null if not found. + * + * @param name the name of the attribute to set + * @param scope the scope with which to associate the name/object + * @return the object associated with the name in the specified + * scope or null if not found. + * + * @throws NullPointerException if the name is null + * @throws IllegalArgumentException if the scope is invalid + * @throws IllegalStateException if the scope is + * PageContext.SESSION_SCOPE but the page that was requested + * does not participate in a session or the session has been + * invalidated. + */ + + abstract public Object getAttribute(String name, int scope); + + /** + * Searches for the named attribute in page, request, session (if valid), + * and application scope(s) in order and returns the value associated or + * null. + * + * @param name the name of the attribute to search for + * @return the value associated or null + * @throws NullPointerException if the name is null + */ + + abstract public Object findAttribute(String name); + + /** + * Remove the object reference associated with the given name + * from all scopes. Does nothing if there is no such object. + * + * @param name The name of the object to remove. + * @throws NullPointerException if the name is null + */ + + abstract public void removeAttribute(String name); + + /** + * Remove the object reference associated with the specified name + * in the given scope. Does nothing if there is no such object. + * + * @param name The name of the object to remove. + * @param scope The scope where to look. + * @throws IllegalArgumentException if the scope is invalid + * @throws IllegalStateException if the scope is + * PageContext.SESSION_SCOPE but the page that was requested + * does not participate in a session or the session has been + * invalidated. + * @throws NullPointerException if the name is null + */ + + abstract public void removeAttribute(String name, int scope); + + /** + * Get the scope where a given attribute is defined. + * + * @param name the name of the attribute to return the scope for + * @return the scope of the object associated with the name specified or 0 + * @throws NullPointerException if the name is null + */ + + abstract public int getAttributesScope(String name); + + /** + * Enumerate all the attributes in a given scope. + * + * @param scope the scope to enumerate all the attributes for + * @return an enumeration of names (java.lang.String) of all the + * attributes the specified scope + * @throws IllegalArgumentException if the scope is invalid + * @throws IllegalStateException if the scope is + * PageContext.SESSION_SCOPE but the page that was requested + * does not participate in a session or the session has been + * invalidated. + */ + + abstract public Enumeration getAttributeNamesInScope(int scope); + + /** + * The current value of the out object (a JspWriter). + * + * @return the current JspWriter stream being used for client response + */ + abstract public JspWriter getOut(); + + /** + * Provides programmatic access to the ExpressionEvaluator. + * The JSP Container must return a valid instance of an + * ExpressionEvaluator that can parse EL expressions. + * + * @deprecated As of JSP 2.1, replaced by + * {@link JspApplicationContext#getExpressionFactory} + * @return A valid instance of an ExpressionEvaluator. + * @since JSP 2.0 + */ + public abstract ExpressionEvaluator getExpressionEvaluator(); + + /** + * Returns an instance of a VariableResolver that provides access to the + * implicit objects specified in the JSP specification using this JspContext + * as the context object. + * + * @deprecated As of JSP 2.1, replaced by {@link ELContext#getELResolver}, + * which can be obtained by + * jspContext.getELContext().getELResolver(). + * @return A valid instance of a VariableResolver. + * @since JSP 2.0 + */ + public abstract VariableResolver getVariableResolver(); + + /** + * Returns the ELContext associated with this + * JspContext. + * + *

The ELContext is created lazily and is reused if + * it already exists. There is a new ELContext for each + * JspContext.

+ * + *

The ELContext must contain the ELResolver + * described in the JSP specification (and in the javadocs for + * {@link JspApplicationContext#addELResolver}).

+ * + * @return The ELContext associated with this + * JspContext. + * @since JSP 2.1 + */ + public abstract ELContext getELContext(); + + /** + * Return a new JspWriter object that sends output to the + * provided Writer. Saves the current "out" JspWriter, + * and updates the value of the "out" attribute in the + * page scope attribute namespace of the JspContext. + *

The returned JspWriter must implement all methods and + * behave as though it were unbuffered. More specifically: + *

+ *

+ * + * @param writer The Writer for the returned JspWriter to send + * output to. + * @return a new JspWriter that writes to the given Writer. + * @since JSP 2.0 + */ + public JspWriter pushBody( java.io.Writer writer ) { + return null; // XXX to implement + } + + /** + * Return the previous JspWriter "out" saved by the matching + * pushBody(), and update the value of the "out" attribute in + * the page scope attribute namespace of the JspContext. + * + * @return the saved JspWriter. + */ + public JspWriter popBody() { + return null; // XXX to implement + } +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspEngineInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspEngineInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspEngineInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,90 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +/** + * The JspEngineInfo is an abstract class that provides information on the + * current JSP engine. + */ + +public abstract class JspEngineInfo { + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public JspEngineInfo() { + } + + /** + * Return the version number of the JSP specification that is supported by + * this JSP engine. + *

+ * Specification version numbers that consists of positive decimal integers + * separated by periods ".", for example, "2.0" or "1.2.3.4.5.6.7". + * This allows an extensible number to be used to + * represent major, minor, micro, etc versions. + * The version number must begin with a number. + *

+ * + * @return the specification version, null is returned if it is not known + */ + + public abstract String getSpecificationVersion(); +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspException.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspException.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspException.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,130 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +/** + * A generic exception known to the JSP engine; uncaught + * JspExceptions will result in an invocation of the errorpage + * machinery. + */ + +public class JspException extends Exception { + + /** + * Construct a JspException. + */ + public JspException() { + } + + + /** + * Constructs a new JSP exception with the + * specified message. The message can be written + * to the server log and/or displayed for the user. + * + * @param msg a String + * specifying the text of + * the exception message + * + */ + public JspException(String msg) { + super(msg); + } + + + /** + * Constructs a new JspException with the specified detail + * message and cause. + * + * The cause is saved for later retrieval by the + * {@link #getCause()} and {@link #getRootCause()} methods. + * + * @see java.lang.Exception#Exception(String, Throwable) + */ + public JspException(String message, Throwable cause) { + super(message, cause); + } + + + /** + * Constructs a new JspException with the specified cause. + * + * The cause is saved for later retrieval by the + * {@link #getCause()} and {@link #getRootCause()} methods. + * + * @see java.lang.Exception#Exception(Throwable) + */ + public JspException(Throwable cause) { + super(cause); + } + + + /** + * Returns the exception that caused this JSP exception. + * + * @return the Throwable + * that caused this JSP exception + * + * @deprecated As of JSP 2.1, replaced by {@link #getCause()} + */ + + public Throwable getRootCause() { + return getCause(); + } +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspFactory.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspFactory.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspFactory.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,213 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +import javax.servlet.Servlet; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.ServletContext; +import javax.servlet.jsp.PageContext; + +/** + *

+ * The JspFactory is an abstract class that defines a number of factory + * methods available to a JSP page at runtime for the purposes of creating + * instances of various interfaces and classes used to support the JSP + * implementation. + *

+ * A conformant JSP Engine implementation will, during it's initialization + * instantiate an implementation dependent subclass of this class, and make + * it globally available for use by JSP implementation classes by registering + * the instance created with this class via the + * static setDefaultFactory() method. + *

+ * The only implementation-dependent classes that can be created from the + * factory are: + * PageContext, + * JspEngineInfo, and + * JspApplicationContext. + *

+ * With the exception of JspApplicationContext, + * JspFactory objects should not be used by JSP application developers. + */ + +public abstract class JspFactory { + + private static JspFactory deflt = null; + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public JspFactory() { + } + + /** + *

+ * set the default factory for this implementation. It is illegal for + * any principal other than the JSP Engine runtime to call this method. + *

+ * + * @param deflt The default factory implementation + */ + + public static synchronized void setDefaultFactory(JspFactory deflt) { + JspFactory.deflt = deflt; + } + + /** + * Returns the default factory for this implementation. + * + * @return the default factory for this implementation + */ + + public static synchronized JspFactory getDefaultFactory() { + if (deflt == null) { + try { + Class factory = Class.forName("org.apache.jasper.runtime.JspFactoryImpl"); + if (factory != null) { + deflt = (JspFactory) factory.newInstance(); + } + } catch (Exception ex) { + } + } + return deflt; + } + + /** + *

+ * obtains an instance of an implementation dependent + * javax.servlet.jsp.PageContext abstract class for the calling Servlet + * and currently pending request and response. + *

+ * + *

+ * This method is typically called early in the processing of the + * _jspService() method of a JSP implementation class in order to + * obtain a PageContext object for the request being processed. + *

+ *

+ * Invoking this method shall result in the PageContext.initialize() + * method being invoked. The PageContext returned is properly initialized. + *

+ *

+ * All PageContext objects obtained via this method shall be released + * by invoking releasePageContext(). + *

+ * + * @param servlet the requesting servlet + * @param request the current request pending on the servlet + * @param response the current response pending on the servlet + * @param errorPageURL the URL of the error page for the requesting JSP, or null + * @param needsSession true if the JSP participates in a session + * @param buffer size of buffer in bytes, JspWriter.NO_BUFFER if no buffer, + * JspWriter.DEFAULT_BUFFER if implementation default. + * @param autoflush should the buffer autoflush to the output stream on buffer + * overflow, or throw an IOException? + * + * @return the page context + * + * @see javax.servlet.jsp.PageContext + */ + + public abstract PageContext getPageContext(Servlet servlet, + ServletRequest request, + ServletResponse response, + String errorPageURL, + boolean needsSession, + int buffer, + boolean autoflush); + + /** + *

+ * called to release a previously allocated PageContext object. + * Results in PageContext.release() being invoked. + * This method should be invoked prior to returning from the _jspService() method of a JSP implementation + * class. + *

+ * + * @param pc A PageContext previously obtained by getPageContext() + */ + + public abstract void releasePageContext(PageContext pc); + + /** + *

+ * called to get implementation-specific information on the current JSP engine. + *

+ * + * @return a JspEngineInfo object describing the current JSP engine + */ + + public abstract JspEngineInfo getEngineInfo(); + + /** + * Obtains the JspApplicationContext instance associated + * with the web application for the given ServletContext. + * + * @param context The ServletContext for the web + * application the desired JspApplicationContext is + * associated with. + * @return The JspApplicationContext associated with the + * web application. + * @since 2.1 + */ + public abstract JspApplicationContext getJspApplicationContext( + ServletContext context); +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspPage.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspPage.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspPage.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,132 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +import javax.servlet.*; + +/** + * The JspPage interface describes the generic interaction that a JSP Page + * Implementation class must satisfy; pages that use the HTTP protocol + * are described by the HttpJspPage interface. + * + *

Two plus One Methods + *

+ * The interface defines a protocol with 3 methods; only two of + * them: jspInit() and jspDestroy() are part of this interface as + * the signature of the third method: _jspService() depends on + * the specific protocol used and cannot be expressed in a generic + * way in Java. + *

+ * A class implementing this interface is responsible for invoking + * the above methods at the appropriate time based on the + * corresponding Servlet-based method invocations. + *

+ * The jspInit() and jspDestroy() methods can be defined by a JSP + * author, but the _jspService() method is defined automatically + * by the JSP processor based on the contents of the JSP page. + * + *

_jspService() + *

+ * The _jspService()method corresponds to the body of the JSP page. This + * method is defined automatically by the JSP container and should never + * be defined by the JSP page author. + *

+ * If a superclass is specified using the extends attribute, that + * superclass may choose to perform some actions in its service() method + * before or after calling the _jspService() method. See using the extends + * attribute in the JSP_Engine chapter of the JSP specification. + *

+ * The specific signature depends on the protocol supported by the JSP page. + * + *

+ * public void _jspService(ServletRequestSubtype request,
+ *                             ServletResponseSubtype response)
+ *        throws ServletException, IOException;
+ * 
+ */ + + +public interface JspPage extends Servlet { + + /** + * The jspInit() method is invoked when the JSP page is initialized. It + * is the responsibility of the JSP implementation (and of the class + * mentioned by the extends attribute, if present) that at this point + * invocations to the getServletConfig() method will return the desired + * value. + * + * A JSP page can override this method by including a definition for it + * in a declaration element. + * + * A JSP page should redefine the init() method from Servlet. + */ + public void jspInit(); + + /** + * The jspDestroy() method is invoked when the JSP page is about to be + * destroyed. + * + * A JSP page can override this method by including a definition for it + * in a declaration element. + * + * A JSP page should redefine the destroy() method from Servlet. + */ + public void jspDestroy(); + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspTagException.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspTagException.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspTagException.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,135 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +/** + * Exception to be used by a Tag Handler to indicate some unrecoverable + * error. + * This error is to be caught by the top level of the JSP page and will result + * in an error page. + */ + +public class JspTagException extends JspException { + /** + * Constructs a new JspTagException with the specified message. + * The message can be written to the server log and/or displayed + * for the user. + * + * @param msg a String specifying the text of + * the exception message + */ + public JspTagException(String msg) { + super( msg ); + } + + /** + * Constructs a new JspTagException with no message. + */ + public JspTagException() { + super(); + } + + /** + * Constructs a new JspTagException when the JSP Tag + * needs to throw an exception and include a message + * about the "root cause" exception that interfered with its + * normal operation, including a description message. + * + * + * @param message a String containing + * the text of the exception message + * + * @param rootCause the Throwable exception + * that interfered with the JSP Tag's + * normal operation, making this JSP Tag + * exception necessary + * + * @since JSP 2.0 + */ + public JspTagException(String message, Throwable rootCause) { + super( message, rootCause ); + } + + + /** + * Constructs a new JSP Tag exception when the JSP Tag + * needs to throw an exception and include a message + * about the "root cause" exception that interfered with its + * normal operation. The exception's message is based on the localized + * message of the underlying exception. + * + *

This method calls the getLocalizedMessage method + * on the Throwable exception to get a localized exception + * message. When subclassing JspTagException, + * this method can be overridden to create an exception message + * designed for a specific locale. + * + * @param rootCause the Throwable exception + * that interfered with the JSP Tag's + * normal operation, making the JSP Tag + * exception necessary + * + * @since JSP 2.0 + */ + + public JspTagException(Throwable rootCause) { + super( rootCause ); + } + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/JspWriter.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/JspWriter.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/JspWriter.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,484 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +import java.io.IOException; + +/** + *

+ * The actions and template data in a JSP page is written using the + * JspWriter object that is referenced by the implicit variable out which + * is initialized automatically using methods in the PageContext object. + *

+ * This abstract class emulates some of the functionality found in the + * java.io.BufferedWriter and java.io.PrintWriter classes, + * however it differs in that it throws java.io.IOException from the print + * methods while PrintWriter does not. + *

Buffering + *

+ * The initial JspWriter object is associated with the PrintWriter object + * of the ServletResponse in a way that depends on whether the page is or + * is not buffered. If the page is not buffered, output written to this + * JspWriter object will be written through to the PrintWriter directly, + * which will be created if necessary by invoking the getWriter() method + * on the response object. But if the page is buffered, the PrintWriter + * object will not be created until the buffer is flushed and + * operations like setContentType() are legal. Since this flexibility + * simplifies programming substantially, buffering is the default for JSP + * pages. + *

+ * Buffering raises the issue of what to do when the buffer is + * exceeded. Two approaches can be taken: + *

+ *

+ * Both approaches are valid, and thus both are supported in the JSP + * technology. The behavior of a page is controlled by the autoFlush + * attribute, which defaults to true. In general, JSP pages that need to + * be sure that correct and complete data has been sent to their client + * may want to set autoFlush to false, with a typical case being that + * where the client is an application itself. On the other hand, JSP + * pages that send data that is meaningful even when partially + * constructed may want to set autoFlush to true; such as when the + * data is sent for immediate display through a browser. Each application + * will need to consider their specific needs. + *

+ * An alternative considered was to make the buffer size unbounded; but, + * this had the disadvantage that runaway computations would consume an + * unbounded amount of resources. + *

+ * The "out" implicit variable of a JSP implementation class is of this type. + * If the page directive selects autoflush="true" then all the I/O operations + * on this class shall automatically flush the contents of the buffer if an + * overflow condition would result if the current operation were performed + * without a flush. If autoflush="false" then all the I/O operations on this + * class shall throw an IOException if performing the current operation would + * result in a buffer overflow condition. + * + * @see java.io.Writer + * @see java.io.BufferedWriter + * @see java.io.PrintWriter + */ + +abstract public class JspWriter extends java.io.Writer { + + /** + * Constant indicating that the Writer is not buffering output. + */ + + public static final int NO_BUFFER = 0; + + /** + * Constant indicating that the Writer is buffered and is using the + * implementation default buffer size. + */ + + public static final int DEFAULT_BUFFER = -1; + + /** + * Constant indicating that the Writer is buffered and is unbounded; this + * is used in BodyContent. + */ + + public static final int UNBOUNDED_BUFFER = -2; + + /** + * Protected constructor. + * + * @param bufferSize the size of the buffer to be used by the JspWriter + * @param autoFlush whether the JspWriter should be autoflushing + */ + + protected JspWriter(int bufferSize, boolean autoFlush) { + this.bufferSize = bufferSize; + this.autoFlush = autoFlush; + } + + /** + * Write a line separator. The line separator string is defined by the + * system property line.separator, and is not necessarily a single + * newline ('\n') character. + * + * @exception IOException If an I/O error occurs + */ + + abstract public void newLine() throws IOException; + + /** + * Print a boolean value. The string produced by {@link + * java.lang.String#valueOf(boolean)} is written to the + * JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param b The boolean to be printed + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(boolean b) throws IOException; + + /** + * Print a character. The character is written to the + * JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param c The char to be printed + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(char c) throws IOException; + + /** + * Print an integer. The string produced by {@link + * java.lang.String#valueOf(int)} is written to the + * JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param i The int to be printed + * @see java.lang.Integer#toString(int) + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(int i) throws IOException; + + /** + * Print a long integer. The string produced by {@link + * java.lang.String#valueOf(long)} is written to the + * JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param l The long to be printed + * @see java.lang.Long#toString(long) + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(long l) throws IOException; + + /** + * Print a floating-point number. The string produced by {@link + * java.lang.String#valueOf(float)} is written to the + * JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param f The float to be printed + * @see java.lang.Float#toString(float) + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(float f) throws IOException; + + /** + * Print a double-precision floating-point number. The string produced by + * {@link java.lang.String#valueOf(double)} is written to + * the JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param d The double to be printed + * @see java.lang.Double#toString(double) + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(double d) throws IOException; + + /** + * Print an array of characters. The characters are written to the + * JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param s The array of chars to be printed + * + * @throws NullPointerException If s is null + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(char s[]) throws IOException; + + /** + * Print a string. If the argument is null then the string + * "null" is printed. Otherwise, the string's characters are + * written to the JspWriter's buffer or, if no buffer is used, directly + * to the underlying writer. + * + * @param s The String to be printed + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(String s) throws IOException; + + /** + * Print an object. The string produced by the {@link + * java.lang.String#valueOf(Object)} method is written to the + * JspWriter's buffer or, if no buffer is used, directly to the + * underlying writer. + * + * @param obj The Object to be printed + * @see java.lang.Object#toString() + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void print(Object obj) throws IOException; + + /** + * Terminate the current line by writing the line separator string. The + * line separator string is defined by the system property + * line.separator, and is not necessarily a single newline + * character ('\n'). + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println() throws IOException; + + /** + * Print a boolean value and then terminate the line. This method behaves + * as though it invokes {@link #print(boolean)} and then + * {@link #println()}. + * + * @param x the boolean to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(boolean x) throws IOException; + + /** + * Print a character and then terminate the line. This method behaves as + * though it invokes {@link #print(char)} and then {@link + * #println()}. + * + * @param x the char to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(char x) throws IOException; + + /** + * Print an integer and then terminate the line. This method behaves as + * though it invokes {@link #print(int)} and then {@link + * #println()}. + * + * @param x the int to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(int x) throws IOException; + + /** + * Print a long integer and then terminate the line. This method behaves + * as though it invokes {@link #print(long)} and then + * {@link #println()}. + * + * @param x the long to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(long x) throws IOException; + + /** + * Print a floating-point number and then terminate the line. This method + * behaves as though it invokes {@link #print(float)} and then + * {@link #println()}. + * + * @param x the float to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(float x) throws IOException; + + /** + * Print a double-precision floating-point number and then terminate the + * line. This method behaves as though it invokes {@link + * #print(double)} and then {@link #println()}. + * + * @param x the double to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(double x) throws IOException; + + /** + * Print an array of characters and then terminate the line. This method + * behaves as though it invokes print(char[]) and then + * println(). + * + * @param x the char[] to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(char x[]) throws IOException; + + /** + * Print a String and then terminate the line. This method behaves as + * though it invokes {@link #print(String)} and then + * {@link #println()}. + * + * @param x the String to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(String x) throws IOException; + + /** + * Print an Object and then terminate the line. This method behaves as + * though it invokes {@link #print(Object)} and then + * {@link #println()}. + * + * @param x the Object to write + * @throws java.io.IOException If an error occured while writing + */ + + abstract public void println(Object x) throws IOException; + + + /** + * Clear the contents of the buffer. If the buffer has been already + * been flushed then the clear operation shall throw an IOException + * to signal the fact that some data has already been irrevocably + * written to the client response stream. + * + * @throws IOException If an I/O error occurs + */ + + abstract public void clear() throws IOException; + + /** + * Clears the current contents of the buffer. Unlike clear(), this + * method will not throw an IOException if the buffer has already been + * flushed. It merely clears the current content of the buffer and + * returns. + * + * @throws IOException If an I/O error occurs + */ + + abstract public void clearBuffer() throws IOException; + + /** + * Flush the stream. If the stream has saved any characters from the + * various write() methods in a buffer, write them immediately to their + * intended destination. Then, if that destination is another character or + * byte stream, flush it. Thus one flush() invocation will flush all the + * buffers in a chain of Writers and OutputStreams. + *

+ * The method may be invoked indirectly if the buffer size is exceeded. + *

+ * Once a stream has been closed, + * further write() or flush() invocations will cause an IOException to be + * thrown. + * + * @exception IOException If an I/O error occurs + */ + + abstract public void flush() throws IOException; + + /** + * Close the stream, flushing it first. + *

+ * This method needs not be invoked explicitly for the initial JspWriter + * as the code generated by the JSP container will automatically + * include a call to close(). + *

+ * Closing a previously-closed stream, unlike flush(), has no effect. + * + * @exception IOException If an I/O error occurs + */ + + abstract public void close() throws IOException; + + /** + * This method returns the size of the buffer used by the JspWriter. + * + * @return the size of the buffer in bytes, or 0 is unbuffered. + */ + + public int getBufferSize() { return bufferSize; } + + /** + * This method returns the number of unused bytes in the buffer. + * + * @return the number of bytes unused in the buffer + */ + + abstract public int getRemaining(); + + /** + * This method indicates whether the JspWriter is autoFlushing. + * + * @return if this JspWriter is auto flushing or throwing IOExceptions + * on buffer overflow conditions + */ + + public boolean isAutoFlush() { return autoFlush; } + + /* + * fields + */ + + /** + * The size of the buffer used by the JspWriter. + */ + protected int bufferSize; + + /** + * Whether the JspWriter is autoflushing. + */ + protected boolean autoFlush; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/PageContext.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/PageContext.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/PageContext.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,564 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +import java.io.IOException; + +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import javax.servlet.http.HttpSession; + +import javax.servlet.jsp.tagext.BodyContent; + +/** + *

+ * PageContext extends JspContext to provide useful context information for + * when JSP technology is used in a Servlet environment. + *

+ * A PageContext instance provides access to all the namespaces associated + * with a JSP page, provides access to several page attributes, as well as + * a layer above the implementation details. Implicit objects are added + * to the pageContext automatically. + * + *

The PageContext class is an abstract class, designed to be + * extended to provide implementation dependent implementations thereof, by + * conformant JSP engine runtime environments. A PageContext instance is + * obtained by a JSP implementation class by calling the + * JspFactory.getPageContext() method, and is released by calling + * JspFactory.releasePageContext(). + * + *

An example of how PageContext, JspFactory, and other classes can be + * used within a JSP Page Implementation object is given elsewhere. + * + *

+ * The PageContext provides a number of facilities to the page/component + * author and page implementor, including: + *

+ * + *

Methods Intended for Container Generated Code + *

Some methods are intended to be used by the code generated by the + * container, not by code written by JSP page authors, or JSP tag library + * authors. + *

The methods supporting lifecycle are initialize() + * and release() + * + *

+ * The following methods enable the management of nested JspWriter + * streams to implement Tag Extensions: pushBody() + * + *

Methods Intended for JSP authors + *

+ * The following methods provide convenient access to implicit objects: + * getException(), getPage() + * getRequest(), getResponse(), + * getSession(), getServletConfig() + * and getServletContext(). + * + *

+ * The following methods provide support for forwarding, inclusion + * and error handling: + * forward(), include(), + * and handlePageException(). + */ + +abstract public class PageContext + extends JspContext +{ + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public PageContext() { + } + + /** + * Page scope: (this is the default) the named reference remains available + * in this PageContext until the return from the current Servlet.service() + * invocation. + */ + + public static final int PAGE_SCOPE = 1; + + /** + * Request scope: the named reference remains available from the + * ServletRequest associated with the Servlet until the current request + * is completed. + */ + + public static final int REQUEST_SCOPE = 2; + + /** + * Session scope (only valid if this page participates in a session): + * the named reference remains available from the HttpSession (if any) + * associated with the Servlet until the HttpSession is invalidated. + */ + + public static final int SESSION_SCOPE = 3; + + /** + * Application scope: named reference remains available in the + * ServletContext until it is reclaimed. + */ + + public static final int APPLICATION_SCOPE = 4; + + /** + * Name used to store the Servlet in this PageContext's nametables. + */ + + public static final String PAGE = "javax.servlet.jsp.jspPage"; + + /** + * Name used to store this PageContext in it's own name table. + */ + + public static final String PAGECONTEXT = "javax.servlet.jsp.jspPageContext"; + + /** + * Name used to store ServletRequest in PageContext name table. + */ + + public static final String REQUEST = "javax.servlet.jsp.jspRequest"; + + /** + * Name used to store ServletResponse in PageContext name table. + */ + + public static final String RESPONSE = "javax.servlet.jsp.jspResponse"; + + /** + * Name used to store ServletConfig in PageContext name table. + */ + + public static final String CONFIG = "javax.servlet.jsp.jspConfig"; + + /** + * Name used to store HttpSession in PageContext name table. + */ + + public static final String SESSION = "javax.servlet.jsp.jspSession"; + /** + * Name used to store current JspWriter in PageContext name table. + */ + + public static final String OUT = "javax.servlet.jsp.jspOut"; + + /** + * Name used to store ServletContext in PageContext name table. + */ + + public static final String APPLICATION = "javax.servlet.jsp.jspApplication"; + + /** + * Name used to store uncaught exception in ServletRequest attribute + * list and PageContext name table. + */ + + public static final String EXCEPTION = "javax.servlet.jsp.jspException"; + + /** + *

+ * The initialize method is called to initialize an uninitialized PageContext + * so that it may be used by a JSP Implementation class to service an + * incoming request and response within it's _jspService() method. + * + *

+ * This method is typically called from JspFactory.getPageContext() in + * order to initialize state. + * + *

+ * This method is required to create an initial JspWriter, and associate + * the "out" name in page scope with this newly created object. + * + *

+ * This method should not be used by page or tag library authors. + * + * @param servlet The Servlet that is associated with this PageContext + * @param request The currently pending request for this Servlet + * @param response The currently pending response for this Servlet + * @param errorPageURL The value of the errorpage attribute from the page + * directive or null + * @param needsSession The value of the session attribute from the + * page directive + * @param bufferSize The value of the buffer attribute from the page + * directive + * @param autoFlush The value of the autoflush attribute from the page + * directive + * + * @throws IOException during creation of JspWriter + * @throws IllegalStateException if out not correctly initialized + * @throws IllegalArgumentException If one of the given parameters + * is invalid + */ + + abstract public void initialize(Servlet servlet, ServletRequest request, + ServletResponse response, String errorPageURL, boolean needsSession, + int bufferSize, boolean autoFlush) + throws IOException, IllegalStateException, IllegalArgumentException; + + /** + *

+ * This method shall "reset" the internal state of a PageContext, releasing + * all internal references, and preparing the PageContext for potential + * reuse by a later invocation of initialize(). This method is typically + * called from JspFactory.releasePageContext(). + * + *

+ * Subclasses shall envelope this method. + * + *

+ * This method should not be used by page or tag library authors. + * + */ + + abstract public void release(); + + /** + * The current value of the session object (an HttpSession). + * + * @return the HttpSession for this PageContext or null + */ + + abstract public HttpSession getSession(); + + /** + * The current value of the page object (In a Servlet environment, + * this is an instance of javax.servlet.Servlet). + * + * @return the Page implementation class instance associated + * with this PageContext + */ + + abstract public Object getPage(); + + + /** + * The current value of the request object (a ServletRequest). + * + * @return The ServletRequest for this PageContext + */ + + abstract public ServletRequest getRequest(); + + /** + * The current value of the response object (a ServletResponse). + * + * @return the ServletResponse for this PageContext + */ + + abstract public ServletResponse getResponse(); + + /** + * The current value of the exception object (an Exception). + * + * @return any exception passed to this as an errorpage + */ + + abstract public Exception getException(); + + /** + * The ServletConfig instance. + * + * @return the ServletConfig for this PageContext + */ + + abstract public ServletConfig getServletConfig(); + + /** + * The ServletContext instance. + * + * @return the ServletContext for this PageContext + */ + + abstract public ServletContext getServletContext(); + + /** + *

+ * This method is used to re-direct, or "forward" the current + * ServletRequest and ServletResponse to another active component in + * the application. + *

+ *

+ * If the relativeUrlPath begins with a "/" then the URL specified + * is calculated relative to the DOCROOT of the ServletContext + * for this JSP. If the path does not begin with a "/" then the URL + * specified is calculated relative to the URL of the request that was + * mapped to the calling JSP. + *

+ *

+ * It is only valid to call this method from a Thread + * executing within a _jspService(...) method of a JSP. + *

+ *

+ * Once this method has been called successfully, it is illegal for the + * calling Thread to attempt to modify the + * ServletResponse object. Any such attempt to do so, shall result + * in undefined behavior. Typically, callers immediately return from + * _jspService(...) after calling this method. + *

+ * + * @param relativeUrlPath specifies the relative URL path to the target + * resource as described above + * + * @throws IllegalStateException if ServletResponse is not + * in a state where a forward can be performed + * @throws ServletException if the page that was forwarded to throws + * a ServletException + * @throws IOException if an I/O error occurred while forwarding + */ + + abstract public void forward(String relativeUrlPath) + throws ServletException, IOException; + + /** + *

+ * Causes the resource specified to be processed as part of the current + * ServletRequest and ServletResponse being processed by the calling Thread. + * The output of the target resources processing of the request is written + * directly to the ServletResponse output stream. + *

+ *

+ * The current JspWriter "out" for this JSP is flushed as a side-effect + * of this call, prior to processing the include. + *

+ *

+ * If the relativeUrlPath begins with a "/" then the URL specified + * is calculated relative to the DOCROOT of the ServletContext + * for this JSP. If the path does not begin with a "/" then the URL + * specified is calculated relative to the URL of the request that was + * mapped to the calling JSP. + *

+ *

+ * It is only valid to call this method from a Thread + * executing within a _jspService(...) method of a JSP. + *

+ * + * @param relativeUrlPath specifies the relative URL path to the target + * resource to be included + * + * @throws ServletException if the page that was forwarded to throws + * a ServletException + * @throws IOException if an I/O error occurred while forwarding + */ + abstract public void include(String relativeUrlPath) + throws ServletException, IOException; + + /** + *

+ * Causes the resource specified to be processed as part of the current + * ServletRequest and ServletResponse being processed by the calling Thread. + * The output of the target resources processing of the request is written + * directly to the current JspWriter returned by a call to getOut(). + *

+ *

+ * If flush is true, The current JspWriter "out" for this JSP + * is flushed as a side-effect of this call, prior to processing + * the include. Otherwise, the JspWriter "out" is not flushed. + *

+ *

+ * If the relativeUrlPath begins with a "/" then the URL specified + * is calculated relative to the DOCROOT of the ServletContext + * for this JSP. If the path does not begin with a "/" then the URL + * specified is calculated relative to the URL of the request that was + * mapped to the calling JSP. + *

+ *

+ * It is only valid to call this method from a Thread + * executing within a _jspService(...) method of a JSP. + *

+ * + * @param relativeUrlPath specifies the relative URL path to the + * target resource to be included + * @param flush True if the JspWriter is to be flushed before the include, + * or false if not. + * + * @throws ServletException if the page that was forwarded to throws + * a ServletException + * @throws IOException if an I/O error occurred while forwarding + * @since JSP 2.0 + */ + abstract public void include(String relativeUrlPath, boolean flush) + throws ServletException, IOException; + + /** + *

+ * This method is intended to process an unhandled 'page' level + * exception by forwarding the exception to the specified + * error page for this JSP. If forwarding is not possible (for + * example because the response has already been committed), an + * implementation dependent mechanism should be used to invoke + * the error page (e.g. "including" the error page instead). + * + *

+ * If no error page is defined in the page, the exception should + * be rethrown so that the standard servlet error handling + * takes over. + * + *

+ * A JSP implementation class shall typically clean up any local state + * prior to invoking this and will return immediately thereafter. It is + * illegal to generate any output to the client, or to modify any + * ServletResponse state after invoking this call. + * + *

+ * This method is kept for backwards compatiblity reasons. Newly + * generated code should use PageContext.handlePageException(Throwable). + * + * @param e the exception to be handled + * + * @throws ServletException if an error occurs while invoking the error page + * @throws IOException if an I/O error occurred while invoking the error + * page + * @throws NullPointerException if the exception is null + * + * @see #handlePageException(Throwable) + */ + + abstract public void handlePageException(Exception e) + throws ServletException, IOException; + + /** + *

+ * This method is intended to process an unhandled 'page' level + * exception by forwarding the exception to the specified + * error page for this JSP. If forwarding is not possible (for + * example because the response has already been committed), an + * implementation dependent mechanism should be used to invoke + * the error page (e.g. "including" the error page instead). + * + *

+ * If no error page is defined in the page, the exception should + * be rethrown so that the standard servlet error handling + * takes over. + * + *

+ * This method is intended to process an unhandled "page" level exception + * by redirecting the exception to either the specified error page for this + * JSP, or if none was specified, to perform some implementation dependent + * action. + * + *

+ * A JSP implementation class shall typically clean up any local state + * prior to invoking this and will return immediately thereafter. It is + * illegal to generate any output to the client, or to modify any + * ServletResponse state after invoking this call. + * + * @param t the throwable to be handled + * + * @throws ServletException if an error occurs while invoking the error page + * @throws IOException if an I/O error occurred while invoking the error + * page + * @throws NullPointerException if the exception is null + * + * @see #handlePageException(Exception) + */ + + abstract public void handlePageException(Throwable t) + throws ServletException, IOException; + + /** + * Return a new BodyContent object, save the current "out" JspWriter, + * and update the value of the "out" attribute in the page scope + * attribute namespace of the PageContext. + * + * @return the new BodyContent + */ + + public BodyContent pushBody() { + return null; // XXX to implement + } + + + /** + * Provides convenient access to error information. + * + * @return an ErrorData instance containing information about the + * error, as obtained from the request attributes, as per the + * Servlet specification. If this is not an error page (that is, + * if the isErrorPage attribute of the page directive is not set + * to "true"), the information is meaningless. + * + * @since JSP 2.0 + */ + public ErrorData getErrorData() { + return new ErrorData( + (Throwable)getRequest().getAttribute( "javax.servlet.error.exception" ), + ((Integer)getRequest().getAttribute( + "javax.servlet.error.status_code" )).intValue(), + (String)getRequest().getAttribute( "javax.servlet.error.request_uri" ), + (String)getRequest().getAttribute( "javax.servlet.error.servlet_name" ) ); + } + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/SkipPageException.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/SkipPageException.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/SkipPageException.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,118 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp; + +/** + * Exception to indicate the calling page must cease evaluation. + * Thrown by a simple tag handler to indicate that the remainder of + * the page must not be evaluated. The result is propagated back to + * the pagein the case where one tag invokes another (as can be + * the case with tag files). The effect is similar to that of a + * Classic Tag Handler returning Tag.SKIP_PAGE from doEndTag(). + * Jsp Fragments may also throw this exception. This exception + * should not be thrown manually in a JSP page or tag file - the behavior is + * undefined. The exception is intended to be thrown inside + * SimpleTag handlers and in JSP fragments. + * + * @see javax.servlet.jsp.tagext.SimpleTag#doTag + * @see javax.servlet.jsp.tagext.JspFragment#invoke + * @see javax.servlet.jsp.tagext.Tag#doEndTag + * @since JSP 2.0 + */ +public class SkipPageException + extends JspException +{ + /** + * Creates a SkipPageException with no message. + */ + public SkipPageException() { + super(); + } + + /** + * Creates a SkipPageException with the provided message. + * + * @param message the detail message + */ + public SkipPageException( String message ) { + super( message ); + } + + /** + * Creates a SkipPageException with the provided message and root cause. + * + * @param message the detail message + * @param rootCause the originating cause of this exception + */ + public SkipPageException( String message, Throwable rootCause ) { + super( message, rootCause ); + } + + /** + * Creates a SkipPageException with the provided root cause. + * + * @param rootCause the originating cause of this exception + */ + public SkipPageException( Throwable rootCause ) { + super( rootCause ); + } + +} + + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ELException.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ELException.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ELException.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,134 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + + +/** + * Represents any of the exception conditions that arise during the + * operation evaluation of the evaluator. + * + * @deprecated As of JSP 2.1, replaced by {@link javax.el.ELException} + * @since JSP 2.0 + */ +public class ELException + extends Exception +{ + //------------------------------------- + // Member variables + //------------------------------------- + + private Throwable mRootCause; + + //------------------------------------- + /** + * Creates an ELException with no detail message. + **/ + public ELException () + { + super (); + } + + //------------------------------------- + /** + * Creates an ELException with the provided detail message. + * + * @param pMessage the detail message + **/ + public ELException (String pMessage) + { + super (pMessage); + } + + //------------------------------------- + /** + * Creates an ELException with the given root cause. + * + * @param pRootCause the originating cause of this exception + **/ + public ELException (Throwable pRootCause) + { + super( pRootCause.getLocalizedMessage() ); + mRootCause = pRootCause; + } + + //------------------------------------- + /** + * Creates an ELException with the given detail message and root cause. + * + * @param pMessage the detail message + * @param pRootCause the originating cause of this exception + **/ + public ELException (String pMessage, + Throwable pRootCause) + { + super (pMessage); + mRootCause = pRootCause; + } + + //------------------------------------- + /** + * Returns the root cause. + * + * @return the root cause of this exception + */ + public Throwable getRootCause () + { + return mRootCause; + } +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ELParseException.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ELParseException.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ELParseException.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,92 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + + +/** + * Represents a parsing error encountered while parsing an EL expression. + * + * @deprecated As of JSP 2.1, replaced by {@link javax.el.ELException} + * @since JSP 2.0 + */ + +public class ELParseException extends ELException { + + //------------------------------------- + /** + * Creates an ELParseException with no detail message. + */ + public ELParseException () + { + super (); + } + + //------------------------------------- + /** + * Creates an ELParseException with the provided detail message. + * + * @param pMessage the detail message + **/ + public ELParseException (String pMessage) + { + super (pMessage); + } + + //------------------------------------- +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/Expression.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/Expression.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/Expression.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,93 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + + +/** + *

The abstract class for a prepared expression.

+ * + *

An instance of an Expression can be obtained via from an + * ExpressionEvaluator instance.

+ * + *

An Expression may or not have done a syntactic parse of the expression. + * A client invoking the evaluate() method should be ready for the case + * where ELParseException exceptions are raised.

+ * + * @deprecated As of JSP 2.1, replaced by {@link javax.el.ValueExpression} + * @since JSP 2.0 + */ +public abstract class Expression { + + /** + * Evaluates an expression that was previously prepared. In some + * implementations preparing an expression involves full syntactic + * validation, but others may not do so. Evaluating the expression may + * raise an ELParseException as well as other ELExceptions due to + * run-time evaluation. + * + * @param vResolver A VariableResolver instance that can be used at + * runtime to resolve the name of implicit objects into Objects. + * @return The result of the expression evaluation. + * + * @exception ELException Thrown if the expression evaluation failed. + */ + public abstract Object evaluate( VariableResolver vResolver ) + throws ELException; +} + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ExpressionEvaluator.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ExpressionEvaluator.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ExpressionEvaluator.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,149 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + + +/** + *

The abstract base class for an expression-language evaluator. + * Classes that implement an expression language expose their functionality + * via this abstract class.

+ * + *

An instance of the ExpressionEvaluator can be obtained via the + * JspContext / PageContext

+ * + *

The parseExpression() and evaluate() methods must be thread-safe. + * That is, multiple threads may call these methods on the same + * ExpressionEvaluator object simultaneously. Implementations should + * synchronize access if they depend on transient state. Implementations + * should not, however, assume that only one object of each + * ExpressionEvaluator type will be instantiated; global caching should + * therefore be static.

+ * + *

Only a single EL expression, starting with '${' and ending with + * '}', can be parsed or evaluated at a time. EL expressions + * cannot be mixed with static text. For example, attempting to + * parse or evaluate "abc${1+1}def${1+1}ghi" or even + * "${1+1}${1+1}" will cause an ELException to + * be thrown.

+ * + *

The following are examples of syntactically legal EL expressions: + * + *

+ *

+ * + * @deprecated As of JSP 2.1, replaced by {@link javax.el.ExpressionFactory} + * @since JSP 2.0 + */ +public abstract class ExpressionEvaluator { + + /** + * Prepare an expression for later evaluation. This method should perform + * syntactic validation of the expression; if in doing so it detects + * errors, it should raise an ELParseException. + * + * @param expression The expression to be evaluated. + * @param expectedType The expected type of the result of the evaluation + * @param fMapper A FunctionMapper to resolve functions found in + * the expression. It can be null, in which case no functions + * are supported for this invocation. The ExpressionEvaluator + * must not hold on to the FunctionMapper reference after + * returning from parseExpression(). The + * Expression object returned must invoke the same + * functions regardless of whether the mappings in the + * provided FunctionMapper instance change between + * calling ExpressionEvaluator.parseExpression() + * and Expression.evaluate(). + * @return The Expression object encapsulating the arguments. + * + * @exception ELException Thrown if parsing errors were found. + */ + public abstract Expression parseExpression( String expression, + Class expectedType, + FunctionMapper fMapper ) + throws ELException; + + + /** + * Evaluates an expression. This method may perform some syntactic + * validation and, if so, it should raise an ELParseException error if + * it encounters syntactic errors. EL evaluation errors should cause + * an ELException to be raised. + * + * @param expression The expression to be evaluated. + * @param expectedType The expected type of the result of the evaluation + * @param vResolver A VariableResolver instance that can be used at + * runtime to resolve the name of implicit objects into Objects. + * @param fMapper A FunctionMapper to resolve functions found in + * the expression. It can be null, in which case no functions + * are supported for this invocation. + * @return The result of the expression evaluation. + * + * @exception ELException Thrown if the expression evaluation failed. + */ + public abstract Object evaluate( String expression, + Class expectedType, + VariableResolver vResolver, + FunctionMapper fMapper ) + throws ELException; +} + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/FunctionMapper.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/FunctionMapper.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/FunctionMapper.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,81 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + +/** + *

The interface to a map between EL function names and methods.

+ * + *

Classes implementing this interface may, for instance, consult tag library + * information to resolve the map.

+ * + * @deprecated As of JSP 2.1, replaced by {@link javax.el.FunctionMapper} + * @since JSP 2.0 + */ +public interface FunctionMapper { + /** + * Resolves the specified local name and prefix into a Java.lang.Method. + * Returns null if the prefix and local name are not found. + * + * @param prefix the prefix of the function, or "" if no prefix. + * @param localName the short name of the function + * @return the result of the method mapping. Null means no entry found. + **/ + public java.lang.reflect.Method resolveFunction(String prefix, + String localName); +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ImplicitObjectELResolver.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ImplicitObjectELResolver.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ImplicitObjectELResolver.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,1266 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + +import java.beans.FeatureDescriptor; +import java.util.Iterator; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.ServletContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.JspContext; + +import javax.el.PropertyNotWritableException; +import javax.el.ELContext; +import javax.el.ELResolver; + +/** + * Defines variable resolution behavior for the EL implicit objects + * defined in the JSP specification. + * + *

The following variables are resolved by this ELResolver, + * as per the JSP specification: + *

+ * + * @see javax.el.ELResolver + * @since JSP 2.1 + */ +public class ImplicitObjectELResolver extends ELResolver { + + /** + * If the base object is null, and the property matches + * the name of a JSP implicit object, returns the implicit object. + * + *

The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if an implicit object is matched. If + * this property is not true after this method is called, + * the caller should ignore the return value.

+ * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the implicit object to resolve. + * @return If the propertyResolved property of + * ELContext was set to true, then + * the implicit object; otherwise undefined. + * @throws NullPointerException if context is null + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public Object getValue(ELContext context, + Object base, + Object property) { + + if (context == null) { + throw new NullPointerException(); + } + + if (base != null) { + return null; + } + + PageContext ctxt = (PageContext)context.getContext(JspContext.class); + + if ("pageContext".equals(property)) { + context.setPropertyResolved(true); + return ctxt; + } + ImplicitObjects implicitObjects = + ImplicitObjects.getImplicitObjects(ctxt); + if ("pageScope".equals(property)) { + context.setPropertyResolved(true); + return implicitObjects.getPageScopeMap(); + } + if ("requestScope".equals(property)) { + context.setPropertyResolved(true); + return implicitObjects.getRequestScopeMap(); + } + if ("sessionScope".equals(property)) { + context.setPropertyResolved(true); + return implicitObjects.getSessionScopeMap(); + } + if ("applicationScope".equals (property)) { + context.setPropertyResolved(true); + return implicitObjects.getApplicationScopeMap (); + } + if ("param".equals (property)) { + context.setPropertyResolved(true); + return implicitObjects.getParamMap(); + } + if ("paramValues".equals (property)) { + context.setPropertyResolved(true); + return implicitObjects.getParamsMap(); + } + if ("header".equals (property)) { + context.setPropertyResolved(true); + return implicitObjects.getHeaderMap(); + } + if ("headerValues".equals (property)) { + context.setPropertyResolved(true); + return implicitObjects.getHeadersMap(); + } + if ("initParam".equals (property)) { + context.setPropertyResolved(true); + return implicitObjects.getInitParamMap (); + } + if ("cookie".equals (property)) { + context.setPropertyResolved(true); + return implicitObjects.getCookieMap (); + } + return null; + } + + /** + * If the base object is null, and the property matches + * the name of a JSP implicit object, returns null to + * indicate that no types are ever accepted to setValue(). + * + *

The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if an implicit object is matched. If + * this property is not true after this method is called, + * the caller should ignore the return value.

+ * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the implicit object to resolve. + * @return If the propertyResolved property of + * ELContext was set to true, then + * null; otherwise undefined. + * @throws NullPointerException if context is null + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public Class getType(ELContext context, + Object base, + Object property) { + + if (context == null) { + throw new NullPointerException(); + } + + if ((base == null) && ("pageContext".equals(property) || + "pageScope".equals(property)) || + "requestScope".equals(property) || + "sessionScope".equals(property) || + "applicationScope".equals (property) || + "param".equals (property) || + "paramValues".equals (property) || + "header".equals (property) || + "headerValues".equals (property) || + "initParam".equals (property) || + "cookie".equals (property)) { + context.setPropertyResolved(true); + } + return null; + } + + /** + * If the base object is null, and the property matches + * the name of a JSP implicit object, throws + * PropertyNotWritableException to indicate that implicit + * objects cannot be overwritten. + * + *

The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if an implicit object is matched. If + * this property is not true after this method is called, + * the caller should ignore the return value.

+ * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the implicit object. + * @param val The value to be associated with the implicit object. + * @throws NullPointerException if context is null. + * @throws PropertyNotWritableException always thrown, if the + * implicit object name is recognized by this resolver. + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public void setValue(ELContext context, + Object base, + Object property, + Object val) { + + if (context == null) { + throw new NullPointerException(); + } + + if ((base == null) && ("pageContext".equals(property) || + "pageScope".equals(property)) || + "requestScope".equals(property) || + "sessionScope".equals(property) || + "applicationScope".equals (property) || + "param".equals (property) || + "paramValues".equals (property) || + "header".equals (property) || + "headerValues".equals (property) || + "initParam".equals (property) || + "cookie".equals (property)) { + throw new PropertyNotWritableException(); + } + } + + /** + * If the base object is null, and the property matches + * the name of a JSP implicit object, returns true + * to indicate that implicit objects cannot be overwritten. + * + *

The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if an implicit object is matched. If + * this property is not true after this method is called, + * the caller should ignore the return value.

+ * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the implicit object. + * @return If the propertyResolved property of + * ELContext was set to true, then + * true; otherwise undefined. + * @throws NullPointerException if context is null. + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public boolean isReadOnly(ELContext context, + Object base, + Object property) { + if (context == null) { + throw new NullPointerException(); + } + + if ((base == null) && ("pageContext".equals(property) || + "pageScope".equals(property)) || + "requestScope".equals(property) || + "sessionScope".equals(property) || + "applicationScope".equals (property) || + "param".equals (property) || + "paramValues".equals (property) || + "header".equals (property) || + "headerValues".equals (property) || + "initParam".equals (property) || + "cookie".equals (property)) { + context.setPropertyResolved(true); + return true; + } + return false; // Doesn't matter + } + + /** + * If the base object is null, and the property matches + * the name of a JSP implicit object, returns an Iterator + * containing FeatureDescriptor objects with information + * about each JSP implicit object resolved by this resolver. Otherwise, + * returns null. + * + *

The Iterator returned must contain one instance of + * {@link java.beans.FeatureDescriptor} for each of the EL implicit objects + * defined by the JSP spec. Each info object contains information about + * a single implicit object, and is initialized as follows: + *

+ *
  • displayName - The name of the implicit object.
  • + *
  • name - Same as displayName property.
  • + *
  • shortDescription - A suitable description for the implicit + * object. Will vary by implementation.
  • + *
  • expert - false
  • + *
  • hidden - false
  • + *
  • preferred - true
  • + *
    + * In addition, the following named attributes must be set in the + * returned FeatureDescriptors: + *
    + *
  • {@link ELResolver#TYPE} - The runtime type of the implicit object.
  • + *
  • {@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.
  • + *

    + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in a null return value. + * @return An Iterator containing one + * FeatureDescriptor object for each implicit object, or + * null if base is not null. + */ + public Iterator getFeatureDescriptors( + ELContext context, + Object base) { + ArrayList list = + new ArrayList(11); + + // pageContext + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName("pageContext"); + descriptor.setDisplayName("pageContext"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", javax.servlet.jsp.PageContext.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // pageScope + descriptor = new FeatureDescriptor(); + descriptor.setName("pageScope"); + descriptor.setDisplayName("pageScope"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // requestScope + descriptor = new FeatureDescriptor(); + descriptor.setName("requestScope"); + descriptor.setDisplayName("requestScope"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // sessionScope + descriptor = new FeatureDescriptor(); + descriptor.setName("sessionScope"); + descriptor.setDisplayName("sessionScope"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // applicationScope + descriptor = new FeatureDescriptor(); + descriptor.setName("applicationScope"); + descriptor.setDisplayName("applicationScope"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // param + descriptor = new FeatureDescriptor(); + descriptor.setName("param"); + descriptor.setDisplayName("param"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // paramValues + descriptor = new FeatureDescriptor(); + descriptor.setName("paramValues"); + descriptor.setDisplayName("paramValues"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // header + descriptor = new FeatureDescriptor(); + descriptor.setName("header"); + descriptor.setDisplayName("header"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // headerValues + descriptor = new FeatureDescriptor(); + descriptor.setName("headerValues"); + descriptor.setDisplayName("headerValues"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // cookie + descriptor = new FeatureDescriptor(); + descriptor.setName("cookie"); + descriptor.setDisplayName("cookie"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + // initParam + descriptor = new FeatureDescriptor(); + descriptor.setName("initParam"); + descriptor.setDisplayName("initParam"); + //descriptor.setShortDescription(""); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", Map.class); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + + return list.iterator(); + } + + /** + * If the base object is null, returns + * String.class. Otherwise, returns null. + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in a null return value. + * @return null if base is not null; otherwise + * String.class. + */ + public Class getCommonPropertyType(ELContext context, + Object base) { + if (base == null) { + return String.class; + } + return null; + } + + // XXX - I moved this class from commons-el to an inner class here + // so that we do not have a dependency from the JSP APIs into commons-el. + // There might be a better way to do this. + /** + *

    This class is used to generate the implicit Map and List objects + * that wrap various elements of the PageContext. It also returns the + * correct implicit object for a given implicit object name. + * + * @author Nathan Abramson - Art Technology Group + **/ + private static class ImplicitObjects + { + //------------------------------------- + // Constants + //------------------------------------- + + + // XXX - This probably needs to change, now that this is in a + // standard pkg. + static final String sAttributeName = + "org.apache.taglibs.standard.ImplicitObjects"; + + //------------------------------------- + // Member variables + //------------------------------------- + + PageContext mContext; + Map mPage; + Map mRequest; + Map mSession; + Map mApplication; + Map mParam; + Map mParams; + Map mHeader; + Map mHeaders; + Map mInitParam; + Map mCookie; + + //------------------------------------- + /** + * + * Constructor + **/ + public ImplicitObjects (PageContext pContext) + { + mContext = pContext; + } + + //------------------------------------- + /** + * + * Finds the ImplicitObjects associated with the PageContext, + * creating it if it doesn't yet exist. + **/ + public static ImplicitObjects getImplicitObjects (PageContext pContext) + { + ImplicitObjects objs = + (ImplicitObjects) + pContext.getAttribute (sAttributeName, + PageContext.PAGE_SCOPE); + if (objs == null) { + objs = new ImplicitObjects (pContext); + pContext.setAttribute (sAttributeName, + objs, + PageContext.PAGE_SCOPE); + } + return objs; + } + + //------------------------------------- + /** + * + * Returns the Map that "wraps" page-scoped attributes + **/ + public Map getPageScopeMap () + { + if (mPage == null) { + mPage = createPageScopeMap (mContext); + } + return mPage; + } + + //------------------------------------- + /** + * + * Returns the Map that "wraps" request-scoped attributes + **/ + public Map getRequestScopeMap () + { + if (mRequest == null) { + mRequest = createRequestScopeMap (mContext); + } + return mRequest; + } + + //------------------------------------- + /** + * + * Returns the Map that "wraps" session-scoped attributes + **/ + public Map getSessionScopeMap () + { + if (mSession == null) { + mSession = createSessionScopeMap (mContext); + } + return mSession; + } + + //------------------------------------- + /** + * + * Returns the Map that "wraps" application-scoped attributes + **/ + public Map getApplicationScopeMap () + { + if (mApplication == null) { + mApplication = createApplicationScopeMap (mContext); + } + return mApplication; + } + + //------------------------------------- + /** + * + * Returns the Map that maps parameter name to a single parameter + * values. + **/ + public Map getParamMap () + { + if (mParam == null) { + mParam = createParamMap (mContext); + } + return mParam; + } + + //------------------------------------- + /** + * + * Returns the Map that maps parameter name to an array of parameter + * values. + **/ + public Map getParamsMap () + { + if (mParams == null) { + mParams = createParamsMap (mContext); + } + return mParams; + } + + //------------------------------------- + /** + * + * Returns the Map that maps header name to a single header + * values. + **/ + public Map getHeaderMap () + { + if (mHeader == null) { + mHeader = createHeaderMap (mContext); + } + return mHeader; + } + + //------------------------------------- + /** + * + * Returns the Map that maps header name to an array of header + * values. + **/ + public Map getHeadersMap () + { + if (mHeaders == null) { + mHeaders = createHeadersMap (mContext); + } + return mHeaders; + } + + //------------------------------------- + /** + * + * Returns the Map that maps init parameter name to a single init + * parameter values. + **/ + public Map getInitParamMap () + { + if (mInitParam == null) { + mInitParam = createInitParamMap (mContext); + } + return mInitParam; + } + + //------------------------------------- + /** + * + * Returns the Map that maps cookie name to the first matching + * Cookie in request.getCookies(). + **/ + public Map getCookieMap () + { + if (mCookie == null) { + mCookie = createCookieMap (mContext); + } + return mCookie; + } + + //------------------------------------- + // Methods for generating wrapper maps + //------------------------------------- + /** + * + * Creates the Map that "wraps" page-scoped attributes + **/ + public static Map createPageScopeMap(PageContext pContext) + { + final PageContext context = pContext; + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return context.getAttributeNamesInScope + (PageContext.PAGE_SCOPE); + } + + public Object getValue (Object pKey) + { + if (pKey instanceof String) { + return context.getAttribute + ((String) pKey, + PageContext.PAGE_SCOPE); + } + else { + return null; + } + } + + public boolean isMutable () + { + return true; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that "wraps" request-scoped attributes + **/ + public static Map createRequestScopeMap (PageContext pContext) + { + final PageContext context = pContext; + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return context.getAttributeNamesInScope + (PageContext.REQUEST_SCOPE); + } + + public Object getValue (Object pKey) + { + if (pKey instanceof String) { + return context.getAttribute + ((String) pKey, + PageContext.REQUEST_SCOPE); + } + else { + return null; + } + } + + public boolean isMutable () + { + return true; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that "wraps" session-scoped attributes + **/ + public static Map createSessionScopeMap (PageContext pContext) + { + final PageContext context = pContext; + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return context.getAttributeNamesInScope + (PageContext.SESSION_SCOPE); + } + + public Object getValue (Object pKey) + { + if (pKey instanceof String) { + return context.getAttribute + ((String) pKey, + PageContext.SESSION_SCOPE); + } + else { + return null; + } + } + + public boolean isMutable () + { + return true; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that "wraps" application-scoped attributes + **/ + public static Map createApplicationScopeMap (PageContext pContext) + { + final PageContext context = pContext; + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return context.getAttributeNamesInScope + (PageContext.APPLICATION_SCOPE); + } + + public Object getValue (Object pKey) + { + if (pKey instanceof String) { + return context.getAttribute + ((String) pKey, + PageContext.APPLICATION_SCOPE); + } + else { + return null; + } + } + + public boolean isMutable () + { + return true; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that maps parameter name to single parameter + * value. + **/ + public static Map createParamMap (PageContext pContext) + { + final HttpServletRequest request = + (HttpServletRequest) pContext.getRequest (); + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return request.getParameterNames (); + } + + public String getValue (Object pKey) + { + if (pKey instanceof String) { + return request.getParameter ((String) pKey); + } + else { + return null; + } + } + + public boolean isMutable () + { + return false; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that maps parameter name to an array of parameter + * values. + **/ + public static Map createParamsMap (PageContext pContext) + { + final HttpServletRequest request = + (HttpServletRequest) pContext.getRequest (); + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return request.getParameterNames (); + } + + public String[] getValue (Object pKey) + { + if (pKey instanceof String) { + return request.getParameterValues ((String) pKey); + } + else { + return null; + } + } + + public boolean isMutable () + { + return false; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that maps header name to single header + * value. + **/ + public static Map createHeaderMap (PageContext pContext) + { + final HttpServletRequest request = + (HttpServletRequest) pContext.getRequest (); + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return request.getHeaderNames (); + } + + public String getValue (Object pKey) + { + if (pKey instanceof String) { + return request.getHeader ((String) pKey); + } + else { + return null; + } + } + + public boolean isMutable () + { + return false; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that maps header name to an array of header + * values. + **/ + public static Map createHeadersMap (PageContext pContext) + { + final HttpServletRequest request = + (HttpServletRequest) pContext.getRequest (); + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return request.getHeaderNames (); + } + + public String[] getValue (Object pKey) + { + if (pKey instanceof String) { + // Drain the header enumeration + List l = new ArrayList (); + Enumeration e = request.getHeaders ((String) pKey); + if (e != null) { + while (e.hasMoreElements ()) { + l.add (e.nextElement ()); + } + } + return l.toArray (new String [l.size ()]); + } + else { + return null; + } + } + + public boolean isMutable () + { + return false; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that maps init parameter name to single init + * parameter value. + **/ + public static Map createInitParamMap(PageContext pContext) + { + final ServletContext context = pContext.getServletContext (); + return new EnumeratedMap () + { + public Enumeration enumerateKeys () + { + return context.getInitParameterNames (); + } + + public String getValue (Object pKey) + { + if (pKey instanceof String) { + return context.getInitParameter ((String) pKey); + } + else { + return null; + } + } + + public boolean isMutable () + { + return false; + } + }; + } + + //------------------------------------- + /** + * + * Creates the Map that maps cookie name to the first matching + * Cookie in request.getCookies(). + **/ + public static Map createCookieMap (PageContext pContext) + { + // Read all the cookies and construct the entire map + HttpServletRequest request = (HttpServletRequest) pContext.getRequest (); + Cookie [] cookies = request.getCookies (); + Map ret = new HashMap (); + for (int i = 0; cookies != null && i < cookies.length; i++) { + Cookie cookie = cookies [i]; + if (cookie != null) { + String name = cookie.getName (); + if (!ret.containsKey (name)) { + ret.put (name, cookie); + } + } + } + return ret; + } + + //------------------------------------- + } + + // XXX - I moved this class from commons-el to an inner class here + // so that we do not have a dependency from the JSP APIs into commons-el. + // There might be a better way to do this. + /** + *

    This is a Map implementation driven by a data source that only + * provides an enumeration of keys and a getValue(key) method. This + * class must be subclassed to implement those methods. + * + *

    Some of the methods may incur a performance penalty that + * involves enumerating the entire data source. In these cases, the + * Map will try to save the results of that enumeration, but only if + * the underlying data source is immutable. + * + * @author Nathan Abramson - Art Technology Group + **/ + private static abstract class EnumeratedMap + implements Map + { + //------------------------------------- + // Member variables + //------------------------------------- + + Map mMap; + + //------------------------------------- + public void clear () + { + throw new UnsupportedOperationException (); + } + + //------------------------------------- + public boolean containsKey (Object pKey) + { + return getValue (pKey) != null; + } + + //------------------------------------- + public boolean containsValue (Object pValue) + { + return getAsMap ().containsValue (pValue); + } + + //------------------------------------- + public Set> entrySet () + { + return getAsMap ().entrySet (); + } + + //------------------------------------- + public V get (Object pKey) + { + return getValue (pKey); + } + + //------------------------------------- + public boolean isEmpty () + { + return !enumerateKeys ().hasMoreElements (); + } + + //------------------------------------- + public Set keySet () + { + return getAsMap ().keySet (); + } + + //------------------------------------- + public V put (K pKey, V pValue) + { + throw new UnsupportedOperationException (); + } + + //------------------------------------- + public void putAll (Map pMap) + { + throw new UnsupportedOperationException (); + } + + //------------------------------------- + public V remove (Object pKey) + { + throw new UnsupportedOperationException (); + } + + //------------------------------------- + public int size () + { + return getAsMap ().size (); + } + + //------------------------------------- + public Collection values () + { + return getAsMap ().values (); + } + + //------------------------------------- + // Abstract methods + //------------------------------------- + /** + * + * Returns an enumeration of the keys + **/ + public abstract Enumeration enumerateKeys (); + + //------------------------------------- + /** + * + * Returns true if it is possible for this data source to change + **/ + public abstract boolean isMutable (); + + //------------------------------------- + /** + * + * Returns the value associated with the given key, or null if not + * found. + **/ + public abstract V getValue (Object pKey); + + //------------------------------------- + /** + * + * Converts the MapSource to a Map. If the map is not mutable, this + * is cached + **/ + public Map getAsMap () + { + if (mMap != null) { + return mMap; + } + else { + Map m = convertToMap (); + if (!isMutable ()) { + mMap = m; + } + return m; + } + } + + //------------------------------------- + /** + * + * Converts to a Map + **/ + Map convertToMap () + { + Map ret = new HashMap (); + for (Enumeration e = enumerateKeys (); e.hasMoreElements (); ) { + K key = e.nextElement (); + V value = getValue (key); + ret.put (key, value); + } + return ret; + } + + //------------------------------------- + } +} + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ScopedAttributeELResolver.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ScopedAttributeELResolver.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/ScopedAttributeELResolver.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,391 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + +import java.beans.FeatureDescriptor; +import java.util.Iterator; +import java.util.ArrayList; +import java.util.Enumeration; + +import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.JspContext; + +import javax.el.ELContext; +import javax.el.ELResolver; +import javax.el.ELException; + +/** + * Defines variable resolution behavior for scoped attributes. + * + *

    This resolver handles all variable resolutions (where base + * is null. It searches PageContext.findAttribute() + * for a matching attribute. If not found, it will return null, + * or in the case of setValue it will create a new attribute + * in the page scope with the given name.

    + * + * @see javax.el.ELResolver + * @since JSP 2.1 + */ + +public class ScopedAttributeELResolver extends ELResolver { + + /** + * If the base object is null, searches the page, + * request, session and application scopes for an attribute with + * the given name and returns it, or null if no + * attribute exists with the current name. + * + *

    The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if base is null. If + * this property is not true after this method is called, + * the caller should ignore the return value.

    + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the scoped attribute to resolve. + * @return If the propertyResolved property of + * ELContext was set to true, then + * the scoped attribute; otherwise undefined. + * @throws NullPointerException if context is null + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public Object getValue(ELContext context, + Object base, + Object property) { + + if (context == null) { + throw new NullPointerException(); + } + + if (base == null) { + context.setPropertyResolved(true); + if (property instanceof String) { + String attribute = (String) property; + PageContext ctxt = (PageContext) + context.getContext(JspContext.class); + return ctxt.findAttribute(attribute); + } + } + return null; + } + + /** + * If the base object is null, returns + * Object.class to indicate that any type is valid to + * set for a scoped attribute. + * + *

    The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if base is null. If + * this property is not true after this method is called, + * the caller should ignore the return value.

    + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the scoped attribute to resolve. + * @return If the propertyResolved property of + * ELContext was set to true, then + * Object.class; otherwise undefined. + * @throws NullPointerException if context is null + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public Class getType(ELContext context, + Object base, + Object property) { + + if (context == null) { + throw new NullPointerException(); + } + + if (base == null) { + context.setPropertyResolved(true); + return Object.class; + } + return null; + } + + + /** + * If the base object is null, sets an existing scoped + * attribute to the new value, or creates a new scoped attribute if one + * does not exist by this name. + * + *

    If the provided attribute name matches the key of an attribute + * in page scope, request scope, session scope, or application scope, the + * corresponding attribute value will be replaced by the provided value. + * Otherwise, a new page scope attribute will be created with the + * given name and value.

    + * + *

    The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if base is null. If + * this property is not true after this method is called, + * the caller should ignore the return value.

    + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the scoped attribute to set. + * @param val The value for the scoped attribute. + * @throws NullPointerException if context is null. + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public void setValue(ELContext context, + Object base, + Object property, + Object val) { + if (context == null) { + throw new NullPointerException(); + } + + if (base == null) { + context.setPropertyResolved(true); + if (property instanceof String) { + PageContext ctxt = (PageContext) + context.getContext(JspContext.class); + String attr = (String) property; + if (ctxt.getAttribute(attr, PageContext.REQUEST_SCOPE) != null) + ctxt.setAttribute(attr, val, PageContext.REQUEST_SCOPE); + else if (ctxt.getAttribute(attr, PageContext.SESSION_SCOPE) != null) + ctxt.setAttribute(attr, val, PageContext.SESSION_SCOPE); + else if (ctxt.getAttribute(attr, PageContext.APPLICATION_SCOPE) != null) + ctxt.setAttribute(attr, val, PageContext.APPLICATION_SCOPE); + else { + ctxt.setAttribute(attr, val, PageContext.PAGE_SCOPE); + } + } + } + } + + /** + * If the base object is null, returns false + * to indicate that scoped attributes are never read-only. + * + *

    The propertyResolved property of the + * ELContext object must be set to true by + * this resolver before returning if base is null. If + * this property is not true after this method is called, + * the caller should ignore the return value.

    + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in an immediate return. + * @param property The name of the scoped attribute. + * @return If the propertyResolved property of + * ELContext was set to true, then + * false; otherwise undefined. + * @throws NullPointerException if context is null. + * @throws ELException if an exception was thrown while performing + * the property or variable resolution. The thrown exception + * must be included as the cause property of this exception, if + * available. + */ + public boolean isReadOnly(ELContext context, + Object base, + Object property) { + if (context == null) { + throw new NullPointerException(); + } + + if (base == null) { + context.setPropertyResolved(true); + } + return false; + } + + /** + * If the base object is null, returns an + * Iterator containing FeatureDescriptor objects + * with information about each scoped attribute resolved by this + * resolver. Otherwise, returns null. + * + *

    The Iterator returned must contain one instance of + * {@link java.beans.FeatureDescriptor} for each scoped attribute found in + * any scope. Each info object contains information about + * a single scoped attribute, and is initialized as follows: + * + *

    + *
  • displayName - The name of the scoped attribute.
  • + *
  • name - Same as displayName property.
  • + *
  • shortDescription - A suitable description for the scoped + * attribute. Should include the attribute's current scope + * (page, request, session, application). Will vary by + * implementation.
  • + *
  • expert - false
  • + *
  • hidden - false
  • + *
  • preferred - true
  • + *
    + * In addition, the following named attributes must be set in the + * returned FeatureDescriptors: + *
    + *
  • {@link ELResolver#TYPE} - The current runtime type of the scoped attribute.
  • + *
  • {@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - true.
  • + *

    + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in a null return value. + * @return An Iterator containing one + * FeatureDescriptor object for each scoped attribute, or + * null if base is not null. + */ + public Iterator getFeatureDescriptors( + ELContext context, + Object base) { + Enumeration attrs; + ArrayList list = new ArrayList(); + PageContext ctxt = (PageContext) context.getContext(JspContext.class); + + attrs = ctxt.getAttributeNamesInScope(PageContext.PAGE_SCOPE); + while (attrs.hasMoreElements()) { + String name = (String) attrs.nextElement(); + Object value = ctxt.getAttribute(name, PageContext.PAGE_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setShortDescription("page scope attribute"); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + } + + attrs = ctxt.getAttributeNamesInScope(PageContext.REQUEST_SCOPE); + while (attrs.hasMoreElements()) { + String name = (String) attrs.nextElement(); + Object value = ctxt.getAttribute(name, PageContext.REQUEST_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setShortDescription("request scope attribute"); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + } + + attrs = ctxt.getAttributeNamesInScope(PageContext.SESSION_SCOPE); + while (attrs.hasMoreElements()) { + String name = (String) attrs.nextElement(); + Object value = ctxt.getAttribute(name, PageContext.SESSION_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setShortDescription("session scope attribute"); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + } + + attrs = ctxt.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE); + while (attrs.hasMoreElements()) { + String name = (String) attrs.nextElement(); + Object value = ctxt.getAttribute(name, PageContext.APPLICATION_SCOPE); + FeatureDescriptor descriptor = new FeatureDescriptor(); + descriptor.setName(name); + descriptor.setDisplayName(name); + descriptor.setShortDescription("application scope attribute"); + descriptor.setExpert(false); + descriptor.setHidden(false); + descriptor.setPreferred(true); + descriptor.setValue("type", value.getClass()); + descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); + list.add(descriptor); + } + return list.iterator(); + } + + /** + * If the base object is null, returns + * String.class. Otherwise, returns null. + * + * @param context The context of this evaluation. + * @param base Only null is handled by this resolver. + * Other values will result in a null return value. + * @return null if base is not null; otherwise + * String.class. + */ + public Class getCommonPropertyType(ELContext context, + Object base) { + if (base == null) { + return String.class; + } + return null; + } + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/VariableResolver.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/VariableResolver.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/VariableResolver.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,92 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.el; + +/** + *

    This class is used to customize the way an ExpressionEvaluator resolves + * variable references at evaluation time. For example, instances of this class can + * implement their own variable lookup mechanisms, or introduce the + * notion of "implicit variables" which override any other variables. + * An instance of this class should be passed when evaluating + * an expression.

    + * + *

    An instance of this class includes the context against which resolution + * will happen

    + * + * @deprecated As of JSP 2.1, replaced by {@link javax.el.ELResolver} + * @since JSP 2.0 + */ +public interface VariableResolver +{ + //------------------------------------- + /** + * Resolves the specified variable. + * Returns null if the variable is not found. + * + * @param pName the name of the variable to resolve + * @return the result of the variable resolution + * + * @throws ELException if a failure occurred while trying to resolve + * the given variable + **/ + public Object resolveVariable (String pName) + throws ELException; + + //------------------------------------- +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/el/package.html =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/el/package.html (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/el/package.html (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,196 @@ + + + + + + + + + + +Provides the ELResolver classes that define the +object resolution rules that must be supported by a JSP container +with the new unified Expression Language. +

    +The package also defines programmatic access to the old Expression Language +evaluator (pre JSP 2.1). +

    +Please note +that as of JSP 2.1, all classes and interfaces that were in package +javax.servlet.jsp.el have been deprecated in favor of the new unified +Expression Language APIs (javax.el). See the Expression Language +specification document for more details. +

    +

    +While a JSP container must still support the deprecated APIs defined +in javax.servlet.jsp.el, developers should only rely on the +new javax.el APIs +for new development work. +

    +

    +Two ELResolver classes have been added in JSP 2.1 to implement +object resolution rules that must be supported by a JSP container +with the new unified Expression Language: +{@link javax.servlet.jsp.el.ImplicitObjectELResolver} and +{@link javax.servlet.jsp.el.ScopedAttributeELResolver}. +

    + +

    Documentation on the old and deprecated API

    + +

    +The JavaServer Pages(tm) (JSP) 2.0 specification provides a portable +API for evaluating "EL Expressions". As of JSP 2.0, EL expressions can +be placed directly in the template text of JSP pages and tag files. +

    +This package contains a number of classes and interfaces that describe +and define programmatic access to the Expression Language evaluator. +This API can also be used by an implementation of JSP to evaluate the +expressions, but other implementations, like open-coding into Java +bytecodes, are allowed. This package is intended to have no dependencies +on other portions of the JSP 2.0 specification. + +

    Expression Evaluator

    + +Programmatic access to the EL Expression Evaluator is provided +through the following types: + +
      +
    • ExpressionEvaluator
    • +
    • Expression
    • +
    • FunctionMapper
    • +
    • VariableResolver
    • +
    + +

    An ExpressionEvaluator object can be obtained from a +JspContext object through the getExpressionEvaluator +method. An ExpressionEvaluator encapsulates the EL processor. An EL +expression provided as a String can then be evaluated directly, or it +can be parsed first into an Expression object. The parse +step, can be used to factor out the cost of parsing the expression, or +even the cost of optimizing the implementation.

    + +

    The parsing of an expression string is done against a target type, +a default prefix (that applies when a function has no prefix), and +a FunctionMapper. The FunctionMapper object +maps a prefix and a local name part into a +java.lang.reflect.Method object.

    + +

    The interpretation or evaluation of a parsed expression is done +using a VariableResolver object. This object resolves +top level object names into Objects. A VariableResolver +can be obtained from a JspContext object through the +getVariableResolver method.

    + +

    Exceptions

    + +

    +The ELException exception is used by the expression +language to denote any exception that may arise during the parsing or +evaluation of an expression. +The ELParseException exception is a subclass of +ELException that corresponds to parsing errors

    + +

    Parsing errors are conveyed as exceptions to simplify the API. It +is expected that many JSP containers will use additional mechanisms to +parse EL expressions and report their errors - a run-time API cannot +provide accurate line-error numbers without additional machinery.

    + +

    Code Fragment

    + +

    +Below is a non-normative code fragment outlining how the APIs can be used.

    + +
    +// Get an instance of an ExpressionEvaluator
    +
    +
    +ExpressionEvaluator ee = myJspContext.getExpressionEvaluator();
    +VariableResolver vr = myJspContext.getVariableResolver();
    +
    +FunctionMapper fm; // we don't have a portable implementation yet
    +
    +// Example of compiling an expression.  See [ISSUE-2]
    +// Errors detected this way may have higher quality than those
    +// found with a simple validate() invocation.
    +
    +ExpressionCompilation ce;
    +
    +try {
    +  ce = ee.prepareExpression(expr,
    +			    targetClass,
    +			    fm,
    +			    null // no prefixes
    +			    );
    +} catch (ELParseException e) {
    +	log (e.getMessage());
    +}
    +
    +try {
    +  ce.evaluate(vr);
    +} catch (ElException e) {
    +	log (e);
    +}
    +
    + + + + + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/package.html =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/package.html (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/package.html (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,167 @@ + + + + + + + +Classes and interfaces for the Core JSP 2.1 API. +

    +The javax.servlet.jsp package contains a number of classes and +interfaces that describe and define the contracts between a JSP page +implementation class and the runtime environment provided for an +instance of such a class by a conforming JSP container. +

    + +

    JSP Page Implementation Object Contract

    +

    +This section describes the basic contract between a JSP Page +implementation object and its container. +

    +

    +The main contract is defined by the classes +{@link javax.servlet.jsp.JspPage} +and {@link javax.servlet.jsp.HttpJspPage}. +The {@link javax.servlet.jsp.JspFactory} class describes the mechanism to +portably instantiate all needed runtime objects, +and {@link javax.servlet.jsp.JspEngineInfo} provides basic information on +the current JSP container. Class {@link javax.servlet.jsp.JspApplicationContext} +stores application-scoped information relevant to JSP containers. +It was added in JSP 2.1 to support the integration of the unified +Expression Language. +

    +

    +None of these classes are intended to be used +by JSP page authors; an example of how these classes may be +used is included below. +

    + +

    Implicit Objects

    + +The {@link javax.servlet.jsp.PageContext} object and the +{@link javax.servlet.jsp.JspWriter} +are available by default as implicit objects. + +

    Exceptions

    + +

    +The {@link javax.servlet.jsp.JspException} class is the base class for all JSP +exceptions. The {@link javax.servlet.jsp.JspTagException} and +{@link javax.servlet.jsp.SkipPageException} exceptions are used by the +tag extension mechanism.

    +For JSP error pages, the {@link javax.servlet.jsp.ErrorData} class encapsulates information +about the error. + +

    + +

    An Implementation Example

    + +

    An instance of an implementation dependent subclass of the +{@link javax.servlet.jsp.PageContext} +abstract base class can be created by a JSP implementation class at +the beginning of it's _jspService() method via an +implementation default {@link javax.servlet.jsp.JspFactory}. + +

    Here is one example of how to use these classes + +

    + +

    + public class foo implements Servlet {
    +
    + // ...
    +
    +public void _jspService(HttpServletRequest request,
    +			HttpServletResponse response)
    +       throws IOException, ServletException {
    +
    +    JspFactory  factory     = JspFactory.getDefaultFactory();
    +    PageContext pageContext = factory.getPageContext(
    +					this,
    +					request,
    +					response,
    +					null,  // errorPageURL
    +					false, // needsSession
    +					JspWriter.DEFAULT_BUFFER,
    +					true   // autoFlush
    +			        );
    +
    +    // initialize implicit variables for scripting env ...
    +
    +    HttpSession session = pageContext.getSession();
    +    JspWriter   out     = pageContext.getOut();
    +    Object      page    = this;
    +
    +    try {
    +        // body of translated JSP here ...
    +    } catch (Exception e) {
    +        out.clear();
    +        pageContext.handlePageException(e);
    +    } finally {
    +        out.close();
    +	  factory.releasePageContext(pageContext);
    +    }
    +}
    +
    + + + + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyContent.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyContent.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyContent.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,181 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import java.io.Reader; +import java.io.Writer; +import java.io.IOException; +import javax.servlet.jsp.*; + +/** + * An encapsulation of the evaluation of the body of an action so it is + * available to a tag handler. BodyContent is a subclass of JspWriter. + * + *

    + * Note that the content of BodyContent is the result of evaluation, so + * it will not contain actions and the like, but the result of their + * invocation. + * + *

    + * BodyContent has methods to convert its contents into + * a String, to read its contents, and to clear the contents. + * + *

    + * The buffer size of a BodyContent object is unbounded. A + * BodyContent object cannot be in autoFlush mode. It is not possible to + * invoke flush on a BodyContent object, as there is no backing stream. + * + *

    + * Instances of BodyContent are created by invoking the pushBody and + * popBody methods of the PageContext class. A BodyContent is enclosed + * within another JspWriter (maybe another BodyContent object) following + * the structure of their associated actions. + * + *

    + * A BodyContent is made available to a BodyTag through a setBodyContent() + * call. The tag handler can use the object until after the call to + * doEndTag(). + */ + +public abstract class BodyContent extends JspWriter { + + /** + * Protected constructor. + * + * Unbounded buffer, no autoflushing. + * + * @param e the enclosing JspWriter + */ + + protected BodyContent(JspWriter e) { + super(UNBOUNDED_BUFFER , false); + this.enclosingWriter = e; + } + + /** + * Redefined flush() so it is not legal. + * + *

    + * It is not valid to flush a BodyContent because there is no backing + * stream behind it. + * + * @throws IOException always thrown + */ + + public void flush() throws IOException { + throw new IOException("Illegal to flush within a custom tag"); + } + + /** + * Clear the body without throwing any exceptions. + */ + + public void clearBody() { + try { + this.clear(); + } catch (IOException ex) { + // TODO -- clean this one up. + throw new Error("internal error!;"); + } + } + + /** + * Return the value of this BodyContent as a Reader. + * + * @return the value of this BodyContent as a Reader + */ + public abstract Reader getReader(); + + + /** + * Return the value of the BodyContent as a String. + * + * @return the value of the BodyContent as a String + */ + public abstract String getString(); + + + /** + * Write the contents of this BodyContent into a Writer. + * Subclasses may optimize common invocation patterns. + * + * @param out The writer into which to place the contents of + * this body evaluation + * @throws IOException if an I/O error occurred while writing the + * contents of this BodyContent to the given Writer + */ + + public abstract void writeOut(Writer out) throws IOException; + + + /** + * Get the enclosing JspWriter. + * + * @return the enclosing JspWriter passed at construction time + */ + + public JspWriter getEnclosingWriter() { + return enclosingWriter; + } + + + // private fields + + private JspWriter enclosingWriter; + } Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyTag.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyTag.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyTag.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,228 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.*; + +/** + * The BodyTag interface extends IterationTag by defining additional + * methods that let a tag handler manipulate the content of evaluating its body. + * + *

    + * It is the responsibility of the tag handler to manipulate the body + * content. For example the tag handler may take the body content, + * convert it into a String using the bodyContent.getString + * method and then use it. Or the tag handler may take the body + * content and write it out into its enclosing JspWriter using + * the bodyContent.writeOut method. + * + *

    A tag handler that implements BodyTag is treated as one that + * implements IterationTag, except that the doStartTag method can + * return SKIP_BODY, EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED. + * + *

    + * If EVAL_BODY_INCLUDE is returned, then evaluation happens + * as in IterationTag. + * + *

    + * If EVAL_BODY_BUFFERED is returned, then a BodyContent object will be + * created (by code generated by the JSP compiler) to capture the body + * evaluation. + * The code generated by the JSP compiler obtains the BodyContent object by + * calling the pushBody method of the current pageContext, which + * additionally has the effect of saving the previous out value. + * The page compiler returns this object by calling the popBody + * method of the PageContext class; + * the call also restores the value of out. + * + *

    + * The interface provides one new property with a setter method and one + * new action method. + * + *

    Properties + *

    There is a new property: bodyContent, to contain the BodyContent + * object, where the JSP Page implementation object will place the + * evaluation (and reevaluation, if appropriate) of the body. The setter + * method (setBodyContent) will only be invoked if doStartTag() returns + * EVAL_BODY_BUFFERED and the corresponding action element does not have + * an empty body. + * + *

    Methods + *

    In addition to the setter method for the bodyContent property, there + * is a new action method: doInitBody(), which is invoked right after + * setBodyContent() and before the body evaluation. This method is only + * invoked if doStartTag() returns EVAL_BODY_BUFFERED. + * + *

    Lifecycle + *

    Lifecycle details are described by the transition diagram below. + * Exceptions that are thrown during the computation of doStartTag(), + * setBodyContent(), doInitBody(), BODY, doAfterBody() interrupt the + * execution sequence and are propagated up the stack, unless the + * tag handler implements the TryCatchFinally interface; see that + * interface for details. + *

    + * Lifecycle Details Transition Diagram for BodyTag + * + *

    Empty and Non-Empty Action + *

    If the TagLibraryDescriptor file indicates that the action must + * always have an empty element body, by an <body-content> entry + * of "empty", then the doStartTag() method must return SKIP_BODY. + * Otherwise, the doStartTag() method may return SKIP_BODY, + * EVAL_BODY_INCLUDE, or EVAL_BODY_BUFFERED. + * + *

    Note that which methods are invoked after the doStartTag() depends on + * both the return value and on if the custom action element is empty + * or not in the JSP page, not how it's declared in the TLD. + * + *

    + * If SKIP_BODY is returned the body is not evaluated, and doEndTag() is + * invoked. + * + *

    + * If EVAL_BODY_INCLUDE is returned, and the custom action element is not + * empty, setBodyContent() is not invoked, + * doInitBody() is not invoked, the body is evaluated and + * "passed through" to the current out, doAfterBody() is invoked + * and then, after zero or more iterations, doEndTag() is invoked. + * If the custom action element is empty, only doStart() and + * doEndTag() are invoked. + * + *

    + * If EVAL_BODY_BUFFERED is returned, and the custom action element is not + * empty, setBodyContent() is invoked, + * doInitBody() is invoked, the body is evaluated, doAfterBody() is + * invoked, and then, after zero or more iterations, doEndTag() is invoked. + * If the custom action element is empty, only doStart() and doEndTag() + * are invoked. + */ + +public interface BodyTag extends IterationTag { + + /** + * Deprecated constant that has the same value as EVAL_BODY_BUFFERED + * and EVAL_BODY_AGAIN. This name has been marked as deprecated + * to encourage the use of the two different terms, which are much + * more descriptive. + * + * @deprecated As of Java JSP API 1.2, use BodyTag.EVAL_BODY_BUFFERED + * or IterationTag.EVAL_BODY_AGAIN. + */ + + public final static int EVAL_BODY_TAG = 2; + + /** + * Request the creation of new buffer, a BodyContent on which to + * evaluate the body of this tag. + * + * Returned from doStartTag when it implements BodyTag. + * This is an illegal return value for doStartTag when the class + * does not implement BodyTag. + */ + + public final static int EVAL_BODY_BUFFERED = 2; + + + /** + * Set the bodyContent property. + * This method is invoked by the JSP page implementation object at + * most once per action invocation. + * This method will be invoked before doInitBody. + * This method will not be invoked for empty tags or for non-empty + * tags whose doStartTag() method returns SKIP_BODY or EVAL_BODY_INCLUDE. + * + *

    + * When setBodyContent is invoked, the value of the implicit object out + * has already been changed in the pageContext object. The BodyContent + * object passed will have not data on it but may have been reused + * (and cleared) from some previous invocation. + * + *

    + * The BodyContent object is available and with the appropriate content + * until after the invocation of the doEndTag method, at which case it + * may be reused. + * + * @param b the BodyContent + * @see #doInitBody + * @see #doAfterBody + */ + + void setBodyContent(BodyContent b); + + + /** + * Prepare for evaluation of the body. + * This method is invoked by the JSP page implementation object + * after setBodyContent and before the first time + * the body is to be evaluated. + * This method will not be invoked for empty tags or for non-empty + * tags whose doStartTag() method returns SKIP_BODY or EVAL_BODY_INCLUDE. + * + *

    + * The JSP container will resynchronize the values of any AT_BEGIN and + * NESTED variables (defined by the associated TagExtraInfo or TLD) after + * the invocation of doInitBody(). + * + * @throws JspException if an error occurred while processing this tag + * @see #doAfterBody + */ + + void doInitBody() throws JspException; + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyTagSupport.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyTagSupport.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/BodyTagSupport.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,202 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; + +/** + * A base class for defining tag handlers implementing BodyTag. + * + *

    + * The BodyTagSupport class implements the BodyTag interface and adds + * additional convenience methods including getter methods for the + * bodyContent property and methods to get at the previous out JspWriter. + * + *

    + * Many tag handlers will extend BodyTagSupport and only redefine a + * few methods. + */ + +public class BodyTagSupport extends TagSupport implements BodyTag { + + /** + * Default constructor, all subclasses are required to only define + * a public constructor with the same signature, and to call the + * superclass constructor. + * + * This constructor is called by the code generated by the JSP + * translator. + */ + + public BodyTagSupport() { + super(); + } + + /** + * Default processing of the start tag returning EVAL_BODY_BUFFERED. + * + * @return EVAL_BODY_BUFFERED + * @throws JspException if an error occurred while processing this tag + * @see BodyTag#doStartTag + */ + + public int doStartTag() throws JspException { + return EVAL_BODY_BUFFERED; + } + + + /** + * Default processing of the end tag returning EVAL_PAGE. + * + * @return EVAL_PAGE + * @throws JspException if an error occurred while processing this tag + * @see Tag#doEndTag + */ + + public int doEndTag() throws JspException { + return super.doEndTag(); + } + + + // Actions related to body evaluation + + /** + * Prepare for evaluation of the body: stash the bodyContent away. + * + * @param b the BodyContent + * @see #doAfterBody + * @see #doInitBody() + * @see BodyTag#setBodyContent + */ + + public void setBodyContent(BodyContent b) { + this.bodyContent = b; + } + + + /** + * Prepare for evaluation of the body just before the first body evaluation: + * no action. + * + * @throws JspException if an error occurred while processing this tag + * @see #setBodyContent + * @see #doAfterBody + * @see BodyTag#doInitBody + */ + + public void doInitBody() throws JspException { + } + + + /** + * After the body evaluation: do not reevaluate and continue with the page. + * By default nothing is done with the bodyContent data (if any). + * + * @return SKIP_BODY + * @throws JspException if an error occurred while processing this tag + * @see #doInitBody + * @see BodyTag#doAfterBody + */ + + public int doAfterBody() throws JspException { + return SKIP_BODY; + } + + + /** + * Release state. + * + * @see Tag#release + */ + + public void release() { + bodyContent = null; + + super.release(); + } + + /** + * Get current bodyContent. + * + * @return the body content. + */ + + public BodyContent getBodyContent() { + return bodyContent; + } + + + /** + * Get surrounding out JspWriter. + * + * @return the enclosing JspWriter, from the bodyContent. + */ + + public JspWriter getPreviousOut() { + return bodyContent.getEnclosingWriter(); + } + + // protected fields + + /** + * The current BodyContent for this BodyTag. + */ + protected BodyContent bodyContent; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/DynamicAttributes.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/DynamicAttributes.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/DynamicAttributes.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,94 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.JspException; + +/** + * For a tag to declare that it accepts dynamic attributes, it must implement + * this interface. The entry for the tag in the Tag Library Descriptor must + * also be configured to indicate dynamic attributes are accepted. + *
    + * For any attribute that is not declared in the Tag Library Descriptor for + * this tag, instead of getting an error at translation time, the + * setDynamicAttribute() method is called, with the name and + * value of the attribute. It is the responsibility of the tag to + * remember the names and values of the dynamic attributes. + * + * @since JSP 2.0 + */ +public interface DynamicAttributes { + + /** + * Called when a tag declared to accept dynamic attributes is passed + * an attribute that is not declared in the Tag Library Descriptor. + * + * @param uri the namespace of the attribute, or null if in the default + * namespace. + * @param localName the name of the attribute being set. + * @param value the value of the attribute + * @throws JspException if the tag handler wishes to + * signal that it does not accept the given attribute. The + * container must not call doStartTag() or doTag() for this tag. + */ + public void setDynamicAttribute( + String uri, String localName, Object value ) + throws JspException; + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/FunctionInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/FunctionInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/FunctionInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,122 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Information for a function in a Tag Library. + * This class is instantiated from the Tag Library Descriptor file (TLD) + * and is available only at translation time. + * + * @since JSP 2.0 + */ +public class FunctionInfo { + + /** + * Constructor for FunctionInfo. + * + * @param name The name of the function + * @param klass The class of the function + * @param signature The signature of the function + */ + + public FunctionInfo(String name, String klass, String signature) { + + this.name = name; + this.functionClass = klass; + this.functionSignature = signature; + } + + /** + * The name of the function. + * + * @return The name of the function + */ + + public String getName() { + return name; + } + + /** + * The class of the function. + * + * @return The class of the function + */ + + public String getFunctionClass() { + return functionClass; + } + + /** + * The signature of the function. + * + * @return The signature of the function + */ + + public String getFunctionSignature() { + return functionSignature; + } + + /* + * fields + */ + + private String name; + private String functionClass; + private String functionSignature; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/IterationTag.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/IterationTag.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/IterationTag.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,161 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.*; + +/** + * The IterationTag interface extends Tag by defining one additional + * method that controls the reevaluation of its body. + * + *

    A tag handler that implements IterationTag is treated as one that + * implements Tag regarding the doStartTag() and doEndTag() methods. + * IterationTag provides a new method: doAfterBody(). + * + *

    The doAfterBody() method is invoked after every body evaluation + * to control whether the body will be reevaluated or not. If doAfterBody() + * returns IterationTag.EVAL_BODY_AGAIN, then the body will be reevaluated. + * If doAfterBody() returns Tag.SKIP_BODY, then the body will be skipped + * and doEndTag() will be evaluated instead. + * + *

    Properties + * There are no new properties in addition to those in Tag. + * + *

    Methods + * There is one new methods: doAfterBody(). + * + *

    Lifecycle + * + *

    Lifecycle details are described by the transition diagram + * below. Exceptions that are thrown during the computation of + * doStartTag(), BODY and doAfterBody() interrupt the execution + * sequence and are propagated up the stack, unless the tag handler + * implements the TryCatchFinally interface; see that interface for + * details. + * + *

    + * Lifecycle Details Transition Diagram for IterationTag + * + *

    Empty and Non-Empty Action + *

    If the TagLibraryDescriptor file indicates that the action must + * always have an empty element body, by a <body-content> entry of + * "empty", then the doStartTag() method must return SKIP_BODY. + * + *

    Note that which methods are invoked after the doStartTag() depends on + * both the return value and on if the custom action element is empty + * or not in the JSP page, not on how it's declared in the TLD. + * + *

    + * If SKIP_BODY is returned the body is not evaluated, and then doEndTag() + * is invoked. + * + *

    + * If EVAL_BODY_INCLUDE is returned, and the custom action element is not + * empty, the body is evaluated and "passed through" to the current out, + * then doAfterBody() is invoked and, after zero or more iterations, + * doEndTag() is invoked. + */ + +public interface IterationTag extends Tag { + + /** + * Request the reevaluation of some body. + * Returned from doAfterBody. + * + * For compatibility with JSP 1.1, the value is carefully selected + * to be the same as the, now deprecated, BodyTag.EVAL_BODY_TAG, + * + */ + + public final static int EVAL_BODY_AGAIN = 2; + + /** + * Process body (re)evaluation. This method is invoked by the + * JSP Page implementation object after every evaluation of + * the body into the BodyEvaluation object. The method is + * not invoked if there is no body evaluation. + * + *

    + * If doAfterBody returns EVAL_BODY_AGAIN, a new evaluation of the + * body will happen (followed by another invocation of doAfterBody). + * If doAfterBody returns SKIP_BODY, no more body evaluations will occur, + * and the doEndTag method will be invoked. + * + *

    + * If this tag handler implements BodyTag and doAfterBody returns + * SKIP_BODY, the value of out will be restored using the popBody + * method in pageContext prior to invoking doEndTag. + * + *

    + * The method re-invocations may be lead to different actions because + * there might have been some changes to shared state, or because + * of external computation. + * + *

    + * The JSP container will resynchronize the values of any AT_BEGIN and + * NESTED variables (defined by the associated TagExtraInfo or TLD) after + * the invocation of doAfterBody(). + * + * @return whether additional evaluations of the body are desired + * @throws JspException if an error occurred while processing this tag + */ + + int doAfterBody() throws JspException; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspFragment.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspFragment.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspFragment.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,124 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import java.io.IOException; +import java.io.Writer; +import javax.servlet.jsp.*; + +/** + * Encapsulates a portion of JSP code in an object that + * can be invoked as many times as needed. JSP Fragments are defined + * using JSP syntax as the body of a tag for an invocation to a SimpleTag + * handler, or as the body of a <jsp:attribute> standard action + * specifying the value of an attribute that is declared as a fragment, + * or to be of type JspFragment in the TLD. + *

    + * The definition of the JSP fragment must only contain template + * text and JSP action elements. In other words, it must not contain + * scriptlets or scriptlet expressions. At translation time, the + * container generates an implementation of the JspFragment abstract class + * capable of executing the defined fragment. + *

    + * A tag handler can invoke the fragment zero or more times, or + * pass it along to other tags, before returning. To communicate values + * to/from a JSP fragment, tag handlers store/retrieve values in + * the JspContext associated with the fragment. + *

    + * Note that tag library developers and page authors should not generate + * JspFragment implementations manually. + *

    + * Implementation Note: It is not necessary to generate a + * separate class for each fragment. One possible implementation is + * to generate a single helper class for each page that implements + * JspFragment. Upon construction, a discriminator can be passed to + * select which fragment that instance will execute. + * + * @since JSP 2.0 + */ +public abstract class JspFragment { + + /** + * Executes the fragment and directs all output to the given Writer, + * or the JspWriter returned by the getOut() method of the JspContext + * associated with the fragment if out is null. + * + * @param out The Writer to output the fragment to, or null if + * output should be sent to JspContext.getOut(). + * @throws javax.servlet.jsp.JspException Thrown if an error occured + * while invoking this fragment. + * @throws javax.servlet.jsp.SkipPageException Thrown if the page + * that (either directly or indirectly) invoked the tag handler that + * invoked this fragment is to cease evaluation. The container + * must throw this exception if a Classic Tag Handler returned + * Tag.SKIP_PAGE or if a Simple Tag Handler threw SkipPageException. + * @throws java.io.IOException If there was an error writing to the + * stream. + */ + public abstract void invoke( Writer out ) + throws JspException, IOException; + + /** + * Returns the JspContext that is bound to this JspFragment. + * + * @return The JspContext used by this fragment at invocation time. + */ + public abstract JspContext getJspContext(); + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspIdConsumer.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspIdConsumer.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspIdConsumer.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,114 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + *

    This interface indicates to the container that a tag handler + * wishes to be provided with a + * compiler generated ID.

    + *

    The container sets the jspId + * attribute + * of the tag handler with an identification string, as part of tag + * property initialization. Each tag in a JSP page has a unique + * jspId, and a given tag in a JSP page always has the same + * jspId, + * even for multiple requests to the page. + *

    + *

    + * Tag handler instances that implement JspIdConsumer + * cannot be reused. + *

    + *

    + * Even though the jspId attribute is similar in concept to + * the jsp:id + * attribute of an XML view (see Section JSP.10.1.13 of the spec), they are + * not related. + * The jsp:id attribute is available only at translation time, + * and the jspId + * attribute is avalable only at request time. + *

    + *

    + * The JSP container must provide a value for jspId that + * conforms to the following rules: + *

      + *
    • It must start with a letter (as defined by the Character.isLetter() + * method) or underscore ('_'). + *
    • Subsequent characters may be letters (as defined by the Character.isLetter() + * method), digits (as defined by the Character.isDigit() method), dashes ('-'), + * or underscores ('_') + *
    + *

    + *

    + * Note that the rules exclude colons ':' in a jspId, + * and that they are + * the same rules used for a component ID in JavaServer Faces. + *

    + * + * @since JSP 2.1 + */ + +public interface JspIdConsumer { + + /** + * Called by the container generated code to set a value for the + * jspId attribute. An unique identification string, relative to + * this page, is generated at translation time. + */ + public void setJspId(String id); +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspTag.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspTag.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/JspTag.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,68 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Serves as a base class for Tag and SimpleTag. + * This is mostly for organizational and type-safety purposes. + * + * @since JSP 2.0 + */ +public interface JspTag { +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/PageData.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/PageData.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/PageData.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,89 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import java.io.InputStream; + +/** + * Translation-time information on a JSP page. The information + * corresponds to the XML view of the JSP page. + * + *

    + * Objects of this type are generated by the JSP translator, e.g. + * when being pased to a TagLibraryValidator instance. + */ + +abstract public class PageData { + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public PageData() { + } + + /** + * Returns an input stream on the XML view of a JSP page. + * The stream is encoded in UTF-8. Recall tht the XML view of a + * JSP page has the include directives expanded. + * + * @return An input stream on the document. + */ + abstract public InputStream getInputStream(); +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/SimpleTag.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/SimpleTag.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/SimpleTag.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,182 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.JspContext; + +/** + * Interface for defining Simple Tag Handlers. + * + *

    Simple Tag Handlers differ from Classic Tag Handlers in that instead + * of supporting doStartTag() and doEndTag(), + * the SimpleTag interface provides a simple + * doTag() method, which is called once and only once for any + * given tag invocation. All tag logic, iteration, body evaluations, etc. + * are to be performed in this single method. Thus, simple tag handlers + * have the equivalent power of BodyTag, but with a much + * simpler lifecycle and interface.

    + * + *

    To support body content, the setJspBody() + * method is provided. The container invokes the setJspBody() + * method with a JspFragment object encapsulating the body of + * the tag. The tag handler implementation can call + * invoke() on that fragment to evaluate the body as + * many times as it needs.

    + * + *

    A SimpleTag handler must have a public no-args constructor. Most + * SimpleTag handlers should extend SimpleTagSupport.

    + * + *

    Lifecycle

    + * + *

    The following is a non-normative, brief overview of the + * SimpleTag lifecycle. Refer to the JSP Specification for details.

    + * + *
      + *
    1. A new tag handler instance is created each time by the container + * by calling the provided zero-args constructor. Unlike classic + * tag handlers, simple tag handlers are never cached and reused by + * the JSP container.
    2. + *
    3. The setJspContext() and setParent() + * methods are called by the container. The setParent() + * method is only called if the element is nested within another tag + * invocation.
    4. + *
    5. The setters for each attribute defined for this tag are called + * by the container.
    6. + *
    7. If a body exists, the setJspBody() method is called + * by the container to set the body of this tag, as a + * JspFragment. If the action element is empty in + * the page, this method is not called at all.
    8. + *
    9. The doTag() method is called by the container. All + * tag logic, iteration, body evaluations, etc. occur in this + * method.
    10. + *
    11. The doTag() method returns and all variables are + * synchronized.
    12. + *
    + * + * @see SimpleTagSupport + * @since JSP 2.0 + */ +public interface SimpleTag extends JspTag { + + /** + * Called by the container to invoke this tag. + * The implementation of this method is provided by the tag library + * developer, and handles all tag processing, body iteration, etc. + * + *

    + * The JSP container will resynchronize any AT_BEGIN and AT_END + * variables (defined by the associated tag file, TagExtraInfo, or TLD) + * after the invocation of doTag(). + * + * @throws javax.servlet.jsp.JspException If an error occurred + * while processing this tag. + * @throws javax.servlet.jsp.SkipPageException If the page that + * (either directly or indirectly) invoked this tag is to + * cease evaluation. A Simple Tag Handler generated from a + * tag file must throw this exception if an invoked Classic + * Tag Handler returned SKIP_PAGE or if an invoked Simple + * Tag Handler threw SkipPageException or if an invoked Jsp Fragment + * threw a SkipPageException. + * @throws java.io.IOException If there was an error writing to the + * output stream. + */ + public void doTag() + throws javax.servlet.jsp.JspException, java.io.IOException; + + /** + * Sets the parent of this tag, for collaboration purposes. + *

    + * The container invokes this method only if this tag invocation is + * nested within another tag invocation. + * + * @param parent the tag that encloses this tag + */ + public void setParent( JspTag parent ); + + /** + * Returns the parent of this tag, for collaboration purposes. + * + * @return the parent of this tag + */ + public JspTag getParent(); + + /** + * Called by the container to provide this tag handler with + * the JspContext for this invocation. + * An implementation should save this value. + * + * @param pc the page context for this invocation + * @see Tag#setPageContext + */ + public void setJspContext( JspContext pc ); + + /** + * Provides the body of this tag as a JspFragment object, able to be + * invoked zero or more times by the tag handler. + *

    + * This method is invoked by the JSP page implementation + * object prior to doTag(). If the action element is + * empty in the page, this method is not called at all. + * + * @param jspBody The fragment encapsulating the body of this tag. + */ + public void setJspBody( JspFragment jspBody ); + + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/SimpleTagSupport.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/SimpleTagSupport.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/SimpleTagSupport.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,255 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.JspContext; +import javax.servlet.jsp.JspException; +import java.io.IOException; + +/** + * A base class for defining tag handlers implementing SimpleTag. + *

    + * The SimpleTagSupport class is a utility class intended to be used + * as the base class for new simple tag handlers. The SimpleTagSupport + * class implements the SimpleTag interface and adds additional + * convenience methods including getter methods for the properties in + * SimpleTag. + * + * @since JSP 2.0 + */ +public class SimpleTagSupport + implements SimpleTag +{ + /** Reference to the enclosing tag. */ + private JspTag parentTag; + + /** The JSP context for the upcoming tag invocation. */ + private JspContext jspContext; + + /** The body of the tag. */ + private JspFragment jspBody; + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public SimpleTagSupport() { + } + + /** + * Default processing of the tag does nothing. + * + * @throws JspException Subclasses can throw JspException to indicate + * an error occurred while processing this tag. + * @throws javax.servlet.jsp.SkipPageException If the page that + * (either directly or indirectly) invoked this tag is to + * cease evaluation. A Simple Tag Handler generated from a + * tag file must throw this exception if an invoked Classic + * Tag Handler returned SKIP_PAGE or if an invoked Simple + * Tag Handler threw SkipPageException or if an invoked Jsp Fragment + * threw a SkipPageException. + * @throws IOException Subclasses can throw IOException if there was + * an error writing to the output stream + * @see SimpleTag#doTag() + */ + public void doTag() + throws JspException, IOException + { + } + + /** + * Sets the parent of this tag, for collaboration purposes. + *

    + * The container invokes this method only if this tag invocation is + * nested within another tag invocation. + * + * @param parent the tag that encloses this tag + */ + public void setParent( JspTag parent ) { + this.parentTag = parent; + } + + /** + * Returns the parent of this tag, for collaboration purposes. + * + * @return the parent of this tag + */ + public JspTag getParent() { + return this.parentTag; + } + + /** + * Stores the provided JSP context in the private jspContext field. + * Subclasses can access the JspContext via + * getJspContext(). + * + * @param pc the page context for this invocation + * @see SimpleTag#setJspContext + */ + public void setJspContext( JspContext pc ) { + this.jspContext = pc; + } + + /** + * Returns the page context passed in by the container via + * setJspContext. + * + * @return the page context for this invocation + */ + protected JspContext getJspContext() { + return this.jspContext; + } + + /** + * Stores the provided JspFragment. + * + * @param jspBody The fragment encapsulating the body of this tag. + * If the action element is empty in the page, this method is + * not called at all. + * @see SimpleTag#setJspBody + */ + public void setJspBody( JspFragment jspBody ) { + this.jspBody = jspBody; + } + + /** + * Returns the body passed in by the container via setJspBody. + * + * @return the fragment encapsulating the body of this tag, or + * null if the action element is empty in the page. + */ + protected JspFragment getJspBody() { + return this.jspBody; + } + + /** + * Find the instance of a given class type that is closest to a given + * instance. + * This method uses the getParent method from the Tag and/or SimpleTag + * interfaces. This method is used for coordination among + * cooperating tags. + * + *

    For every instance of TagAdapter + * encountered while traversing the ancestors, the tag handler returned by + * TagAdapter.getAdaptee() - instead of the TagAdpater itself - + * is compared to klass. If the tag handler matches, it - and + * not its TagAdapter - is returned. + * + *

    + * The current version of the specification only provides one formal + * way of indicating the observable type of a tag handler: its + * tag handler implementation class, described in the tag-class + * subelement of the tag element. This is extended in an + * informal manner by allowing the tag library author to + * indicate in the description subelement an observable type. + * The type should be a subtype of the tag handler implementation + * class or void. + * This addititional constraint can be exploited by a + * specialized container that knows about that specific tag library, + * as in the case of the JSP standard tag library. + * + *

    + * When a tag library author provides information on the + * observable type of a tag handler, client programmatic code + * should adhere to that constraint. Specifically, the Class + * passed to findAncestorWithClass should be a subtype of the + * observable type. + * + * + * @param from The instance from where to start looking. + * @param klass The subclass of JspTag or interface to be matched + * @return the nearest ancestor that implements the interface + * or is an instance of the class specified + */ + public static final JspTag findAncestorWithClass( + JspTag from, Class klass) + { + boolean isInterface = false; + + if (from == null || klass == null + || (!JspTag.class.isAssignableFrom(klass) + && !(isInterface = klass.isInterface()))) { + return null; + } + + for (;;) { + JspTag parent = null; + if( from instanceof SimpleTag ) { + parent = ((SimpleTag)from).getParent(); + } + else if( from instanceof Tag ) { + parent = ((Tag)from).getParent(); + } + if (parent == null) { + return null; + } + + if (parent instanceof TagAdapter) { + parent = ((TagAdapter) parent).getAdaptee(); + } + + if ((isInterface && klass.isInstance(parent)) + || klass.isAssignableFrom(parent.getClass())) { + return parent; + } + + from = parent; + } + } +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/Tag.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/Tag.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/Tag.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,304 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.*; + + +/** + * The interface of a classic tag handler that does not want to manipulate + * its body. The Tag interface defines the basic protocol between a Tag + * handler and JSP page implementation class. It defines the life cycle + * and the methods to be invoked at start and end tag. + * + *

    Properties

    + * + *

    The Tag interface specifies the setter and getter methods for the core + * pageContext and parent properties.

    + * + *

    The JSP page implementation object invokes setPageContext and + * setParent, in that order, before invoking doStartTag() or doEndTag().

    + * + *

    Methods

    + * + *

    There are two main actions: doStartTag and doEndTag. Once all + * appropriate properties have been initialized, the doStartTag and + * doEndTag methods can be invoked on the tag handler. Between these + * invocations, the tag handler is assumed to hold a state that must + * be preserved. After the doEndTag invocation, the tag handler is + * available for further invocations (and it is expected to have + * retained its properties).

    + * + *

    Lifecycle

    + * + *

    Lifecycle details are described by the transition diagram below, + * with the following comments: + *

      + *
    • [1] This transition is intended to be for releasing long-term data. + * no guarantees are assumed on whether any properties have been retained + * or not. + *
    • [2] This transition happens if and only if the tag ends normally + * without raising an exception + *
    • [3] Some setters may be called again before a tag handler is + * reused. For instance, setParent() is called if it's + * reused within the same page but at a different level, + * setPageContext() is called if it's used in another page, + * and attribute setters are called if the values differ or are expressed + * as request-time attribute values. + *
    • Check the TryCatchFinally interface for additional details related + * to exception handling and resource management. + *

    + * + * Lifecycle Details Transition Diagram for Tag + * + *

    Once all invocations on the tag handler + * are completed, the release method is invoked on it. Once a release + * method is invoked all properties, including parent and + * pageContext, are assumed to have been reset to an unspecified value. + * The page compiler guarantees that release() will be invoked on the Tag + * handler before the handler is released to the GC.

    + * + *

    Empty and Non-Empty Action

    + *

    If the TagLibraryDescriptor file indicates that the action must + * always have an empty action, by an <body-content> entry of "empty", + * then the doStartTag() method must return SKIP_BODY.

    + * + *

    Otherwise, the doStartTag() method may return SKIP_BODY or + * EVAL_BODY_INCLUDE.

    + * + *

    If SKIP_BODY is returned the body, if present, is not evaluated.

    + * + *

    If EVAL_BODY_INCLUDE is returned, the body is evaluated and + * "passed through" to the current out.

    +*/ + +public interface Tag extends JspTag { + + /** + * Skip body evaluation. + * Valid return value for doStartTag and doAfterBody. + */ + + public final static int SKIP_BODY = 0; + + /** + * Evaluate body into existing out stream. + * Valid return value for doStartTag. + */ + + public final static int EVAL_BODY_INCLUDE = 1; + + /** + * Skip the rest of the page. + * Valid return value for doEndTag. + */ + + public final static int SKIP_PAGE = 5; + + /** + * Continue evaluating the page. + * Valid return value for doEndTag(). + */ + + public final static int EVAL_PAGE = 6; + + // Setters for Tag handler data + + + /** + * Set the current page context. + * This method is invoked by the JSP page implementation object + * prior to doStartTag(). + *

    + * This value is *not* reset by doEndTag() and must be explicitly reset + * by a page implementation if it changes between calls to doStartTag(). + * + * @param pc The page context for this tag handler. + */ + + void setPageContext(PageContext pc); + + + /** + * Set the parent (closest enclosing tag handler) of this tag handler. + * Invoked by the JSP page implementation object prior to doStartTag(). + *

    + * This value is *not* reset by doEndTag() and must be explicitly reset + * by a page implementation. + * + * @param t The parent tag, or null. + */ + + + void setParent(Tag t); + + + /** + * Get the parent (closest enclosing tag handler) for this tag handler. + * + *

    + * The getParent() method can be used to navigate the nested tag + * handler structure at runtime for cooperation among custom actions; + * for example, the findAncestorWithClass() method in TagSupport + * provides a convenient way of doing this. + * + *

    + * The current version of the specification only provides one formal + * way of indicating the observable type of a tag handler: its + * tag handler implementation class, described in the tag-class + * subelement of the tag element. This is extended in an + * informal manner by allowing the tag library author to + * indicate in the description subelement an observable type. + * The type should be a subtype of the tag handler implementation + * class or void. + * This addititional constraint can be exploited by a + * specialized container that knows about that specific tag library, + * as in the case of the JSP standard tag library. + * + * @return the current parent, or null if none. + * @see TagSupport#findAncestorWithClass + */ + + Tag getParent(); + + + // Actions for basic start/end processing. + + + /** + * Process the start tag for this instance. + * This method is invoked by the JSP page implementation object. + * + *

    + * The doStartTag method assumes that the properties pageContext and + * parent have been set. It also assumes that any properties exposed as + * attributes have been set too. When this method is invoked, the body + * has not yet been evaluated. + * + *

    + * This method returns Tag.EVAL_BODY_INCLUDE or + * BodyTag.EVAL_BODY_BUFFERED to indicate + * that the body of the action should be evaluated or SKIP_BODY to + * indicate otherwise. + * + *

    + * When a Tag returns EVAL_BODY_INCLUDE the result of evaluating + * the body (if any) is included into the current "out" JspWriter as it + * happens and then doEndTag() is invoked. + * + *

    + * BodyTag.EVAL_BODY_BUFFERED is only valid if the tag handler + * implements BodyTag. + * + *

    + * The JSP container will resynchronize the values of any AT_BEGIN and + * NESTED variables (defined by the associated TagExtraInfo or TLD) + * after the invocation of doStartTag(), except for a tag handler + * implementing BodyTag whose doStartTag() method returns + * BodyTag.EVAL_BODY_BUFFERED. + * + * @return EVAL_BODY_INCLUDE if the tag wants to process body, SKIP_BODY + * if it does not want to process it. + * @throws JspException if an error occurred while processing this tag + * @see BodyTag + */ + + int doStartTag() throws JspException; + + + /** + * Process the end tag for this instance. + * This method is invoked by the JSP page implementation object + * on all Tag handlers. + * + *

    + * This method will be called after returning from doStartTag. The + * body of the action may or may not have been evaluated, depending on + * the return value of doStartTag. + * + *

    + * If this method returns EVAL_PAGE, the rest of the page continues + * to be evaluated. If this method returns SKIP_PAGE, the rest of + * the page is not evaluated, the request is completed, and + * the doEndTag() methods of enclosing tags are not invoked. If this + * request was forwarded or included from another page (or Servlet), + * only the current page evaluation is stopped. + * + *

    + * The JSP container will resynchronize the values of any AT_BEGIN and + * AT_END variables (defined by the associated TagExtraInfo or TLD) + * after the invocation of doEndTag(). + * + * @return indication of whether to continue evaluating the JSP page. + * @throws JspException if an error occurred while processing this tag + */ + + int doEndTag() throws JspException; + + /** + * Called on a Tag handler to release state. + * The page compiler guarantees that JSP page implementation + * objects will invoke this method on all tag handlers, + * but there may be multiple invocations on doStartTag and doEndTag in between. + */ + + void release(); + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagAdapter.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagAdapter.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagAdapter.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,200 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.*; + + +/** + * Wraps any SimpleTag and exposes it using a Tag interface. This is used + * to allow collaboration between classic Tag handlers and SimpleTag + * handlers. + *

    + * Because SimpleTag does not extend Tag, and because Tag.setParent() + * only accepts a Tag instance, a classic tag handler (one + * that implements Tag) cannot have a SimpleTag as its parent. To remedy + * this, a TagAdapter is created to wrap the SimpleTag parent, and the + * adapter is passed to setParent() instead. A classic Tag Handler can + * call getAdaptee() to retrieve the encapsulated SimpleTag instance. + * + * @since JSP 2.0 + */ +public class TagAdapter + implements Tag +{ + /** The simple tag that's being adapted. */ + private SimpleTag simpleTagAdaptee; + + /** The parent, of this tag, converted (if necessary) to be of type Tag. */ + private Tag parent; + + // Flag indicating whether we have already determined the parent + private boolean parentDetermined; + + /** + * Creates a new TagAdapter that wraps the given SimpleTag and + * returns the parent tag when getParent() is called. + * + * @param adaptee The SimpleTag being adapted as a Tag. + */ + public TagAdapter( SimpleTag adaptee ) { + if( adaptee == null ) { + // Cannot wrap a null adaptee. + throw new IllegalArgumentException(); + } + this.simpleTagAdaptee = adaptee; + } + + /** + * Must not be called. + * + * @param pc ignored. + * @throws UnsupportedOperationException Must not be called + */ + public void setPageContext(PageContext pc) { + throw new UnsupportedOperationException( + "Illegal to invoke setPageContext() on TagAdapter wrapper" ); + } + + + /** + * Must not be called. The parent of this tag is always + * getAdaptee().getParent(). + * + * @param parentTag ignored. + * @throws UnsupportedOperationException Must not be called. + */ + public void setParent( Tag parentTag ) { + throw new UnsupportedOperationException( + "Illegal to invoke setParent() on TagAdapter wrapper" ); + } + + + /** + * Returns the parent of this tag, which is always + * getAdaptee().getParent(). + * + * This will either be the enclosing Tag (if getAdaptee().getParent() + * implements Tag), or an adapter to the enclosing Tag (if + * getAdaptee().getParent() does not implement Tag). + * + * @return The parent of the tag being adapted. + */ + public Tag getParent() { + if (!parentDetermined) { + JspTag adapteeParent = simpleTagAdaptee.getParent(); + if (adapteeParent != null) { + if (adapteeParent instanceof Tag) { + this.parent = (Tag) adapteeParent; + } else { + // Must be SimpleTag - no other types defined. + this.parent = new TagAdapter((SimpleTag) adapteeParent); + } + } + parentDetermined = true; + } + + return this.parent; + } + + /** + * Gets the tag that is being adapted to the Tag interface. + * This should be an instance of SimpleTag in JSP 2.0, but room + * is left for other kinds of tags in future spec versions. + * + * @return the tag that is being adapted + */ + public JspTag getAdaptee() { + return this.simpleTagAdaptee; + } + + /** + * Must not be called. + * + * @return always throws UnsupportedOperationException + * @throws UnsupportedOperationException Must not be called + * @throws JspException never thrown + */ + public int doStartTag() throws JspException { + throw new UnsupportedOperationException( + "Illegal to invoke doStartTag() on TagAdapter wrapper" ); + } + + /** + * Must not be called. + * + * @return always throws UnsupportedOperationException + * @throws UnsupportedOperationException Must not be called + * @throws JspException never thrown + */ + public int doEndTag() throws JspException { + throw new UnsupportedOperationException( + "Illegal to invoke doEndTag() on TagAdapter wrapper" ); + } + + /** + * Must not be called. + * + * @throws UnsupportedOperationException Must not be called + */ + public void release() { + throw new UnsupportedOperationException( + "Illegal to invoke release() on TagAdapter wrapper" ); + } +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagAttributeInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagAttributeInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagAttributeInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,365 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Information on the attributes of a Tag, available at translation time. + * This class is instantiated from the Tag Library Descriptor file (TLD). + *

    + * Only the information needed to generate code is included here. Other information + * like SCHEMA for validation belongs elsewhere. + *

    + * Note from the Expert Group:
    + * This should have been designed as an interface. Every time we change the TLD, + * we need to add a new constructor to this class (not good). + * This class should only be instantiated by container implementations + * (not by JSP developers). + */ + +public class TagAttributeInfo { + /** + * "id" is wired in to be ID. There is no real benefit in having it be something else + * IDREFs are not handled any differently. + */ + + public static final String ID = "id"; + + /** + * Constructor for TagAttributeInfo. + * This class is to be instantiated only from the + * TagLibrary code under request from some JSP code that is parsing a + * TLD (Tag Library Descriptor). + * + * @param name The name of the attribute. + * @param required If this attribute is required in tag instances. + * @param type The name of the type of the attribute. + * @param reqTime Whether this attribute holds a request-time Attribute. + */ + + public TagAttributeInfo(String name, boolean required, + String type, boolean reqTime) { + this.name = name; + this.required = required; + this.type = type; + this.reqTime = reqTime; + } + + /** + * JSP 2.0 Constructor for TagAttributeInfo. + * This class is to be instantiated only from the + * TagLibrary code under request from some JSP code that is parsing a + * TLD (Tag Library Descriptor). + * + * @param name The name of the attribute. + * @param required If this attribute is required in tag instances. + * @param type The name of the type of the attribute. + * @param reqTime Whether this attribute holds a request-time Attribute. + * @param fragment Whether this attribute is of type JspFragment + * + * @since JSP 2.0 + */ + public TagAttributeInfo(String name, boolean required, + String type, boolean reqTime, + boolean fragment) { + this( name, required, type, reqTime ); + this.fragment = fragment; + } + + /** + * JSP 2.1 Constructor for TagAttributeInfo. + * This class is to be instantiated only from the + * TagLibrary code under request from some JSP code that is parsing a + * TLD (Tag Library Descriptor). + * + * @param name The name of the attribute. + * @param required If this attribute is required in tag instances. + * @param type The name of the type of the attribute. + * @param reqTime Whether this attribute holds a request-time Attribute. + * @param fragment Whether this attribute is of type JspFragment + * @param description The description of the attribute. + * @param deferredValue Whether this attribute is a deferred value. + * @param deferredMethod Whether this attribute is a deferred method. + * rtexpr or deferred value. + * @param expectedTypeName The name of the expected type of this deferred + * value (or null if this is not a deferred value). + * @param methodSignature The expected method signature of this deferred + * method (or null if this is not a deferred method). + * + * @since JSP 2.1 + */ + public TagAttributeInfo(String name, + boolean required, + String type, + boolean reqTime, + boolean fragment, + String description, + boolean deferredValue, + boolean deferredMethod, + String expectedTypeName, + String methodSignature) + { + this( name, required, type, reqTime, fragment ); + this.description = description; + this.deferredValue = deferredValue; + this.deferredMethod = deferredMethod; + this.expectedTypeName = expectedTypeName; + this.methodSignature = methodSignature; + } + + /** + * The name of this attribute. + * + * @return the name of the attribute + */ + + public String getName() { + return name; + } + + /** + * The type (as a String) of this attribute. + * + *

    This method must return "javax.el.ValueExpression" + * if isDeferredValue() returns true and + * canBeRequestTime() returns false. It + * must return "javax.el.MethodExpression" if + * isDeferredMethod() returns true. + * It must return "java.lang.Object" if + * isDeferredValue() returns true and + * canBeRequestTime() returns true. + *

    + * + * @return the type of the attribute + */ + + public String getTypeName() { + return type; + } + + /** + * Whether this attribute has been specified in the TLD + * as rtexprvalue. If true, this means the attribute + * can hold a request-time value. + * + * @return true if the attribute has been specified in the TLD + * as rtexprvalue + */ + + public boolean canBeRequestTime() { + return reqTime; + } + + /** + * Whether this attribute is required. + * + * @return if the attribute is required. + */ + public boolean isRequired() { + return required; + } + + /** + * Convenience static method that goes through an array of TagAttributeInfo + * objects and looks for "id". + * + * @param a An array of TagAttributeInfo + * @return The TagAttributeInfo reference with name "id" + */ + public static TagAttributeInfo getIdAttribute(TagAttributeInfo a[]) { + for (int i=0; itrue if this attribute is to be passed a + * ValueExpression so that expression evaluation + * can be deferred. + * + *

    If this method returns true, then + * getTypeName() must return + * "javax.el.ValueExpression".

    + * + *

    The getExpectedType() method can be used to retrieve + * the expected type this value expression will be constructed with.

    + * + * @return true if this attribute accepts a deferred value; + * false otherwise. + * + * @since JSP 2.1 + */ + public boolean isDeferredValue() { + return deferredValue; + } + + /** + * Returns true if this attribute is to be passed a + * MethodExpression so that expression evaluation + * can be deferred. + * + *

    If this method returns true, then + * getTypeName() must return + * "javax.el.MethodExpression".

    + * + *

    The getMethodSignature() method can be used to retrieve + * the expected method signature this method expression will be + * constructed with.

    + * + * @return true if this attribute accepts a deferred method; + * false otherwise. + * + * @since JSP 2.1 + */ + public boolean isDeferredMethod() { + return deferredMethod; + } + + /** + * Returns the name of the expected type (as a String) of this + * deferred value attribute. + * + *

    This method returns null if + * isDeferredValue() returns false.

    + * + * @return the name of the expected type + * @since JSP 2.1 + */ + public String getExpectedTypeName() { + return expectedTypeName; + } + + /** + * Returns the expected method signature of this deferred method attribute. + * + *

    This method returns null if + * isDeferredMethod() returns false.

    + * + * @return the method signature + * @since JSP 2.1 + */ + public String getMethodSignature() { + return methodSignature; + } + + /** + * Returns a String representation of this TagAttributeInfo, suitable + * for debugging purposes. + * + * @return a String representation of this TagAttributeInfo + */ + public String toString() { + StringBuffer b = new StringBuffer(); + b.append("name = "+name+" "); + b.append("type = "+type+" "); + b.append("reqTime = "+reqTime+" "); + b.append("required = "+required+" "); + b.append("fragment = "+fragment+" "); + b.append("deferredValue = "+deferredValue+" "); + b.append("deferredMethod = "+deferredMethod+" "); + b.append("expectedTypeName = "+expectedTypeName+" "); + b.append("methodSignature = "+methodSignature+" "); + return b.toString(); + } + + /* + * private fields + */ + private String name; + private String type; + private boolean reqTime; + private boolean required; + + /* + * private fields for JSP 2.0 + */ + private boolean fragment; + + /* + * private fields for JSP 2.1 + */ + private boolean deferredValue; + private boolean deferredMethod; + private String expectedTypeName; + private String methodSignature; + private String description; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagData.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagData.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagData.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,195 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import java.util.Hashtable; + +/** + * The (translation-time only) attribute/value information for a tag instance. + * + *

    + * TagData is only used as an argument to the isValid, validate, and + * getVariableInfo methods of TagExtraInfo, which are invoked at + * translation time. + */ + +public class TagData implements Cloneable { + + /** + * Distinguished value for an attribute to indicate its value + * is a request-time expression (which is not yet available because + * TagData instances are used at translation-time). + */ + + public static final Object REQUEST_TIME_VALUE = new Object(); + + + /** + * Constructor for TagData. + * + *

    + * A typical constructor may be + *

    +     * static final Object[][] att = {{"connection", "conn0"}, {"id", "query0"}};
    +     * static final TagData td = new TagData(att);
    +     * 
    + * + * All values must be Strings except for those holding the + * distinguished object REQUEST_TIME_VALUE. + + * @param atts the static attribute and values. May be null. + */ + public TagData(Object[] atts[]) { + if (atts == null) { + attributes = new Hashtable(); + } else { + attributes = new Hashtable(atts.length); + } + + if (atts != null) { + for (int i = 0; i < atts.length; i++) { + attributes.put((String)atts[i][0], atts[i][1]); + } + } + } + + /** + * Constructor for a TagData. + * + * If you already have the attributes in a hashtable, use this + * constructor. + * + * @param attrs A hashtable to get the values from. + */ + public TagData(Hashtable attrs) { + this.attributes = attrs; + } + + /** + * The value of the tag's id attribute. + * + * @return the value of the tag's id attribute, or null if no such + * attribute was specified. + */ + + public String getId() { + return getAttributeString(TagAttributeInfo.ID); + } + + /** + * The value of the attribute. + * If a static value is specified for an attribute that accepts a + * request-time attribute expression then that static value is returned, + * even if the value is provided in the body of a <jsp:attribute> action. + * The distinguished object REQUEST_TIME_VALUE is only returned if + * the value is specified as a request-time attribute expression + * or via the <jsp:attribute> action with a body that contains + * dynamic content (scriptlets, scripting expressions, EL expressions, + * standard actions, or custom actions). Returns null if the attribute + * is not set. + * + * @param attName the name of the attribute + * @return the attribute's value + */ + + public Object getAttribute(String attName) { + return attributes.get(attName); + } + + /** + * Set the value of an attribute. + * + * @param attName the name of the attribute + * @param value the value. + */ + public void setAttribute(String attName, + Object value) { + attributes.put(attName, value); + } + + /** + * Get the value for a given attribute. + * + * @param attName the name of the attribute + * @return the attribute value string + * @throws ClassCastException if attribute value is not a String + */ + + public String getAttributeString(String attName) { + Object o = attributes.get(attName); + if (o == null) { + return null; + } else { + return (String) o; + } + } + + /** + * Enumerates the attributes. + * + *@return An enumeration of the attributes in a TagData + */ + public java.util.Enumeration getAttributes() { + return attributes.keys(); + }; + + // private data + + private Hashtable attributes; // the tagname/value map +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagExtraInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagExtraInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagExtraInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,184 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Optional class provided by the tag library author to describe additional + * translation-time information not described in the TLD. + * The TagExtraInfo class is mentioned in the Tag Library Descriptor file (TLD). + * + *

    + * This class can be used: + *

      + *
    • to indicate that the tag defines scripting variables + *
    • to perform translation-time validation of the tag attributes. + *
    + * + *

    + * It is the responsibility of the JSP translator that the initial value + * to be returned by calls to getTagInfo() corresponds to a TagInfo + * object for the tag being translated. If an explicit call to + * setTagInfo() is done, then the object passed will be returned in + * subsequent calls to getTagInfo(). + * + *

    + * The only way to affect the value returned by getTagInfo() + * is through a setTagInfo() call, and thus, TagExtraInfo.setTagInfo() is + * to be called by the JSP translator, with a TagInfo object that + * corresponds to the tag being translated. The call should happen before + * any invocation on validate() and before any invocation on + * getVariableInfo(). + * + *

    + * NOTE: It is a (translation time) error for a tag definition + * in a TLD with one or more variable subelements to have an associated + * TagExtraInfo implementation that returns a VariableInfo array with + * one or more elements from a call to getVariableInfo(). + */ + +public abstract class TagExtraInfo { + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public TagExtraInfo() { + } + + /** + * information on scripting variables defined by the tag associated with + * this TagExtraInfo instance. + * Request-time attributes are indicated as such in the TagData parameter. + * + * @param data The TagData instance. + * @return An array of VariableInfo data, or null or a zero length array + * if no scripting variables are to be defined. + */ + public VariableInfo[] getVariableInfo(TagData data) { + return ZERO_VARIABLE_INFO; + } + + /** + * Translation-time validation of the attributes. + * Request-time attributes are indicated as such in the TagData parameter. + * Note that the preferred way to do validation is with the validate() + * method, since it can return more detailed information. + * + * @param data The TagData instance. + * @return Whether this tag instance is valid. + * @see TagExtraInfo#validate + */ + + public boolean isValid(TagData data) { + return true; + } + + /** + * Translation-time validation of the attributes. + * Request-time attributes are indicated as such in the TagData parameter. + * Because of the higher quality validation messages possible, + * this is the preferred way to do validation (although isValid() + * still works). + * + *

    JSP 2.0 and higher containers call validate() instead of isValid(). + * The default implementation of this method is to call isValid(). If + * isValid() returns false, a generic ValidationMessage[] is returned + * indicating isValid() returned false.

    + * + * @param data The TagData instance. + * @return A null object, or zero length array if no errors, an + * array of ValidationMessages otherwise. + * @since JSP 2.0 + */ + public ValidationMessage[] validate( TagData data ) { + ValidationMessage[] result = null; + + if( !isValid( data ) ) { + result = new ValidationMessage[] { + new ValidationMessage( data.getId(), "isValid() == false" ) }; + } + + return result; + } + + /** + * Set the TagInfo for this class. + * + * @param tagInfo The TagInfo this instance is extending + */ + public final void setTagInfo(TagInfo tagInfo) { + this.tagInfo = tagInfo; + } + + /** + * Get the TagInfo for this class. + * + * @return the taginfo instance this instance is extending + */ + public final TagInfo getTagInfo() { + return tagInfo; + } + + // private data + private TagInfo tagInfo; + + // zero length VariableInfo array + private static final VariableInfo[] ZERO_VARIABLE_INFO = { }; +} + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagFileInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagFileInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagFileInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,126 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Tag information for a tag file in a Tag Library; + * This class is instantiated from the Tag Library Descriptor file (TLD) + * and is available only at translation time. + * + * @since JSP 2.0 + */ +public class TagFileInfo { + + /** + * Constructor for TagFileInfo from data in the JSP 2.0 format for TLD. + * This class is to be instantiated only from the TagLibrary code + * under request from some JSP code that is parsing a + * TLD (Tag Library Descriptor). + * + * Note that, since TagLibibraryInfo reflects both TLD information + * and taglib directive information, a TagFileInfo instance is + * dependent on a taglib directive. This is probably a + * design error, which may be fixed in the future. + * + * @param name The unique action name of this tag + * @param path Where to find the .tag file implementing this + * action, relative to the location of the TLD file. + * @param tagInfo The detailed information about this tag, as parsed + * from the directives in the tag file. + */ + public TagFileInfo( String name, String path, TagInfo tagInfo ) { + this.name = name; + this.path = path; + this.tagInfo = tagInfo; + } + + /** + * The unique action name of this tag. + * + * @return The (short) name of the tag. + */ + public String getName() { + return name; + } + + /** + * Where to find the .tag file implementing this action. + * + * @return The path of the tag file, relative to the TLD, or "." if + * the tag file was defined in an implicit tag file. + */ + public String getPath() { + return path; + } + + /** + * Returns information about this tag, parsed from the directives + * in the tag file. + * + * @return a TagInfo object containing information about this tag + */ + public TagInfo getTagInfo() { + return tagInfo; + } + + // private fields for 2.0 info + private String name; + private String path; + private TagInfo tagInfo; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,487 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Tag information for a tag in a Tag Library; + * This class is instantiated from the Tag Library Descriptor file (TLD) + * and is available only at translation time. + * + * +*/ + +public class TagInfo { + + /** + * Static constant for getBodyContent() when it is JSP. + */ + + public static final String BODY_CONTENT_JSP = "JSP"; + + /** + * Static constant for getBodyContent() when it is Tag dependent. + */ + + public static final String BODY_CONTENT_TAG_DEPENDENT = "tagdependent"; + + + /** + * Static constant for getBodyContent() when it is empty. + */ + + public static final String BODY_CONTENT_EMPTY = "empty"; + + /** + * Static constant for getBodyContent() when it is scriptless. + * + * @since JSP 2.0 + */ + public static final String BODY_CONTENT_SCRIPTLESS = "scriptless"; + + /** + * Constructor for TagInfo from data in the JSP 1.1 format for TLD. + * This class is to be instantiated only from the TagLibrary code + * under request from some JSP code that is parsing a + * TLD (Tag Library Descriptor). + * + * Note that, since TagLibibraryInfo reflects both TLD information + * and taglib directive information, a TagInfo instance is + * dependent on a taglib directive. This is probably a + * design error, which may be fixed in the future. + * + * @param tagName The name of this tag + * @param tagClassName The name of the tag handler class + * @param bodycontent Information on the body content of these tags + * @param infoString The (optional) string information for this tag + * @param taglib The instance of the tag library that contains us. + * @param tagExtraInfo The instance providing extra Tag info. May be null + * @param attributeInfo An array of AttributeInfo data from descriptor. + * May be null; + * + */ + public TagInfo(String tagName, + String tagClassName, + String bodycontent, + String infoString, + TagLibraryInfo taglib, + TagExtraInfo tagExtraInfo, + TagAttributeInfo[] attributeInfo) { + this.tagName = tagName; + this.tagClassName = tagClassName; + this.bodyContent = bodycontent; + this.infoString = infoString; + this.tagLibrary = taglib; + this.tagExtraInfo = tagExtraInfo; + this.attributeInfo = attributeInfo; + + if (tagExtraInfo != null) + tagExtraInfo.setTagInfo(this); + } + + /** + * Constructor for TagInfo from data in the JSP 1.2 format for TLD. + * This class is to be instantiated only from the TagLibrary code + * under request from some JSP code that is parsing a + * TLD (Tag Library Descriptor). + * + * Note that, since TagLibibraryInfo reflects both TLD information + * and taglib directive information, a TagInfo instance is + * dependent on a taglib directive. This is probably a + * design error, which may be fixed in the future. + * + * @param tagName The name of this tag + * @param tagClassName The name of the tag handler class + * @param bodycontent Information on the body content of these tags + * @param infoString The (optional) string information for this tag + * @param taglib The instance of the tag library that contains us. + * @param tagExtraInfo The instance providing extra Tag info. May be null + * @param attributeInfo An array of AttributeInfo data from descriptor. + * May be null; + * @param displayName A short name to be displayed by tools + * @param smallIcon Path to a small icon to be displayed by tools + * @param largeIcon Path to a large icon to be displayed by tools + * @param tvi An array of a TagVariableInfo (or null) + */ + public TagInfo(String tagName, + String tagClassName, + String bodycontent, + String infoString, + TagLibraryInfo taglib, + TagExtraInfo tagExtraInfo, + TagAttributeInfo[] attributeInfo, + String displayName, + String smallIcon, + String largeIcon, + TagVariableInfo[] tvi) { + this.tagName = tagName; + this.tagClassName = tagClassName; + this.bodyContent = bodycontent; + this.infoString = infoString; + this.tagLibrary = taglib; + this.tagExtraInfo = tagExtraInfo; + this.attributeInfo = attributeInfo; + this.displayName = displayName; + this.smallIcon = smallIcon; + this.largeIcon = largeIcon; + this.tagVariableInfo = tvi; + + if (tagExtraInfo != null) + tagExtraInfo.setTagInfo(this); + } + + /** + * Constructor for TagInfo from data in the JSP 2.0 format for TLD. + * This class is to be instantiated only from the TagLibrary code + * under request from some JSP code that is parsing a + * TLD (Tag Library Descriptor). + * + * Note that, since TagLibibraryInfo reflects both TLD information + * and taglib directive information, a TagInfo instance is + * dependent on a taglib directive. This is probably a + * design error, which may be fixed in the future. + * + * @param tagName The name of this tag + * @param tagClassName The name of the tag handler class + * @param bodycontent Information on the body content of these tags + * @param infoString The (optional) string information for this tag + * @param taglib The instance of the tag library that contains us. + * @param tagExtraInfo The instance providing extra Tag info. May be null + * @param attributeInfo An array of AttributeInfo data from descriptor. + * May be null; + * @param displayName A short name to be displayed by tools + * @param smallIcon Path to a small icon to be displayed by tools + * @param largeIcon Path to a large icon to be displayed by tools + * @param tvi An array of a TagVariableInfo (or null) + * @param dynamicAttributes True if supports dynamic attributes + * + * @since JSP 2.0 + */ + public TagInfo(String tagName, + String tagClassName, + String bodycontent, + String infoString, + TagLibraryInfo taglib, + TagExtraInfo tagExtraInfo, + TagAttributeInfo[] attributeInfo, + String displayName, + String smallIcon, + String largeIcon, + TagVariableInfo[] tvi, + boolean dynamicAttributes) { + this.tagName = tagName; + this.tagClassName = tagClassName; + this.bodyContent = bodycontent; + this.infoString = infoString; + this.tagLibrary = taglib; + this.tagExtraInfo = tagExtraInfo; + this.attributeInfo = attributeInfo; + this.displayName = displayName; + this.smallIcon = smallIcon; + this.largeIcon = largeIcon; + this.tagVariableInfo = tvi; + this.dynamicAttributes = dynamicAttributes; + + if (tagExtraInfo != null) + tagExtraInfo.setTagInfo(this); + } + + /** + * The name of the Tag. + * + * @return The (short) name of the tag. + */ + + public String getTagName() { + return tagName; + } + + /** + * Attribute information (in the TLD) on this tag. + * The return is an array describing the attributes of this tag, as + * indicated in the TLD. + * + * @return The array of TagAttributeInfo for this tag, or a + * zero-length array if the tag has no attributes. + */ + + public TagAttributeInfo[] getAttributes() { + return attributeInfo; + } + + /** + * Information on the scripting objects created by this tag at runtime. + * This is a convenience method on the associated TagExtraInfo class. + * + * @param data TagData describing this action. + * @return if a TagExtraInfo object is associated with this TagInfo, the + * result of getTagExtraInfo().getVariableInfo( data ), otherwise + * null. + */ + public VariableInfo[] getVariableInfo(TagData data) { + VariableInfo[] result = null; + TagExtraInfo tei = getTagExtraInfo(); + if (tei != null) { + result = tei.getVariableInfo( data ); + } + return result; + } + + /** + * Translation-time validation of the attributes. + * This is a convenience method on the associated TagExtraInfo class. + * + * @param data The translation-time TagData instance. + * @return Whether the data is valid. + */ + public boolean isValid(TagData data) { + TagExtraInfo tei = getTagExtraInfo(); + if (tei == null) { + return true; + } + return tei.isValid(data); + } + + /** + * Translation-time validation of the attributes. + * This is a convenience method on the associated TagExtraInfo class. + * + * @param data The translation-time TagData instance. + * @return A null object, or zero length array if no errors, an + * array of ValidationMessages otherwise. + * @since JSP 2.0 + */ + public ValidationMessage[] validate( TagData data ) { + TagExtraInfo tei = getTagExtraInfo(); + if( tei == null ) { + return null; + } + return tei.validate( data ); + } + + /** + * Set the instance for extra tag information. + * + * @param tei the TagExtraInfo instance + */ + public void setTagExtraInfo(TagExtraInfo tei) { + tagExtraInfo = tei; + } + + + /** + * The instance (if any) for extra tag information. + * + * @return The TagExtraInfo instance, if any. + */ + public TagExtraInfo getTagExtraInfo() { + return tagExtraInfo; + } + + + /** + * Name of the class that provides the handler for this tag. + * + * @return The name of the tag handler class. + */ + + public String getTagClassName() { + return tagClassName; + } + + + /** + * The bodycontent information for this tag. + * If the bodycontent is not defined for this + * tag, the default of JSP will be returned. + * + * @return the body content string. + */ + + public String getBodyContent() { + return bodyContent; + } + + + /** + * The information string for the tag. + * + * @return the info string, or null if + * not defined + */ + + public String getInfoString() { + return infoString; + } + + + /** + * Set the TagLibraryInfo property. + * + * Note that a TagLibraryInfo element is dependent + * not just on the TLD information but also on the + * specific taglib instance used. This means that + * a fair amount of work needs to be done to construct + * and initialize TagLib objects. + * + * If used carefully, this setter can be used to avoid having to + * create new TagInfo elements for each taglib directive. + * + * @param tl the TagLibraryInfo to assign + */ + + public void setTagLibrary(TagLibraryInfo tl) { + tagLibrary = tl; + } + + /** + * The instance of TabLibraryInfo we belong to. + * + * @return the tag library instance we belong to + */ + + public TagLibraryInfo getTagLibrary() { + return tagLibrary; + } + + + // ============== JSP 2.0 TLD Information ======== + + + /** + * Get the displayName. + * + * @return A short name to be displayed by tools, + * or null if not defined + */ + + public String getDisplayName() { + return displayName; + } + + /** + * Get the path to the small icon. + * + * @return Path to a small icon to be displayed by tools, + * or null if not defined + */ + + public String getSmallIcon() { + return smallIcon; + } + + /** + * Get the path to the large icon. + * + * @return Path to a large icon to be displayed by tools, + * or null if not defined + */ + + public String getLargeIcon() { + return largeIcon; + } + + /** + * Get TagVariableInfo objects associated with this TagInfo. + * + * @return Array of TagVariableInfo objects corresponding to + * variables declared by this tag, or a zero length + * array if no variables have been declared + */ + + public TagVariableInfo[] getTagVariableInfos() { + return tagVariableInfo; + } + + + // ============== JSP 2.0 TLD Information ======== + + /** + * Get dynamicAttributes associated with this TagInfo. + * + * @return True if tag handler supports dynamic attributes + * @since JSP 2.0 + */ + public boolean hasDynamicAttributes() { + return dynamicAttributes; + } + + /* + * private fields for 1.1 info + */ + private String tagName; // the name of the tag + private String tagClassName; + private String bodyContent; + private String infoString; + private TagLibraryInfo tagLibrary; + private TagExtraInfo tagExtraInfo; // instance of TagExtraInfo + private TagAttributeInfo[] attributeInfo; + + /* + * private fields for 1.2 info + */ + private String displayName; + private String smallIcon; + private String largeIcon; + private TagVariableInfo[] tagVariableInfo; + + /* + * Additional private fields for 2.0 info + */ + private boolean dynamicAttributes; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagLibraryInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagLibraryInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagLibraryInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,342 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import javax.servlet.jsp.tagext.TagInfo; +import javax.servlet.jsp.tagext.TagFileInfo; + +/** + * Translation-time information associated with a taglib directive, and its + * underlying TLD file. + * + * Most of the information is directly from the TLD, except for + * the prefix and the uri values used in the taglib directive + */ + +abstract public class TagLibraryInfo { + + /** + * Constructor. + * + * @param prefix the prefix actually used by the taglib directive + * @param uri the URI actually used by the taglib directive + */ + protected TagLibraryInfo(String prefix, String uri) { + this.prefix = prefix; + this.uri = uri; + } + + // ==== methods accessing taglib information ======= + + /** + * The value of the uri attribute from the taglib directive for + * this library. + * + * @return the value of the uri attribute + */ + + public String getURI() { + return uri; + } + + /** + * The prefix assigned to this taglib from the taglib directive + * + * @return the prefix assigned to this taglib from the taglib directive + */ + + public String getPrefixString() { + return prefix; + } + + // ==== methods using the TLD data ======= + + /** + * The preferred short name (prefix) as indicated in the TLD. + * This may be used by authoring tools as the preferred prefix + * to use when creating an taglib directive for this library. + * + * @return the preferred short name for the library + */ + public String getShortName() { + return shortname; + } + + /** + * The "reliable" URN indicated in the TLD (the uri element). + * This may be used by authoring tools as a global identifier + * to use when creating a taglib directive for this library. + * + * @return a reliable URN to a TLD like this + */ + public String getReliableURN() { + return urn; + } + + + /** + * Information (documentation) for this TLD. + * + * @return the info string for this tag lib + */ + + public String getInfoString() { + return info; + } + + + /** + * A string describing the required version of the JSP container. + * + * @return the (minimal) required version of the JSP container. + * @see javax.servlet.jsp.JspEngineInfo + */ + + public String getRequiredVersion() { + return jspversion; + } + + + /** + * An array describing the tags that are defined in this tag library. + * + * @return the TagInfo objects corresponding to the tags defined by this + * tag library, or a zero length array if this tag library + * defines no tags + */ + public TagInfo[] getTags() { + return tags; + } + + /** + * An array describing the tag files that are defined in this tag library. + * + * @return the TagFileInfo objects corresponding to the tag files defined + * by this tag library, or a zero length array if this + * tag library defines no tags files + * @since JSP 2.0 + */ + public TagFileInfo[] getTagFiles() { + return tagFiles; + } + + + /** + * Get the TagInfo for a given tag name, looking through all the + * tags in this tag library. + * + * @param shortname The short name (no prefix) of the tag + * @return the TagInfo for the tag with the specified short name, or + * null if no such tag is found + */ + + public TagInfo getTag(String shortname) { + TagInfo tags[] = getTags(); + + if (tags == null || tags.length == 0) { + return null; + } + + for (int i=0; i < tags.length; i++) { + if (tags[i].getTagName().equals(shortname)) { + return tags[i]; + } + } + return null; + } + + /** + * Get the TagFileInfo for a given tag name, looking through all the + * tag files in this tag library. + * + * @param shortname The short name (no prefix) of the tag + * @return the TagFileInfo for the specified Tag file, or null + * if no Tag file is found + * @since JSP 2.0 + */ + public TagFileInfo getTagFile(String shortname) { + TagFileInfo tagFiles[] = getTagFiles(); + + if (tagFiles == null || tagFiles.length == 0) { + return null; + } + + for (int i=0; i < tagFiles.length; i++) { + if (tagFiles[i].getName().equals(shortname)) { + return tagFiles[i]; + } + } + return null; + } + + /** + * An array describing the functions that are defined in this tag library. + * + * @return the functions defined in this tag library, or a zero + * length array if the tag library defines no functions. + * @since JSP 2.0 + */ + public FunctionInfo[] getFunctions() { + return functions; + } + + + /** + * Get the FunctionInfo for a given function name, looking through all the + * functions in this tag library. + * + * @param name The name (no prefix) of the function + * @return the FunctionInfo for the function with the given name, or null + * if no such function exists + * @since JSP 2.0 + */ + public FunctionInfo getFunction(String name) { + + if (functions == null || functions.length == 0) { + System.err.println("No functions"); + return null; + } + + for (int i=0; i < functions.length; i++) { + if (functions[i].getName().equals(name)) { + return functions[i]; + } + } + return null; + } + + + /** + * Returns an array of TagLibraryInfo objects representing the entire set + * of tag libraries (including this TagLibraryInfo) imported by taglib + * directives in the translation unit that references this + * TagLibraryInfo. + * + * If a tag library is imported more than once and bound to different + * prefices, only the TagLibraryInfo bound to the first prefix must be + * included in the returned array. + * + * @return Array of TagLibraryInfo objects representing the entire set + * of tag libraries (including this TagLibraryInfo) imported by taglib + * directives in the translation unit that references this TagLibraryInfo. + * + * @since JSP 2.1 + */ + public abstract TagLibraryInfo[] getTagLibraryInfos(); + + + // Protected fields + + /** + * The prefix assigned to this taglib from the taglib directive. + */ + protected String prefix; + + /** + * The value of the uri attribute from the taglib directive for + * this library. + */ + protected String uri; + + /** + * An array describing the tags that are defined in this tag library. + */ + protected TagInfo[] tags; + + /** + * An array describing the tag files that are defined in this tag library. + * + * @since JSP 2.0 + */ + protected TagFileInfo[] tagFiles; + + /** + * An array describing the functions that are defined in this tag library. + * + * @since JSP 2.0 + */ + protected FunctionInfo[] functions; + + // Tag Library Data + + /** + * The version of the tag library. + */ + protected String tlibversion; // required + + /** + * The version of the JSP specification this tag library is written to. + */ + protected String jspversion; // required + + /** + * The preferred short name (prefix) as indicated in the TLD. + */ + protected String shortname; // required + + /** + * The "reliable" URN indicated in the TLD. + */ + protected String urn; // required + + /** + * Information (documentation) for this TLD. + */ + protected String info; // optional +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagLibraryValidator.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagLibraryValidator.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagLibraryValidator.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,184 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import java.util.Map; + +/** + * Translation-time validator class for a JSP page. + * A validator operates on the XML view associated with the JSP page. + * + *

    + * The TLD file associates a TagLibraryValidator class and some init + * arguments with a tag library. + * + *

    + * The JSP container is reponsible for locating an appropriate + * instance of the appropriate subclass by + * + *

      + *
    • new a fresh instance, or reuse an available one + *
    • invoke the setInitParams(Map) method on the instance + *
    + * + * once initialized, the validate(String, String, PageData) method will + * be invoked, where the first two arguments are the prefix + * and uri for this tag library in the XML View. The prefix is intended + * to make it easier to produce an error message. However, it is not + * always accurate. In the case where a single URI is mapped to more + * than one prefix in the XML view, the prefix of the first URI is provided. + * Therefore, to provide high quality error messages in cases where the + * tag elements themselves are checked, the prefix parameter should be + * ignored and the actual prefix of the element should be used instead. + * TagLibraryValidators should always use the uri to identify elements + * as beloning to the tag library, not the prefix. + * + *

    + * A TagLibraryValidator instance + * may create auxiliary objects internally to perform + * the validation (e.g. an XSchema validator) and may reuse it for all + * the pages in a given translation run. + * + *

    + * The JSP container is not guaranteed to serialize invocations of + * validate() method, and TagLibraryValidators should perform any + * synchronization they may require. + * + *

    + * As of JSP 2.0, a JSP container must provide a jsp:id attribute to + * provide higher quality validation errors. + * The container will track the JSP pages + * as passed to the container, and will assign to each element + * a unique "id", which is passed as the value of the jsp:id + * attribute. Each XML element in the XML view available will + * be extended with this attribute. The TagLibraryValidator + * can then use the attribute in one or more ValidationMessage + * objects. The container then, in turn, can use these + * values to provide more precise information on the location + * of an error. + * + *

    + * The actual prefix of the id attribute may or may not be + * jsp but it will always map to the namespace + * http://java.sun.com/JSP/Page. A TagLibraryValidator + * implementation must rely on the uri, not the prefix, of the id + * attribute. + */ + +abstract public class TagLibraryValidator { + + /** + * Sole constructor. (For invocation by subclass constructors, + * typically implicit.) + */ + public TagLibraryValidator() { + } + + /** + * Set the init data in the TLD for this validator. + * Parameter names are keys, and parameter values are the values. + * + * @param map A Map describing the init parameters + */ + public void setInitParameters(Map map) { + initParameters = map; + } + + + /** + * Get the init parameters data as an immutable Map. + * Parameter names are keys, and parameter values are the values. + * + * @return The init parameters as an immutable map. + */ + public Map getInitParameters() { + return initParameters; + } + + /** + * Validate a JSP page. + * This will get invoked once per unique tag library URI in the + * XML view. This method will return null if the page is valid; otherwise + * the method should return an array of ValidationMessage objects. + * An array of length zero is also interpreted as no errors. + * + * @param prefix the first prefix with which the tag library is + * associated, in the XML view. Note that some tags may use + * a different prefix if the namespace is redefined. + * @param uri the tag library's unique identifier + * @param page the JspData page object + * @return A null object, or zero length array if no errors, an array + * of ValidationMessages otherwise. + */ + public ValidationMessage[] validate(String prefix, String uri, + PageData page) + { + return null; + } + + /** + * Release any data kept by this instance for validation purposes. + */ + public void release() { + } + + // Private data + private Map initParameters; + +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagSupport.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagSupport.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagSupport.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,340 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +import java.io.Serializable; +import java.util.Enumeration; +import java.util.Hashtable; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.PageContext; + +/** + * A base class for defining new tag handlers implementing Tag. + * + *

    The TagSupport class is a utility class intended to be used as + * the base class for new tag handlers. The TagSupport class + * implements the Tag and IterationTag interfaces and adds additional + * convenience methods including getter methods for the properties in + * Tag. TagSupport has one static method that is included to + * facilitate coordination among cooperating tags. + * + *

    Many tag handlers will extend TagSupport and only redefine a + * few methods. + */ + +public class TagSupport implements IterationTag, Serializable { + + /** + * Find the instance of a given class type that is closest to a given + * instance. + * This method uses the getParent method from the Tag + * interface. + * This method is used for coordination among cooperating tags. + * + *

    + * The current version of the specification only provides one formal + * way of indicating the observable type of a tag handler: its + * tag handler implementation class, described in the tag-class + * subelement of the tag element. This is extended in an + * informal manner by allowing the tag library author to + * indicate in the description subelement an observable type. + * The type should be a subtype of the tag handler implementation + * class or void. + * This addititional constraint can be exploited by a + * specialized container that knows about that specific tag library, + * as in the case of the JSP standard tag library. + * + *

    + * When a tag library author provides information on the + * observable type of a tag handler, client programmatic code + * should adhere to that constraint. Specifically, the Class + * passed to findAncestorWithClass should be a subtype of the + * observable type. + * + * + * @param from The instance from where to start looking. + * @param klass The subclass of Tag or interface to be matched + * @return the nearest ancestor that implements the interface + * or is an instance of the class specified + */ + + // The type for klass should be Class. Unfortunately, fixing that is + // a change in the API signature, which cannot be modified without a spec + // change + @SuppressWarnings("unchecked") + public static final Tag findAncestorWithClass(Tag from, Class klass) { + boolean isInterface = false; + + if (from == null || + klass == null || + (!Tag.class.isAssignableFrom(klass) && + !(isInterface = klass.isInterface()))) { + return null; + } + + for (;;) { + Tag tag = from.getParent(); + + if (tag == null) { + return null; + } + + if ((isInterface && klass.isInstance(tag)) || + klass.isAssignableFrom(tag.getClass())) + return tag; + else + from = tag; + } + } + + /** + * Default constructor, all subclasses are required to define only + * a public constructor with the same signature, and to call the + * superclass constructor. + * + * This constructor is called by the code generated by the JSP + * translator. + */ + + public TagSupport() { } + + /** + * Default processing of the start tag, returning SKIP_BODY. + * + * @return SKIP_BODY + * @throws JspException if an error occurs while processing this tag + * + * @see Tag#doStartTag() + */ + + public int doStartTag() throws JspException { + return SKIP_BODY; + } + + /** + * Default processing of the end tag returning EVAL_PAGE. + * + * @return EVAL_PAGE + * @throws JspException if an error occurs while processing this tag + * + * @see Tag#doEndTag() + */ + + public int doEndTag() throws JspException { + return EVAL_PAGE; + } + + + /** + * Default processing for a body. + * + * @return SKIP_BODY + * @throws JspException if an error occurs while processing this tag + * + * @see IterationTag#doAfterBody() + */ + + public int doAfterBody() throws JspException { + return SKIP_BODY; + } + + // Actions related to body evaluation + + + /** + * Release state. + * + * @see Tag#release() + */ + + public void release() { + parent = null; + id = null; + if( values != null ) { + values.clear(); + } + values = null; + } + + /** + * Set the nesting tag of this tag. + * + * @param t The parent Tag. + * @see Tag#setParent(Tag) + */ + + public void setParent(Tag t) { + parent = t; + } + + /** + * The Tag instance most closely enclosing this tag instance. + * @see Tag#getParent() + * + * @return the parent tag instance or null + */ + + public Tag getParent() { + return parent; + } + + /** + * Set the id attribute for this tag. + * + * @param id The String for the id. + */ + + public void setId(String id) { + this.id = id; + } + + /** + * The value of the id attribute of this tag; or null. + * + * @return the value of the id attribute, or null + */ + + public String getId() { + return id; + } + + /** + * Set the page context. + * + * @param pageContext The PageContext. + * @see Tag#setPageContext + */ + + public void setPageContext(PageContext pageContext) { + this.pageContext = pageContext; + } + + /** + * Associate a value with a String key. + * + * @param k The key String. + * @param o The value to associate. + */ + + public void setValue(String k, Object o) { + if (values == null) { + values = new Hashtable(); + } + values.put(k, o); + } + + /** + * Get a the value associated with a key. + * + * @param k The string key. + * @return The value associated with the key, or null. + */ + + public Object getValue(String k) { + if (values == null) { + return null; + } else { + return values.get(k); + } + } + + /** + * Remove a value associated with a key. + * + * @param k The string key. + */ + + public void removeValue(String k) { + if (values != null) { + values.remove(k); + } + } + + /** + * Enumerate the keys for the values kept by this tag handler. + * + * @return An enumeration of all the keys for the values set, + * or null or an empty Enumeration if no values have been set. + */ + + public Enumeration getValues() { + if (values == null) { + return null; + } + return values.keys(); + } + + // private fields + + private Tag parent; + private Hashtable values; + /** + * The value of the id attribute of this tag; or null. + */ + protected String id; + + // protected fields + + /** + * The PageContext. + */ + protected PageContext pageContext; +} + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagVariableInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagVariableInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TagVariableInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,161 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Variable information for a tag in a Tag Library; + * This class is instantiated from the Tag Library Descriptor file (TLD) + * and is available only at translation time. + * + * This object should be immutable. + * + * This information is only available in JSP 1.2 format TLDs or above. + */ + +public class TagVariableInfo { + + /** + * Constructor for TagVariableInfo. + * + * @param nameGiven value of <name-given> + * @param nameFromAttribute value of <name-from-attribute> + * @param className value of <variable-class> + * @param declare value of <declare> + * @param scope value of <scope> + */ + public TagVariableInfo( + String nameGiven, + String nameFromAttribute, + String className, + boolean declare, + int scope) { + this.nameGiven = nameGiven; + this.nameFromAttribute = nameFromAttribute; + this.className = className; + this.declare = declare; + this.scope = scope; + } + + /** + * The body of the <name-given> element. + * + * @return The variable name as a constant + */ + + public String getNameGiven() { + return nameGiven; + } + + /** + * The body of the <name-from-attribute> element. + * This is the name of an attribute whose (translation-time) + * value will give the name of the variable. One of + * <name-given> or <name-from-attribute> is required. + * + * @return The attribute whose value defines the variable name + */ + + public String getNameFromAttribute() { + return nameFromAttribute; + } + + /** + * The body of the <variable-class> element. + * + * @return The name of the class of the variable or + * 'java.lang.String' if not defined in the TLD. + */ + + public String getClassName() { + return className; + } + + /** + * The body of the <declare> element. + * + * @return Whether the variable is to be declared or not. + * If not defined in the TLD, 'true' will be returned. + */ + + public boolean getDeclare() { + return declare; + } + + /** + * The body of the <scope> element. + * + * @return The scope to give the variable. NESTED + * scope will be returned if not defined in + * the TLD. + */ + + public int getScope() { + return scope; + } + + + /* + * private fields + */ + private String nameGiven; // + private String nameFromAttribute; // + private String className; // + private boolean declare; // + private int scope; // +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TryCatchFinally.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TryCatchFinally.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/TryCatchFinally.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,139 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + + + +/** + * The auxiliary interface of a Tag, IterationTag or BodyTag tag + * handler that wants additional hooks for managing resources. + * + *

    This interface provides two new methods: doCatch(Throwable) + * and doFinally(). The prototypical invocation is as follows: + * + *

    + * h = get a Tag();  // get a tag handler, perhaps from pool
    + *
    + * h.setPageContext(pc);  // initialize as desired
    + * h.setParent(null);
    + * h.setFoo("foo");
    + * 
    + * // tag invocation protocol; see Tag.java
    + * try {
    + *   doStartTag()...
    + *   ....
    + *   doEndTag()...
    + * } catch (Throwable t) {
    + *   // react to exceptional condition
    + *   h.doCatch(t);
    + * } finally {
    + *   // restore data invariants and release per-invocation resources
    + *   h.doFinally();
    + * }
    + * 
    + * ... other invocations perhaps with some new setters
    + * ...
    + * h.release();  // release long-term resources
    + * 
    + */ + +public interface TryCatchFinally { + + /** + * Invoked if a Throwable occurs while evaluating the BODY + * inside a tag or in any of the following methods: + * Tag.doStartTag(), Tag.doEndTag(), + * IterationTag.doAfterBody() and BodyTag.doInitBody(). + * + *

    This method is not invoked if the Throwable occurs during + * one of the setter methods. + * + *

    This method may throw an exception (the same or a new one) + * that will be propagated further up the nest chain. If an exception + * is thrown, doFinally() will be invoked. + * + *

    This method is intended to be used to respond to an exceptional + * condition. + * + * @param t The throwable exception navigating through this tag. + * @throws Throwable if the exception is to be rethrown further up + * the nest chain. + */ + + void doCatch(Throwable t) throws Throwable; + + /** + * Invoked in all cases after doEndTag() for any class implementing + * Tag, IterationTag or BodyTag. This method is invoked even if + * an exception has occurred in the BODY of the tag, + * or in any of the following methods: + * Tag.doStartTag(), Tag.doEndTag(), + * IterationTag.doAfterBody() and BodyTag.doInitBody(). + * + *

    This method is not invoked if the Throwable occurs during + * one of the setter methods. + * + *

    This method should not throw an Exception. + * + *

    This method is intended to maintain per-invocation data + * integrity and resource management actions. + */ + + void doFinally(); +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/ValidationMessage.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/ValidationMessage.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/ValidationMessage.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,126 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + + +/** + * A validation message from either TagLibraryValidator or TagExtraInfo. + *

    + * As of JSP 2.0, a JSP container must support a jsp:id attribute + * to provide higher quality validation errors. + * The container will track the JSP pages + * as passed to the container, and will assign to each element + * a unique "id", which is passed as the value of the jsp:id + * attribute. Each XML element in the XML view available will + * be extended with this attribute. The TagLibraryValidator + * can then use the attribute in one or more ValidationMessage + * objects. The container then, in turn, can use these + * values to provide more precise information on the location + * of an error. + * + *

    + * The actual prefix of the id attribute may or may not be + * jsp but it will always map to the namespace + * http://java.sun.com/JSP/Page. A TagLibraryValidator + * implementation must rely on the uri, not the prefix, of the id + * attribute. + */ + +public class ValidationMessage { + + /** + * Create a ValidationMessage. The message String should be + * non-null. The value of id may be null, if the message + * is not specific to any XML element, or if no jsp:id + * attributes were passed on. If non-null, the value of + * id must be the value of a jsp:id attribute for the PageData + * passed into the validate() method. + * + * @param id Either null, or the value of a jsp:id attribute. + * @param message A localized validation message. + */ + public ValidationMessage(String id, String message) { + this.id = id; + this.message = message; + } + + + /** + * Get the jsp:id. + * Null means that there is no information available. + * + * @return The jsp:id information. + */ + public String getId() { + return id; + } + + /** + * Get the localized validation message. + * + * @return A validation message + */ + public String getMessage(){ + return message; + } + + // Private data + private String id; + private String message; +} Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/VariableInfo.java =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/VariableInfo.java (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/VariableInfo.java (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,322 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + * + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.servlet.jsp.tagext; + +/** + * Information on the scripting variables that are created/modified by + * a tag (at run-time). This information is provided by TagExtraInfo + * classes and it is used by the translation phase of JSP. + * + *

    + * Scripting variables generated by a custom action have an associated + * scope of either AT_BEGIN, NESTED, or AT_END. + * + *

    + * The class name (VariableInfo.getClassName) in the returned objects + * is used to determine the types of the scripting variables. + * Note that because scripting variables are assigned their values + * from scoped attributes which cannot be of primitive types, + * "boxed" types such as java.lang.Integer must + * be used instead of primitives. + * + *

    + * The class name may be a Fully Qualified Class Name, or a short + * class name. + * + *

    + * If a Fully Qualified Class Name is provided, it should refer to a + * class that should be in the CLASSPATH for the Web Application (see + * Servlet 2.4 specification - essentially it is WEB-INF/lib and + * WEB-INF/classes). Failure to be so will lead to a translation-time + * error. + * + *

    + * If a short class name is given in the VariableInfo objects, then + * the class name must be that of a public class in the context of the + * import directives of the page where the custom action appears. + * The class must also be in the CLASSPATH for the Web Application + * (see Servlet 2.4 specification - essentially it is WEB-INF/lib and + * WEB-INF/classes). Failure to be so will lead to a translation-time + * error. + * + *

    Usage Comments + *

    + * Frequently a fully qualified class name will refer to a class that + * is known to the tag library and thus, delivered in the same JAR + * file as the tag handlers. In most other remaining cases it will + * refer to a class that is in the platform on which the JSP processor + * is built (like Java EE). Using fully qualified class names in this + * manner makes the usage relatively resistant to configuration + * errors. + * + *

    + * A short name is usually generated by the tag library based on some + * attributes passed through from the custom action user (the author), + * and it is thus less robust: for instance a missing import directive + * in the referring JSP page will lead to an invalid short name class + * and a translation error. + * + *

    Synchronization Protocol + * + *

    + * The result of the invocation on getVariableInfo is an array of + * VariableInfo objects. Each such object describes a scripting + * variable by providing its name, its type, whether the variable is + * new or not, and what its scope is. Scope is best described through + * a picture: + * + *

    + * NESTED, AT_BEGIN and AT_END Variable Scopes + * + *

    + * The JSP 2.0 specification defines the interpretation of 3 values: + * + *

      + *
    • NESTED, if the scripting variable is available between + * the start tag and the end tag of the action that defines it. + *
    • + * AT_BEGIN, if the scripting variable is available from the start tag + * of the action that defines it until the end of the scope. + *
    • AT_END, if the scripting variable is available after the end tag + * of the action that defines it until the end of the scope. + *
    + * + * The scope value for a variable implies what methods may affect its + * value and thus where synchronization is needed as illustrated by + * the table below. Note: the synchronization of the variable(s) + * will occur after the respective method has been called. + * + *
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Variable Synchronization + * Points
    + *
     doStartTag()doInitBody()doAfterBody()doEndTag()doTag()
    Tag
    + *
    AT_BEGIN, NESTED
    + *

    + *

    + *
    AT_BEGIN, AT_END
    + *

    + *
    IterationTag
    + *
    AT_BEGIN, NESTED
    + *

    + *
    AT_BEGIN, NESTED
    + *
    AT_BEGIN, AT_END
    + *

    + *
    BodyTag
    + *
    AT_BEGIN, NESTED1
    + *
    AT_BEGIN, NESTED1
    + *
    AT_BEGIN, NESTED
    + *
    AT_BEGIN, AT_END
    + *

    + *
    SimpleTag
    + *

    + *

    + *

    + *

    + *
    AT_BEGIN, AT_END
    + *
    + * 1 Called after doStartTag() if + * EVAL_BODY_INCLUDE is returned, or after + * doInitBody() otherwise. + *
    + * + *

    Variable Information in the TLD + *

    + * Scripting variable information can also be encoded directly for most cases + * into the Tag Library Descriptor using the <variable> subelement of the + * <tag> element. See the JSP specification. + */ + +public class VariableInfo { + + /** + * Scope information that scripting variable is visible only within the + * start/end tags. + */ + public static final int NESTED = 0; + + /** + * Scope information that scripting variable is visible after start tag. + */ + public static final int AT_BEGIN = 1; + + /** + * Scope information that scripting variable is visible after end tag. + */ + public static final int AT_END = 2; + + + /** + * Constructor + * These objects can be created (at translation time) by the TagExtraInfo + * instances. + * + * @param varName The name of the scripting variable + * @param className The type of this variable + * @param declare If true, it is a new variable (in some languages this will + * require a declaration) + * @param scope Indication on the lexical scope of the variable + */ + + public VariableInfo(String varName, + String className, + boolean declare, + int scope) { + this.varName = varName; + this.className = className; + this.declare = declare; + this.scope = scope; + } + + // Accessor methods + + /** + * Returns the name of the scripting variable. + * + * @return the name of the scripting variable + */ + public String getVarName() { + return varName; + } + + /** + * Returns the type of this variable. + * + * @return the type of this variable + */ + public String getClassName() { + return className; + } + + /** + * Returns whether this is a new variable. + * If so, in some languages this will require a declaration. + * + * @return whether this is a new variable. + */ + public boolean getDeclare() { + return declare; + } + + /** + * Returns the lexical scope of the variable. + * + * @return the lexical scope of the variable, either AT_BEGIN, AT_END, + * or NESTED. + * @see #AT_BEGIN + * @see #AT_END + * @see #NESTED + */ + public int getScope() { + return scope; + } + + + // == private data + private String varName; + private String className; + private boolean declare; + private int scope; +} + Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/doc-files/BodyTagProtocol.gif =================================================================== diff -u Binary files differ Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/doc-files/IterationTagProtocol.gif =================================================================== diff -u Binary files differ Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/doc-files/TagProtocol.gif =================================================================== diff -u Binary files differ Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/doc-files/VariableInfo-1.gif =================================================================== diff -u Binary files differ Index: 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/package.html =================================================================== diff -u --- 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/package.html (revision 0) +++ 3rdParty_sources/jsp-api/javax/servlet/jsp/tagext/package.html (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -0,0 +1,1460 @@ + + + + + + + + +Classes and interfaces for the definition of JavaServer Pages Tag Libraries. + +

    Custom actions can be used by JSP authors and authoring tools to +simplify writing JSP pages. A custom action can be either an empty +or a non-empty action. + +

    +An empty tag has no body. There are two equivalent syntaxes, one +with separate start and end tags, and one where the start and +end tags are combined. The two following examples are identical: +

    +
    + +
    +<x:foo att="myObject"></foo>
    +<x:foo att="myObject"/>
    +
    +
    +
    + +

    +A non-empty tag has a start tag, a body, and an end tag. A +prototypical example is of the form: +

    +
    + +
    +<x:foo att="myObject" >
    +  BODY
    +</x:foo/>
    +
    +
    +
    + + +

    +The JavaServer Pages(tm) (JSP) specification provides a portable +mechanism for the description of tag libraries. +

    +A JSP tag library contains +

      +
    • A Tag Library Descriptor
    • +
    • A number of Tag Files or Tag handler classes defining + request-time behavior
    • +
    • Additional classes and resources used at runtime
    • +
    • Possibly some additional classes to provide extra translation + information
    • +
    + +

    This API is described in the following sections: +

      +
    1. Classic Tag Handlers
    2. +
    3. Tag Handlers that want to access their Body Content
    4. +
    5. Dynamic Attributes
    6. +
    7. Annotated Tag Handler Management Example
    8. +
    9. Cooperating Actions
    10. +
    11. Simple Tag Handlers
    12. +
    13. JSP Fragments
    14. +
    15. Example Simple Tag Handler Scenario
    16. +
    17. Translation-time Classes
    18. +
    + + +

    1. Classic Tag Handlers

    +
    +This section introduces the notion of a tag handler and describes the +classic types of tag handler. + +

    JSP 2.0 introduces a new type of Tag Handler called a Simple +Tag Handler, which is described in a later section. +The protocol for Simple Tag handlers is much more straightforward. + +

    Tag Handler

    + +

    A tag handler is a run-time, container-managed object that +evaluates custom actions during the execution of a JSP page. A tag +handler supports a protocol that allows the JSP container to provide +good integration of the server-side actions within a JSP page. + +

    A tag handler is created initially using a zero argument +constructor on its corresponding class; the method +java.beans.Beans.instantiate() is not used. + +

    A tag handler has some properties that are exposed to the page as +attributes on an action; these properties are managed by the JSP +container (via generated code). The setter methods used to set +the properties are discovered using the JavaBeans introspector +machinery. + +

    The protocol supported by a tag handler provides for passing of +parameters, the evaluation and reevaluation of the body of the action, +and for getting access to objects and other tag handlers in the +JSP page. + +

    A tag handler instance is responsible for processing one request +at a time. It is the responsability of the JSP container to enforce +this. + +

    Additional translation time information associated with the action +indicates the name of any scripting variables it may introduce, their +types and their scope. At specific moments, the JSP container will +automatically synchronize the {@link javax.servlet.jsp.PageContext} + information with variables +in the scripting language so they can be made available directly +through the scripting elements. + + +

    Properties

    + + +

    A tag handler has some properties. All tag handlers have a +pageContext property for the JSP page where the tag is +located, and a parent property for the tag handler to the +closest enclosing action. Specific tag handler classes may have +additional properties. + +

    All attributes of a custom action must be JavaBeans component +properties, although some properties may not be exposed as attributes. +The attributes that are visible to the JSP translator are exactly +those listed in the Tag Library Descriptor (TLD). + +

    All properties of a tag handler instance exposed as attributes +will be initialized by the container using the appropriate setter +methods before the instance can be used to perform the action methods. +It is the responsibility of the JSP container to invoke the +appropriate setter methods to initialize these properties. It is the +responsability of user code, be it scriptlets, JavaBeans code, or code +inside custom tags, to not invoke these setter methods, as doing +otherwise would interfere with the container knowledge. + +

    The setter methods that should be used when assigning a value to +an attribute of a custom action are determined by using the JavaBeans +introspector on the tag handler class, then use the setter method +associated with the property that has the same name as the attribute +in question. An implication (unclear in the JavaBeans specification) +is that there is only one setter per property. + +

    Unspecified attributes/properties should not be set (using a +setter method). + +

    Once properly set, all properties are expected to be persistent, +so that if the JSP container ascertains that a property has already +been set on a given tag handler instance, it must not set it +again. + +

    The JSP container may reuse classic tag handler instances for multiple +occurrences of the corresponding custom action, in the same page or in +different pages, but only if the same set of attributes are used for all +occurrences. If a tag handler is used for more than one occurence, the +container must reset all attributes where the values differ between the +custom action occurrences. Attributes with the same value in all +occurrences must not be reset. If an attribute value is set as a +request-time attribute value (using a scripting or an EL expression), +the container must reset the attribute between all reuses of the tag +handler instance. To prevent confusion, a tag handler with an empty body +must not reuse any previous tag handler with a non-empty body. + +

    User code can access property information and access and modify +tag handler internal state starting with the first action method (doStartTag) +up until the last action method (doEndTag or doFinally for tag handlers +implementing TryCatchFinally). + + +

    Tag Handler as a Container-Managed Object

    + +

    Since a tag handler is a container managed object, the container +needs to maintain its references; specifically, user code should not +keep references to a tag handler except between the start of the first +action method (doStartTag()) and the end of the last action method +(doEndTag() or doFinally() for those tags that implement TryCatchFinally). + +

    The restrictions on references to tag handler objects and +on modifying attribute properties gives the JSP container substantial +freedom in effectively managing tag handler objects to achieve different +goals. For example, a container may implementing different pooling strategies +to minimize creation cost, or may hoist setting of properties to reduce +cost when a tag handler is inside another iterative tag. + + +

    Conversions

    + +

    A tag handler implements an action; the JSP container must follow +the type conversions described in Section 2.13.2 when assigning values +to the attributes of an action. + +

    Empty and Non-Empty Actions

    + +An empty action has no body; it may use one of two syntaxes: either +<foo/> or <foo></foo>. Since empty actions have no +body the methods related to body manipulation are not invoked. +There is a mechanism in the Tag Library Descriptor to indicate +that a tag can only be used to write empty actions; when used, +non-empty actions using that tag will produce a translation error. + +

    +A non-empty action has a body. + + +

    The Tag Interface

    + + +

    A Tag handler that does not want to process its body can implement +just the Tag interface. A tag handler may not want to process its +body because it is an empty tag or because the body is just to +be "passed through". + +

    The Tag interface includes methods to provide page context +information to the Tag Handler instance, methods to handle the +life-cycle of tag handlers, and two main methods for performing +actions on a tag: doStartTag() and +doEndTag(). The method doStartTag() is +invoked when encountering the start tag and its return value indicates +whether the body (if there is any) should be skipped, or evaluated and +passed through to the current response stream. The method +doEndTag() is invoked when encountering the end tag; its +return value indicates whether the rest of the page should continue to +be evaluated or not. + +

    If an exception is encountered during the evaluation of the +body of a tag, its doEndTag method will not be evaluated. See the +TryCatchFinally tag for methods that are guaranteed to be evaluated. + + +

    The IterationTag Interface

    + + +

    The IterationTag interface is used to repeatedly reevaluate +the body of a custom action. The interface has one method: +doAfterBody() which is invoked after each evaluation +of the body to determine whether to reevaluate or not. + +

    Reevaluation is requested with the value 2, which in JSP 1.1 is +defined to be BodyTag.EVAL_BODY_TAG. That constant value is still +kept in JSP 1.2 (for full backwards compatibility) but, to improve +clarity, a new name is also available: IterationTag.EVAL_BODY_AGAIN. +To stop iterating, the returned value should be 0, which is +Tag.SKIP_BODY. + +

    The JspIdConsumer Interface

    +This interface indicates to the container that a tag handler wishes +to be provided with a compiler generated ID that is unique +within the page. + +

    The TagSupport Base Class

    + +

    The TagSupport class is a base class that can be used when +implementing the Tag or IterationTag interfaces. + + + +

    2. Tag Handlers that want Access to their Body Content

    + + +

    The evaluation of a body is delivered into a BodyContent +object. This is then made available to tag handlers that implement +the BodyTag interface. The BodyTagSupport +class provides a useful base class to simplify writing these handlers. + + +

    If a Tag handler wants to have access to the content of its body +then it must implement the BodyTag interface. + +This interface extends IterationTag, provides two additional methods +setBodyContent(BodyContent) and +doInitBody() +and refers to an object of type BodyContent. + +

    A BodyContent is a subclass of JspWriter that has a +few additional methods to convert its contents into a String, insert +the contents into another JspWriter, to get a Reader into its +contents, and to clear the contents. Its semantics also assure that +buffer size will never be exceeded. + +

    The JSP page implementation will create a BodyContent if the +doStartTag() method returns a EVAL_BODY_BUFFERED. This object will be +passed to doInitBody(); then the body of the tag will be evaluated, +and during that evaluation out will be bound to the +BodyContent just passed to the BodyTag handler. Then +doAfterBody() will be evaluated. If that method returns SKIP_BODY, no +more evaluations of the body will be done; if the method returns +EVAL_BODY_AGAIN, then the body will be evaluated, and doAfterBody() will +be invoked again. + +

    The content of a BodyContent instance remains available until after +the invocation of its associated doEndTag() method. + +

    A common use of the BodyContent is to extract its contents into a +String and then use the String as a value for some operation. Another +common use is to take its contents and push it into the out Stream +that was valid when the start tag was encountered (that is available +from the PageContext object passed to the handler in setPageContext). + + + +

    3. Dynamic Attributes

    + + +

    Any tag handler can optionally extend the DynamicAttributes +interface to indicate that it supports dynamic attributes. In addition +to implementing the DynamicAttributes interface, tag +handlers that support dynamic attributes must declare that they do so in +the Tag Library Descriptor.

    + +

    The TLD is what ultimately determines whether a tag handler accepts +dynamic attributes or not. If a tag handler declares that it supports +dynamic attributes in the TLD but it does not implement the +DynamicAttributes interface, the tag handler must be +considered invalid by the container.

    + +

    If the dynamic-attributes element for a tag being invoked contains +the value "true", the following requirements apply:

    + +
      +
    • For each attribute specified in the tag invocation that does not + have a corresponding attribute element in the TLD for this tag, + a call must be made to setDynamicAttribute(), + passing in the namespace of the attribute (or null if the attribute + does not have a namespace or prefix), the name of the attribute without + the namespace prefix, and the final value of the attribute.
    • + +
    • Dynamic attributes must be considered to accept request-time + expression values as well as deferred expressions.
    • + +
    • Dynamic attributes must be treated as though they were of type + java.lang.Object. If a ValueExpression + is passed as a dynamic attribute, the default value for the expected + return type is assumed to be java.lang.Object. If a + MethodExpression is passed as a dynamic + attribute, the default method signature is assumed to be void + method().
    • + +
    • Note that passing a String literal as a dynamic attribute will never + be considered as a deferred expression.
    • + +
    • The JSP container must recognize dynamic attributes that are + passed to the tag handler using the <jsp:attribute> standard + action.
    • + +
    • If the setDynamicAttribute() method throws + JspException, the doStartTag() or + doTag() method is not invoked for this tag, and the + exception must be treated in the same manner as if it came from + a regular attribute setter method.
    • + +
    • For a JSP document in either standard or XML syntax, If a + dynamic attribute has a prefix that doesn't map to a + namespace, a translation error must occur. In standard + syntax, only namespaces defined using taglib directives are + recognized.
    • + +
    + +

    In the following example, assume attributes a and b are declared +using the attribute element in the TLD, attributes d1 and d2 are not +declared, and the dynamic-attributes element is set to "true". +The attributes are set using the calls: +

      +
    • setA( "1" ),
    • +
    • setDynamicAttribute( null, "d1", "2" ),
    • +
    • setDynamicAttribute( "http://www.foo.com/jsp/taglib/mytag.tld", "d2", "3" ),
    • +
    • setB( "4" ),
    • +
    • setDynamicAttribute( null, "d3", "5" ), and
    • +
    • setDynamicAttribute( "http://www.foo.com/jsp/taglib/mytag.tld", "d4", "6" ).
    • +
    + +
    +<jsp:root xmlns:mytag="http://www.foo.com/jsp/taglib/mytag.tld" version="2.0">
    +  <mytag:invokeDynamic a="1" d1="2" mytag:d2="3">
    +    <jsp:attribute name="b">4</jsp:attribute>
    +    <jsp:attribute name="d3">5</jsp:attribute>
    +    <jsp:attribute name="mytag:d4">6</jsp:attribute>
    +  </mytag:invokeDynamic>
    +</jsp:root>
    +
    + + +

    4. Annotated Tag Handler Management Example

    +
    + +Below is a somewhat complete example of the way one JSP container +could choose to do some tag handler management. There are many +other strategies that could be followed, with different pay offs. + +

    In this example, we are assuming that +x:iterate is an iterative tag, while x:doit and x:foobar are simple +tag. We will also assume that x:iterate and x:foobar implement the +TryCatchFinally interface, while x:doit does not. + +

    +<x:iterate src="foo">
    +  <x:doit att1="one" att2="<%= 1 + 1 %>" />
    +  <x:foobar />
    +  <x:doit att1="one" att2="<%= 2 + 2 %>" />
    +</x:iterate>
    +<x:doit att1="one" att2="<%= 3 + 3 %>" />
    +
    + +

    The particular code shown below assumes there is some pool of tag +handlers that are managed (details not described, although pool +managing is simpler when there are no optional attributes), and +attemps to reuse tag handlers if possible. The code also "hoists" +setting of properties to reduce the cost when appropriate, e.g. inside +an iteration. + +

    +
    +boolean b1, b2;
    +IterationTag i; // for x:iterate
    +Tag d; // for x:doit
    +Tag d; // for x:foobar
    +
    +page: // label to end of page...
    +
    +
    +// initialize iteration tag
    +i = get tag from pool or new();
    +
    +i.setPageContext(pc);
    +i.setParent(null);
    +i.setSrc("foo");
    +
    +// x:iterate implements TryCatchFinally
    +try {
    +    if ((b1 = i.doStartTag()) == EVAL_BODY_INCLUDE) {
    +
    +        // initialize doit tag
    +        // code has been moved out of the loop for show
    +        d = get tag from pool or new();
    +
    +        d.setPageContext(pc);
    +        d.setParent(i);
    +        d.setAtt1("one");
    +
    +    loop:
    +        while (1) do {
    +            // I'm ignoring newlines...
    +
    +            // two invocations, fused together
    +
    +            // first invocation of x:doit
    +            d.setAtt2(1+1);
    +            if ((b2 = d.doStartTag()) == EVAL_BODY_INCLUDE) {
    +                // nothing
    +            } else if (b2 != SKIP_BODY) {
    +                // Q? protocol error ...
    +            }
    +            if ((b2 = d.doEndTag()) == SKIP_PAGE) {
    +                break page;  // be done with it.
    +            } else if (b2 != EVAL_PAGE) {
    +                // Q? protocol error
    +            }
    +
    +	    // x:foobar invocation
    +            f = get tag from pool or new();
    +            f.setPageContext(pc);
    +            f.setParent(i);
    +
    +            // x:foobar implements TryCatchFinally
    +            try {
    +        
    +                if ((b2 = f.doStartTag()) == EVAL_BODY_INCLUDE) {
    +                    // nothing
    +                } else if (b2 != SKIP_BODY) {
    +                    // Q? protocol error
    +                }
    +                if ((b2 = f.doEndTag()) == SKIP_PAGE) {
    +                    break page;  // be done with it.
    +                } else if (b2 != EVAL_PAGE) {
    +                    // Q? protocol error
    +                }
    +            } catch (Throwable t) {
    +                f.doCatch(t); // caught, may been rethrown!
    +            } finally {
    +                f.doFinally();
    +            }
    +
    +            // put f back to pool
    +        
    +            // second invocation of x:doit
    +            d.setAtt2(2+2);
    +            if ((b2 = d.doStartTag()) == EVAL_BODY_INCLUDE) {
    +                // nothing
    +            } else if (b2 != SKIP_BODY) {
    +                // Q? protocol error
    +            }
    +            if ((b2 = d.doEndTag()) == SKIP_PAGE) {
    +                break page;  // be done with it.
    +            } else if (b2 != EVAL_PAGE) {
    +                // Q? protocol error
    +            }
    +
    +            if ((b2 = i.doAfterBody()) == EVAL_BODY_AGAIN) {
    +                break loop;
    +            } else if (b2 != SKIP_BODY) {
    +                // Q? protocol error
    +            }
    +        // loop
    +        }
    +
    +    } else if (b1 != SKIP_BODY) {
    +        // Q? protocol error
    +    }
    +
    +    // tail end of the IteratorTag ...
    +
    +    if ((b1 = i.doEndTag()) == SKIP_PAGE) {
    +        break page;   // be done with it.
    +    } else if (b1 != EVAL_PAGE) {
    +        // Q? protocol error
    +    }
    +    
    +    // third invocation
    +    // this tag handler could be reused from the previous ones.
    +    d = get tag from pool or new();
    +
    +    d.setPageContext(pc);
    +    d.setParent(null);
    +    d.setAtt1("one");
    +    d.setAtt2(3+3);
    +
    +    if ((b1 = d.doStartTag()) == EVAL_BODY_INCLUDE) {
    +        // nothing
    +    } else if (b1 != SKIP_BODY) {
    +        // Q? protocol error
    +    }
    +    if ((b1 = d.doEndTag()) == SKIP_PAGE) {
    +        break page;  // be done with it.
    +    } else if (b1 != EVAL_PAGE) {
    +        // Q? protocol error
    +    }
    +
    +} catch (Throwable t) {
    +    i.doCatch(t); // caught, may been rethrown!
    +} finally {
    +    i.doFinally();
    +}
    +
    + + +

    5. Cooperating Actions

    +
    + +Actions can cooperate with other actions and with scripting code +in a number of ways. + +

    PageContext

    +

    + +Often two actions in a JSP page will want to cooperate, +perhaps by one action creating some server-side object that +needs to be accessed by another. +One mechanism for doing this is by giving the object a name +within the JSP page; the first action will create the object +and associate the name to it while the second action +will use the name to retrieve the object. + +

    +For example, in the following JSP segment the foo +action might create a server-side object and give it the +name "myObject". +Then the bar +action might access that server-side object and take some action. + +

    + +
    +<x:foo id="myObject" />
    +<x:bar ref="myObjet" />
    +
    +
    +
    + +

    + +In a JSP implementation, the mapping "name"->value is kept by the +implicit object +pageContext. + +This object is passed around through the Tag handler instances +so it can be used to communicate information: all it is needed +is to know the name under which the information is stored into +the pageContext. + +

    The Runtime Stack

    +

    + +An alternative to explicit communication of information through +a named object is implicit coordination based on syntactic scoping. + +

    +For example, in the following JSP segment the foo +action might create a server-side object; +later the nested bar action might access that server-side object. +The object is not named within the pageContext: +it is found because the specific foo element is the +closest enclosing instance of a known element type. + +

    + +
    +<foo>
    +   <bar/>
    +</foo>
    +
    +
    +
    + +

    +This functionality is supported through the +TagSupport.findAncestorWithClass(Tag, Class), +which uses a reference to parent tag kept by each Tag instance, +which effectively provides a run-time execution stack. + + +

    6. Simple Tag Handlers

    + + +

    This section presents the API to implement Simple Tag Handlers. +Simple Tag Handlers present a much simpler invocation +protocol than do Classic Tag Handlers.

    + +

    The Tag Library Descriptor maps tag library declarations to their +physical underlying implementations. A Simple Tag Handler is +represented in Java by a class which implements the +SimpleTag interface.

    + +

    Unlike classic tag handlers, the SimpleTag interface does not +extend Tag. Instead of supporting doStartTag() and +doEndTag(), the SimpleTag interface provides +a simple doTag() method, which is called once and only once +for any given tag invocation. All tag logic, iteration, body +evaluations, etc. are to be performed in this single method. Thus, +simple tag handlers have the equivalent power of BodyTag, +but with a much simpler lifecycle and interface.

    + +

    To support body content, the setJspBody() +method is provided. The container invokes the setJspBody() +method with a JspFragment object encapsulating the body +of the tag. The tag handler implementation can call +invoke() on that fragment to evaluate the body. The +SimpleTagSupport convenience class provides +getJspBody() and other useful methods to make this even +easier.

    + +

    Lifecycle of Simple Tag Handlers

    +

    This section describes the lifecycle of simple tag handlers, from +creation to invocation. For all semantics left unspecified by this +section, the semantics default to that of a classic tag handler.

    + +

    When a simple tag handler is invoked, the following steps occur +(in order):

    + +
      +
    1. Simple tag handlers are created initially using a zero + argument constructor on the corresponding implementation class. + Unlike classic tag handlers, this instance must never be pooled by + the container. A new instance must be created for each tag invocation.
    2. + +
    3. The setJspContext() and setParent() + methods are invoked on the tag handler. The setParent() + method need not be called if the value being passed in is + null. In the case of tag files, a JspContext + wrapper is created so that the tag file can appear to have its own page + scope. Calling getJspContext() must return the wrapped + JspContext.
    4. + +
    5. The attributes specified as XML element attributes (if any) + are evaluated next, in the order in which they are declared, according + to the following rules (referred to as "evaluating an XML element + attribute" below). The appropriate bean property setter is invoked + for each. If no setter is defined for the specified attribute but + the tag accepts dynamic attributes, the setDynamicAttribute() + method is invoked as the setter. +
        +
      • If the attribute is a scripting expression (e.g. "<%= 1+1 %>" + in JSP syntax, or "%= 1+1 %" in XML syntax), the expression is + evaluated, and the result is converted as per the rules in + "Type Conversions", and passed to the setter.
      • + +
      • Otherwise, if the attribute contains any Expression Language + expressions (e.g. "Hello ${name}"), the expression is evaluated, and + the result is converted and passed to the setter.
      • + +
      • Otherwise, the attribute value is taken verbatim, converted, + and passed to the setter.
      • +
      +
    6. + +
    7. The value for each <jsp:attribute> element is evaluated, + and the corresponding bean property setter methods are invoked for + each, in the order in which they appear in the body of the tag. If no + setter is defined for the specified attribute but the tag + accepts dynamic attributes, the setDynamicAttribute() + method is invoked as the setter. +
        +
      • Otherwise, if the attribute is not of type + JspFragment, the container evaluates the body of + the <jsp:attribute> element. This evaluation can be done + in a container-specific manner. Container implementors should + note that in the process of evaluating this body, other custom + actions may be invoked.
      • + +
      • Otherwise, if the attribute is of type JspFragment, + an instance of a JspFragment object is created and + passed in.
      • +
      +
    8. + +
    9. The value for the body of the tag is determined, and if + a body exists the setJspBody() method is called on the + tag handler. +
        +
      • If the tag is declared to have a body-content + of "empty" or no body or an empty body is passed + for this invocation, then setJspBody() is not + called.
      • + +
      • Otherwise, the body of the tag is either the body of + the <jsp:body> element, or the body of the custom action + invocation if no <jsp:body> or <jsp:attribute> + elements are present. In this case, an instance of a + JspFragment object is created as per the lifecycle + described in the JSP Fragments section and it is passed to the + setter. If the tag is declared to have a body-content + of "tagdependent" the JspFragment must + echo the body's contents verbatim. Otherwise, if the tag is + declared to have a body-content of type + "scriptless", the JspFragment must + evaluate the body's contents as a JSP scriptless body.
      • +
      +
    10. + +
    11. The doTag() method is invoked.
    12. + +
    13. The implementation of doTag() performs its + function, potentially calling other tag handlers (if the tag + handler is implemented as a tag file) and invoking fragments.
    14. + +
    15. The doTag() method returns, and the tag handler + instance is discarded. If SkipPageException is thrown, + the rest of the page is not evaluated and the request is completed. + If this request was forwarded or included from another page (or Servlet), + only the current page evaluation stops.
    16. + +
    17. For each tag scripting variable declared with scopes + AT_BEGIN or AT_END, the appropriate + scripting variables and scoped attributes are declared, as with + classic tag handlers.
    18. +
    + + +

    7. JSP Fragments

    +
    + +

    JSP Fragments are represented in Java by an instance of the +javax.servlet.jsp.tagext.JspFragment abstract class. +Pieces of JSP code are translated into JSP fragments in the context +of a tag invocation. JSP Fragments are created when providing the body of a +<jsp:attribute> standard action for an attribute that is defined +as a fragment or of type JspFragment, or when providing the body of a +tag invocation handled by a Simple Tag Handler.

    + +

    Before being passed to a tag handler, the JspFragment +instance is associated with the JspContext of the +surrounding page in an implementation-dependent manner. In addition, + +it is associated with the parent Tag or SimpleTag +instance for collaboration purposes, so that when a custom action is +invoked from within the fragment, setParent() can be called +with the appropriate value. The fragment implementation must keep +these associations for the duration of the tag invocation in which it +is used.

    + +

    The invoke() method executes the body and directs +all output to either the passed in java.io.Writer or +the JspWriter returned by the getOut() method +of the JspContext associated with the fragment.

    + +

    The implementation of each method can optionally throw a +JspException, which must be handled by the invoker. Note +that tag library developers and page authors should not generate +JspFragment implementations manually.

    + +

    The following sections specify the creation and invocation +lifecycles of a JSP Fragment in detail, from the JSP Container's +perspective.

    + + +

    Creation of a JSP Fragment

    + +

    When a JSP fragment is created, the following steps occur (in order): + +

      +
    1. An instance of a class implementing the JspFragment + abstract class is obtained (may either be created or can optionally be cached) + each time the tag is invoked. This instance must be configured to + produce the contents of the body of the fragment when invoked. If the + fragment is defining the body of a <jsp:attribute>, the fragment + must evaluate the body each time it is invoked. Otherwise, if the + fragment is defining the body of a simple tag, the behavior of the + fragment when invoked varies depending on the body-content + declared for the tag: +
        +
      • If the body-content is "tagdependent", + then the fragment must echo the contents of the body verbatim + when invoked.
      • + +
      • If the body-content is "scriptless", + then the fragment must evaluate the body each time it is invoked.
      • +
      +
    2. + +
    3. The JspFragment instance is passed a reference to + the current JspContext. Whenever the fragment invokes + a tag handler, it must use this value when calling + setJspContext().
    4. + +
    5. The JspFragment instance is associated with an + instance of the tag handler of the nearest enclosing tag + invocation, or with null if there is no enclosing tag. + Whenever the fragment invokes a tag handler, the fragment must + use this value when calling setParent().
    6. +
    + + +

    Invocation of a JSP Fragment

    + +

    After a JSP fragment is created, it is passed to a tag handler for +later invocation. JSP fragments can be invoked either programmatically +from a tag handler written in Java, or from a tag file using the +<jsp:invoke> or <jsp:doBody> standard action.

    + +

    JSP fragments are passed to tag handlers using a bean property +of type JspFragment. These fragments can be invoked by +calling the invoke() method in the JspFragment +abstract class. Note that it is legal (and possible) for a fragment to +recursively invoke itself, indirectly.

    + +

    The following steps are followed when invoking a JSP fragment:

    + +
      +
    1. The tag handler invoking the fragment is responsible for + setting the values of all declared AT_BEGIN and + NESTED variables in the JspContext of the + calling page/tag, before invoking the fragment. Note that this is + not always the same as the JspContext of the fragment + being invoked, as fragments can be passed from one tag to another. + In the case of tag files, for each variable declared + in scope AT_BEGIN or NESTED, if a page + scoped attribute exists with the provided name in the tag file, the + JSP container must generate code to create/update the page scoped + attribute of the provided name in the calling page/tag. If a page + scoped attribute with the provided name does not exist in the tag + file, and a page scoped attribute of the provided name is present in + the calling page, the scoped attribute is removed from the calling + page's page scope. See the chapter on Tag Files for details.
    2. + +
    3. If <jsp:invoke> or <jsp:doBody> is being used to + invoke a fragment, if the var attribute is specified, + a custom java.io.Writer is created that can expose + the result of the invocation as a java.lang.String + object. If the varReader attribute is + specified, a custom java.io.Writer object is created + that can expose the resulting invocation as a + java.io.Reader object.
    4. + +
    5. The invoke() method of the fragment is invoked, + passing in an optional Writer.
    6. + +
    7. Before executing the body of the fragment, if a non-null value + is provided for the writer parameter, then the value of + JspContext.getOut() and the implicit "out" object must + be updated to send output to that writer. To accomplish + this, the container must call pushBody( writer ) on the + current JspContext, where writer is the + instance of java.io.Writer passed to the fragment upon + invocation.
    8. + +
    9. The body of the fragment is then evaluated by executing + the generated code. The body of the fragment may execute other standard + or custom actions. If a classic Custom Tag Handler is invoked and + returns SKIP_PAGE, or if a Simple Tag Handler is invoked + and throws SkipPageException, the + JspFragment must throw SkipPageException to + signal that the calling page is to be skipped.
    10. + +
    11. Once the fragment has completed its evaluation, even if an exception + is thrown, the value of JspContext.getOut() must be + restored via a call to popBody() on the current + JspContext.
    12. + +
    13. The fragment returns from invoke()
    14. + +
    15. If <jsp:invoke> or <jsp:doBody> is being used to + invoke a fragment, if the var or varReader + attribute is specified, a scoped variable with a name equal to the + value of the var or varReader attribute + is created (or modified) in the page scope, and the value is set + to a java.lang.String or java.io.Reader + respectively that can produce the results of the fragment + invocation.
    16. + +
    17. The invoke() method can be called again, zero or more + times. When the tag invocation defining the fragment is complete, + the tag must discard the fragment instance since it might be reused + by the container.
    18. + +
    + + +

    8. Example Simple Tag Handler Scenario

    +
    + +

    The following non-normative example is intended to help solidify +some of the concepts relating to Tag Files, JSP Fragments and Simple +Tag Handlers. In the first section, two sample input files are +presented, a JSP (my.jsp), and a simple tag handler implemented using +a tag file (simpletag.tag). One possible output of the translation +process is presented in the second section.

    + +

    Although short, the example shows all concepts, including +the variable directive. In practice most uses of tags will be much simpler, +but probably longer.

    + +

    The sample generated code is annotated with comments that point +to lifecycle steps presented in various sections. The notation is as +follows:

    + +
      +
    • "Step T.x" = Annotated step x from "Lifecycle of Simple Tag + Handlers" earlier in this Chapter.
    • +
    • "Step C.x" = Annotated step x from "Creation of a JSP Fragment" + earlier in this Chapter.
    • +
    • "Step F.x" = Annotated step x from "Invocation of a JSP Fragment" + earlier in this Chapter.
    • +
    + + +

    Sample Source Files

    + +

    This section presents the sample source files in this scenario, +from which the output files are generated.

    + +

    Original JSP (my.jsp)

    +
    +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
    +
    +<my:simpleTag x="10">
    +    <jsp:attribute name="y">20</jsp:attribute>
    +    <jsp:attribute name="nonfragment">
    +        Nonfragment Template Text
    +    </jsp:attribute>
    +    <jsp:attribute name="frag">
    +        Fragment Template Text ${var1}
    +    </jsp:attribute>
    +    <jsp:body>
    +        Body of tag that defines an AT_BEGIN
    +        scripting variable ${var1}.
    +    </jsp:body>
    +</my:simpleTag>
    +
    + +

    Original Tag File (/WEB-INF/tags/simpletag.tag)

    +
    +<%-- /WEB-INF/tags/simpletag.tag --%>
    +<%@ attribute name="x" %>
    +<%@ attribute name="y" %>
    +<%@ attribute name="nonfragment" %>
    +<%@ attribute name="frag" fragment="true" %>
    +<%@ variable name-given="var1" scope="AT_BEGIN" %>
    +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    +
    +Some template text.
    +<c:set var="var1" value="${x+y}"/>
    +<jsp:invoke fragment="frag" varReader="var1"/>
    +
    +Invoke the body:
    +<jsp:doBody/>
    +
    + + +

    Sample Generated Files

    +

    This section presents sample output files that might be generated +by a JSP compiler, from the source files presented in the +previous section.

    + +

    Helper class for JspFragment (JspFragmentBase.java)

    +
    +public abstract class JspFragmentBase
    +    implements javax.servlet.jsp.tagext.JspFragment
    +{
    +    protected javax.servlet.jsp.JspContext jspContext;
    +    protected javax.servlet.jsp.tagext.JspTag parentTag;
    +    public void JspFragmentBase(
    +        javax.servlet.jsp.JspContext jspContext,
    +        javax.servlet.jsp.tagext.JspTag parentTag )
    +    {
    +        this.jspContext = jspContext;
    +        this.parentTag = parentTag;
    +    }
    +}
    +
    +

    Relevant Portion of JSP Service Method

    +
    +// Step T.1 - Initial creation
    +MySimpleTag _jsp_mySimpleTag = new MySimpleTag();
    +// Step T.2 - Set page context and parent (since parent is null,
    +// no need to call setParent() in this case)
    +_jsp_mySimpleTag.setJspContext( jspContext );
    +// Step T.3 - XML element attributes evaluated and set
    +_jsp.mySimpleTag.setX( "10" );
    +// Step T.4 - <jsp:attribute> elements evaluated and set
    +//   - parameter y
    +// (using PageContext.pushBody() is one possible implementation - 
    +// one limitation is that this code will only work for Servlet-based code).
    +out = ((PageContext)jspContext).pushBody();
    +out.write( "20" );
    +_jsp_mySimpleTag.setY( 
    +    ((javax.servlet.jsp.tagext.BodyContent)out).getString() );
    +out = jspContext.popBody();
    +//   - parameter nonfragment
    +// (using PageContext.pushBody() is one possible implementation - 
    +// one limitation is that this code will only work for Servlet-based code).
    +// Note that trim is enabled by default, else we would have "\n    Non..."
    +out = ((PageContext)jspContext).pushBody();
    +out.write( "Nonfragment Template Text" );
    +_jsp_mySimpleTag.setNonfragment( 
    +    ((javax.servlet.jsp.tagext.BodyContent)out).getString() );
    +out = jspContext.popBody();
    +//   - parameter frag
    +_jsp_mySimpleTag.setFrag(
    +    // Step C.1 - New instance of fragment created
    +    // Step C.2 - Store jspContext
    +    // Step C.3 - Association with nearest enclosing Tag instance
    +    new JspFragmentBase( jspContext, _jsp_mySimpleTag ) {
    +        public void invoke( java.io.Writer writer ) {
    +	    javax.servlet.jsp.JspWriter out;
    +            // Step F.1-F.3 done in tag file (see following example)
    +	    // Step F.4 - If writer provided, push body:
    +	    if( out == null ) {
    +		out = this.jspContext.getOut();
    +	    }
    +	    else {
    +		out = this.jspContext.pushBody( writer );
    +	    }
    +	    // Step F.5 - Evaluate body of fragment:
    +            try {
    +                out.write( "Fragment Template Text " );
    +                out.write( jspContext.getExpressionEvaluator().evaluate(
    +		    "${var1}",
    +		    java.lang.String.class,
    +		    vResolver, fMapper, "my" ) );
    +            }
    +            finally {
    +                // Step F.6 - Restore value of JspContext.getOut()
    +		if( writer != null ) {
    +		    this.jspContext.popBody();
    +		}
    +            }
    +
    +            // Step F.7-F.9 done in tag file (see following example)
    +        }
    +    } );
    +// Step T.5 - Determine and set body of the tag
    +// - body of tag
    +_jsp_mySimpleTag.setJspBody(
    +    // Step C.1 - New instance of fragment created
    +    // Step C.2 - Store jspContext
    +    // Step C.3 - Association with nearest enclosing Tag instance
    +    new JspFragmentBase( jspContext, _jsp_mySimpleTag ) {
    +        public void invoke( java.io.Writer writer ) {
    +	    javax.servlet.jsp.JspWriter out;
    +            // Step F.1-F.3 done in tag file (see following example)
    +	    // Step F.4 - If writer provided, push body:
    +	    if( writer == null ) {
    +		out = this.jspContext.getOut();
    +	    }
    +	    else {
    +		out = this.jspContext.pushBody( writer );
    +	    }
    +	    // Step F.5 - Evaluate body of fragment:
    +            try {
    +                out.write(
    +                    "Body of tag that defines an AT_BEGIN\n" +
    +                    " scripting variable " );
    +                out.write( jspContext.getExpressionEvaluator().evaluate(
    +		    "${var1}",
    +		    java.lang.String.class,
    +		    vResolver, fMapper, "my" ) );
    +                out.write( ".\n" );
    +            }
    +            finally {
    +                // Step F.6 - Restore value of JspContext.getOut()
    +		if( writer != null ) {
    +		    this.jspContext.popBody();
    +		}
    +            }
    +
    +            // Step F.7-F.9 done in tag file (see following example)
    +        }
    +    } );
    +// Step T.6 - Inovke doTag
    +// Step T.7 occurs in the tag file (see following example)
    +// Step T.8 - doTag returns - page will catch SkipPageException.
    +_jsp_mySimpleTag.doTag();
    +// Step T.9 - Declare AT_BEGIN and AT_END scripting variables
    +String var1 = (String)jspContext.findAttribute( "var1" );
    +
    + +

    Generated Simple Tag Handler (MySimpleTag.java)

    +
    +public class MySimpleTag
    +    extends javax.servlet.jsp.tagext.SimpleTagSupport
    +{
    +    // Attributes:
    +    private String x;
    +    private String y;
    +    private String nonfragment;
    +    private javax.servlet.jsp.tagext.JspFragment frag;
    +    // Setters and getters for attributes:
    +    public void setX( Stirng x ) {
    +        this.x = x; 
    +    }
    +    public String getX() {
    +        return this.x; 
    +    }
    +    public void setY( String y ) { 
    +        this.y = y; 
    +    }
    +    public String getY() { 
    +        return this.y; 
    +    }
    +    public void setNonfragment( String nonfragment ) {
    +        this.nonfragment = nonfragment; 
    +    }
    +    public String getNonfragment() {
    +        return this.nonfragment;
    +    }
    +    public void setFrag( javax.servlet.jsp.tagext.JspFragment frag ) {
    +        this.frag = frag;
    +    }
    +    public javax.servlet.jsp.tagext.JspFragment getFrag() {
    +        return this.frag;
    +    }
    +
    +    protected JspContext jspContext;
    +    public void setJspContext( JspContext ctx ) {
    +	super.setJspContext( ctx );
    +	// Step T.2 - A JspContext wrapper is created.
    +	// (Implementation of wrapper not shown).
    +	this.jspContext = new utils.JspContextWrapper( ctx );
    +    }
    +    public JspContext getJspContext() {
    +	// Step T.2 - Calling getJspContext() must return the 
    +	// wrapped JspContext.
    +	return this.jspContext;
    +    }
    +
    +    public void doTag() throws JspException {
    +	java.lang.Object jspValue;
    +	JspContext jspContext = getJspContext();
    +	JspContext _jsp_parentContext = 
    +	    SimpleTagSupport.this.getJspContext();
    +	try {
    +	    javax.servlet.jsp.JspWriter out = jspContext.getOut();
    +
    +	    // Create page-scope attributes for each tag attribute:
    +	    this.jspContext.setAttribute( "x", getX() );
    +	    this.jspContext.setAttribute( "y", getY() );
    +	    this.jspContext.setAttribute( "nonfragment", getNonfragment() );
    +	    this.jspContext.setAttribute( "frag", getFrag() );
    +
    +	    // Synchronize AT_BEGIN variables from calling page
    +	    if( (jspValue = _jsp_parentContext.getAttribute( 
    +		    "var1" )) != null ) 
    +	    {
    +		jspContext.setAttribute( "var1", value );
    +	    }
    +	    else {
    +		jspContext.removeAttribute( "var1", 
    +		    JspContext.PAGE_SCOPE );
    +	    }
    +
    +	    // Tag template text:
    +	    out.write( "\n\n\n\n\n\n\n\nSome template text.\n" );
    +
    +	    // Invoke c:set - recognized tag handler from JSTL:
    +	    jspContext.setAttribute( "var1", 
    +		jspContext.getExpressionEvaluator().evaluate(
    +		    "${x+y}",
    +		    java.lang.String.class,
    +		    jspContext,
    +		    prefixMap, functionMap, "my" ) );
    +
    +	    // Invoke the "frag" fragment:
    +	    // Step F.1 - Set values of AT_BEGIN and NESTED variables
    +	    //     in calling page context.
    +	    if( (jspValue = jspContext.getAttribute( "var1" )) != null ) {
    +		_jsp_parentContext.setAttribute( "var1", value );
    +	    }
    +	    else {
    +		_jsp_parentContext.removeAttribute( "var1", 
    +		    JspContext.PAGE_SCOPE );
    +	    }
    +
    +	    // Step F.2 - varReader is specified, generate a writer.
    +	    java.io.Writer _jsp_sout = new java.io.StringWriter();
    +
    +	    // Step F.3 - Invoke fragment with writer
    +	    getFrag().invoke( _jsp_sout );
    +
    +	    // Step F.4 - F.6 occur in the fragment (see above)
    +	    // Step F.7 - fragment returns
    +
    +	    // Step F.8 - varReader specified, so save to var
    +	    jspContext.setAttribute(
    +		"var1", new StringReader( _jsp_sout.toString() ) );
    +
    +	    // Step F.9 - Done!
    +
    +
    +	    out.write( "\n\nInvoke the body:\n" );
    +
    +	    // Invoke the body of the tag:
    +	    // Step F.1 - Set values of AT_BEGIN and NESTED variables
    +	    //     in calling page context.
    +	    if( (jspValue = jspContext.getAttribute( "var1" )) != null ) {
    +		_jsp_parentContext.setAttribute( "var1", value );
    +	    }
    +	    else {
    +		_jsp_parentContext.removeAttribute( "var1", 
    +		    JspContext.PAGE_SCOPE);
    +	    }
    +
    +	    // Step F.2 - varReader is not specified - does not apply.
    +
    +	    try {
    +		// Step F.3 - Invoke body, passing optional writer
    +		getJspBody().invoke( null );
    +	    }
    +	    finally {
    +		// Steps F.4 - F.6 occur in the fragment (see above)
    +		// Step F.7 - fragment returns
    +	    }
    +
    +	    // Step F.8 does not apply.
    +	    // Step F.9 - Done!
    +	}
    +	finally {
    +	    // Tag handlers generate code to synchronize AT_BEGIN with
    +	    // calling page, regardless of whether an error occurs.
    +	    if( (jspValue = jspContext.getAttribute( "var1" )) != null ) {
    +		_jsp_parentContext.setAttribute( "var1", value );
    +	    }
    +	    else {
    +		_jsp_parentContext.removeAttribute( "var1", 
    +		    JspContext.PAGE_SCOPE );
    +	    }
    +	}
    +    }
    +}
    +
    +
    + + +

    9. Translation-time Classes

    +
    + +The following classes are used at translation time. + +

    Tag mapping, Tag name

    + +

    A taglib directive introduces a tag library and associates a +prefix to it. The TLD associated with the library associates Tag +handler classes (plus other information) with tag names. This +information is used to associate a Tag class, a prefix, and a name +with each custom action element appearing in a JSP page. + +

    At execution time the implementation of a JSP page will use an +available Tag instance with the appropriate property settings and then +follow the protocol described by the interfaces Tag, IterationTag, +BodyTag, SimpleTag, and TryCatchFinally. The implementation guarantees +that all tag handler instances are initialized and all are released, +but the implementation can assume that previous settings are preserved +by a tag handler, to reduce run-time costs. + + +

    Scripting Variables

    + +

    JSP supports scripting variables that can be declared within a +scriptlet and can be used in another. JSP actions also can be used to +define scripting variables so they can used in scripting elements, or +in other actions. This is very useful in some cases; for example, the +jsp:useBean standard action may define an object which +can later be used through a scripting variable. + +

    In some cases the information on scripting variables can be +described directly into the TLD using elements. A special case is typical +interpretation of the "id" attribute. +In other cases the logic that decides whether an action instance +will define a scripting variable may be quite complex and the name of +a TagExtraInfo class is instead given in the TLD. The +getVariableInfo method of this class is used at +translation time to obtain information on each variable that will be +created at request time when this action is executed. The method is +passed a TagData instance that contains the +translation-time attribute values. + +

    Validation

    + +

    The TLD file contains several pieces of information that is used +to do syntactic validation at translation-time. It also contains two +extensible validation mechanisms: a TagLibraryValidator +class can be used to validate a complete JSP page, and a +TagExtraInfo class can be used to validate a specific +action. In some cases, additional request-time validation will be done +dynamically within the methods in the Tag instance. If an error is +discovered, an instance of JspTagException can be thrown. +If uncaught, this object will invoke the errorpage mechanism of JSP. + +

    The TagLibraryValidator is an addition to the JSP 1.2 +specification and is very open ended, being strictly more powerful +than the TagExtraInfo mechanism. A JSP page is presented via the +PageData object, which abstracts the XML view of the JSP +page. + +

    A PageData instance will provides an InputStream (read-only) on the +page. Later specifications may add other views on the page (DOM, SAX, +JDOM are all candidates), for now these views can be generated from +the InputStream and perhaps can be cached for improved performance +(recall the view of the page is just read-only). + +

    As of JSP 2.0, the JSP container must support a jsp:id attribute to +provide higher quality validation errors. The +container will track the JSP pages as passed to the container, and +will assign to each element a unique "id", which is passed as the +value of the jsp:id attribute. Each XML element in the XML view +will be extended with this attribute. The +TagLibraryValidator can use the attribute in one or more +ValidationMessage objects. The container then, in turn, can use these +values to provide more precise information on the location of an +error. + +

    The prefix for the id attribute need not be "jsp" +but it must map to the namespace http://java.sun.com/JSP/Page. +In the case where the user has redefined the jsp prefix, an +alternative prefix must be used by the container. + + +

    Validation Details

    + +

    In detail, validation is done as follows: + +

    First, the JSP page is parsed using the information in the TLD. +At this stage valid mandatory and optional attributes are checked. + +

    Second, for each unique tag library in the page as determined +by the tag library URI, and in the lexical order in which they appear, +their associated validator class (if any) is invoked. This involves +several substeps. + +

    The first substep is to obtain an initialized validator instance by +either: + +

      +
    • construct a new instance and invoke setInitParameters() on it, or +
    • obtain an existing instance that is not being used, invoke release() on it, and then invoke setInitParameters() on it, or +
    • locate an existing instance that is not being used on which the desired setInitParameters() has already been invoked +
    + +

    The class name is as indicated in the <validator-class> element, +and the Map passed through setInitParameters() is as described in the +<init-params> element. +All TagLibraryValidator classes are supposed to keep their initParameters +until new ones are set, or until release() is invoked on them. + +

    The second substep is to perform the actual validation. This is done +by invoking the validate() method with a prefix, uri, and PageData that +correspond to the taglib directive instance being validated and the +PageData representing the page. In the case where a single URI is mapped +to more than one prefix, the prefix of the first URI must be used. + +

    The last substep is to invoke the release() method on the validator tag +when it is no longer needed. This method releases all resources. + +

    Finally, after checking all the tag library validator classes, the +TagExtraInfo classes for all tags will be consulted by invoking their +validate method. The order of invocation of this methods +is undefined. + + + + + Index: lams_central/.classpath =================================================================== diff -u -r2ecc0f53ca8cf6bcb51c51ef297c46b7b0791131 -r576ed488f118d183b3876e1104a649abc5fa1a38 --- lams_central/.classpath (.../.classpath) (revision 2ecc0f53ca8cf6bcb51c51ef297c46b7b0791131) +++ lams_central/.classpath (.../.classpath) (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -13,9 +13,9 @@ - + - + Index: lams_common/.classpath =================================================================== diff -u -r2ecc0f53ca8cf6bcb51c51ef297c46b7b0791131 -r576ed488f118d183b3876e1104a649abc5fa1a38 --- lams_common/.classpath (.../.classpath) (revision 2ecc0f53ca8cf6bcb51c51ef297c46b7b0791131) +++ lams_common/.classpath (.../.classpath) (revision 576ed488f118d183b3876e1104a649abc5fa1a38) @@ -11,9 +11,9 @@ - + - +