--- conf/c-1_1.tld (revision 0)
+++ conf/c-1_1.tld (revision 0)
@@ -0,0 +1,563 @@
+
+
+
+
+ JSTL 1.1 core library
+ JSTL core
+ 1.1
+ c
+ http://java.sun.com/jsp/jstl/core_1_1
+
+
+
+ Provides core validation features for JSTL tags.
+
+
+ org.apache.taglibs.standard.tlv.JstlCoreTLV
+
+
+
+
+
+ Catches any Throwable that occurs in its body and optionally
+ exposes it.
+
+ catch
+ org.apache.taglibs.standard.tag.common.core.CatchTag
+ JSP
+
+
+Name of the exported scoped variable for the
+exception thrown from a nested action. The type of the
+scoped variable is the type of the exception thrown.
+
+ var
+ false
+ false
+
+
+
+
+
+ Simple conditional tag that establishes a context for
+ mutually exclusive conditional operations, marked by
+ <when> and <otherwise>
+
+ choose
+ org.apache.taglibs.standard.tag.common.core.ChooseTag
+ JSP
+
+
+
+
+ Simple conditional tag, which evalutes its body if the
+ supplied condition is true and optionally exposes a Boolean
+ scripting variable representing the evaluation of this condition
+
+ if
+ org.apache.taglibs.standard.tag.rt.core.IfTag
+ JSP
+
+
+The test condition that determines whether or
+not the body content should be processed.
+
+ test
+ true
+ true
+ boolean
+
+
+
+Name of the exported scoped variable for the
+resulting value of the test condition. The type
+of the scoped variable is Boolean.
+
+ var
+ false
+ false
+
+
+
+Scope for var.
+
+ scope
+ false
+ false
+
+
+
+
+
+ Retrieves an absolute or relative URL and exposes its contents
+ to either the page, a String in 'var', or a Reader in 'varReader'.
+
+ import
+ org.apache.taglibs.standard.tag.rt.core.ImportTag
+ org.apache.taglibs.standard.tei.ImportTEI
+ JSP
+
+
+The URL of the resource to import.
+
+ url
+ true
+ true
+
+
+
+Name of the exported scoped variable for the
+resource's content. The type of the scoped
+variable is String.
+
+ var
+ false
+ false
+
+
+
+Scope for var.
+
+ scope
+ false
+ false
+
+
+
+Name of the exported scoped variable for the
+resource's content. The type of the scoped
+variable is Reader.
+
+ varReader
+ false
+ false
+
+
+
+Name of the context when accessing a relative
+URL resource that belongs to a foreign
+context.
+
+ context
+ false
+ true
+
+
+
+Character encoding of the content at the input
+resource.
+
+ charEncoding
+ false
+ true
+
+
+
+
+
+ The basic iteration tag, accepting many different
+ collection types and supporting subsetting and other
+ functionality
+
+ forEach
+ org.apache.taglibs.standard.tag.rt.core.ForEachTag
+ org.apache.taglibs.standard.tei.ForEachTEI
+ JSP
+
+
+Collection of items to iterate over.
+
+ items
+ false
+ true
+ java.lang.Object
+
+
+
+If items specified:
+Iteration begins at the item located at the
+specified index. First item of the collection has
+index 0.
+If items not specified:
+Iteration begins with index set at the value
+specified.
+
+ begin
+ false
+ true
+ int
+
+
+
+If items specified:
+Iteration ends at the item located at the
+specified index (inclusive).
+If items not specified:
+Iteration ends when index reaches the value
+specified.
+
+ end
+ false
+ true
+ int
+
+
+
+Iteration will only process every step items of
+the collection, starting with the first one.
+
+ step
+ false
+ true
+ int
+
+
+
+Name of the exported scoped variable for the
+current item of the iteration. This scoped
+variable has nested visibility. Its type depends
+on the object of the underlying collection.
+
+ var
+ false
+ false
+
+
+
+Name of the exported scoped variable for the
+status of the iteration. Object exported is of type
+javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
+visibility.
+
+ varStatus
+ false
+ false
+
+
+
+
+
+ Iterates over tokens, separated by the supplied delimeters
+
+ forTokens
+ org.apache.taglibs.standard.tag.rt.core.ForTokensTag
+ JSP
+
+
+String of tokens to iterate over.
+
+ items
+ true
+ true
+ java.lang.String
+
+
+
+The set of delimiters (the characters that
+separate the tokens in the string).
+
+ delims
+ true
+ true
+ java.lang.String
+
+
+
+Iteration begins at the token located at the
+specified index. First token has index 0.
+
+ begin
+ false
+ true
+ int
+
+
+
+Iteration ends at the token located at the
+specified index (inclusive).
+
+ end
+ false
+ true
+ int
+
+
+
+Iteration will only process every step tokens
+of the string, starting with the first one.
+
+ step
+ false
+ true
+ int
+
+
+
+Name of the exported scoped variable for the
+current item of the iteration. This scoped
+variable has nested visibility.
+
+ var
+ false
+ false
+
+
+
+Name of the exported scoped variable for the
+status of the iteration. Object exported is of
+type
+javax.servlet.jsp.jstl.core.LoopTag
+Status. This scoped variable has nested
+visibility.
+
+ varStatus
+ false
+ false
+
+
+
+
+
+ Like <%= ... >, but for expressions.
+
+ out
+ org.apache.taglibs.standard.tag.rt.core.OutTag
+ JSP
+
+
+Expression to be evaluated.
+
+ value
+ true
+ true
+
+
+
+Default value if the resulting value is null.
+
+ default
+ false
+ true
+
+
+
+Determines whether characters <,>,&,'," in the
+resulting string should be converted to their
+corresponding character entity codes. Default value is
+true.
+
+ escapeXml
+ false
+ true
+
+
+
+
+
+
+ Subtag of <choose> that follows <when> tags
+ and runs only if all of the prior conditions evaluated to
+ 'false'
+
+ otherwise
+ org.apache.taglibs.standard.tag.common.core.OtherwiseTag
+ JSP
+
+
+
+
+ Adds a parameter to a containing 'import' tag's URL.
+
+ param
+ org.apache.taglibs.standard.tag.rt.core.ParamTag
+ JSP
+
+
+Name of the query string parameter.
+
+ name
+ true
+ true
+
+
+
+Value of the parameter.
+
+ value
+ false
+ true
+
+
+
+
+
+ Redirects to a new URL.
+
+ redirect
+ org.apache.taglibs.standard.tag.rt.core.RedirectTag
+ JSP
+
+
+The URL of the resource to redirect to.
+
+ url
+ false
+ true
+
+
+
+Name of the context when redirecting to a relative URL
+resource that belongs to a foreign context.
+
+ context
+ false
+ true
+
+
+
+
+
+ Removes a scoped variable (from a particular scope, if specified).
+
+ remove
+ org.apache.taglibs.standard.tag.common.core.RemoveTag
+ empty
+
+
+Name of the scoped variable to be removed.
+
+ var
+ true
+ false
+
+
+
+Scope for var.
+
+ scope
+ false
+ false
+
+
+
+
+
+ Sets the result of an expression evaluation in a 'scope'
+
+ set
+ org.apache.taglibs.standard.tag.rt.core.SetTag
+ JSP
+
+
+Name of the exported scoped variable to hold the value
+specified in the action. The type of the scoped variable is
+whatever type the value expression evaluates to.
+
+ var
+ false
+ false
+
+
+
+Expression to be evaluated.
+
+ value
+ false
+ true
+
+
+
+Target object whose property will be set. Must evaluate to
+a JavaBeans object with setter property property, or to a
+java.util.Map object.
+
+ target
+ false
+ true
+
+
+
+Name of the property to be set in the target object.
+
+ property
+ false
+ true
+
+
+
+Scope for var.
+
+ scope
+ false
+ false
+
+
+
+
+
+ Creates a URL with optional query parameters.
+
+ url
+ org.apache.taglibs.standard.tag.rt.core.UrlTag
+ JSP
+
+
+Name of the exported scoped variable for the
+processed url. The type of the scoped variable is
+String.
+
+ var
+ false
+ false
+
+
+
+Scope for var.
+
+ scope
+ false
+ false
+
+
+
+URL to be processed.
+
+ value
+ false
+ true
+
+
+
+Name of the context when specifying a relative URL
+resource that belongs to a foreign context.
+
+ context
+ false
+ true
+
+
+
+
+
+ Subtag of <choose> that includes its body if its
+ condition evalutes to 'true'
+
+ when
+ org.apache.taglibs.standard.tag.rt.core.WhenTag
+ JSP
+
+
+The test condition that determines whether or not the
+body content should be processed.
+
+ test
+ true
+ true
+ boolean
+
+
+
+
--- conf/c.tld (revision 655871)
+++ conf/c.tld (working copy)
@@ -1,13 +1,13 @@
-
-
- JSTL 1.1 core library
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+ version="2.1">
+
+ JSTL 1.2 core library
JSTL core
- 1.1
+ 1.2
c
http://java.sun.com/jsp/jstl/core
@@ -174,6 +174,9 @@
false
true
java.lang.Object
+
+ java.lang.Object
+
@@ -253,6 +256,9 @@
true
true
java.lang.String
+
+ java.lang.String
+
@@ -467,6 +473,9 @@
value
false
true
+
+ java.lang.Object
+
--- src/org/apache/taglibs/standard/lang/jstl/test/PageContextImpl.java (revision 655871)
+++ src/org/apache/taglibs/standard/lang/jstl/test/PageContextImpl.java (working copy)
@@ -31,6 +31,7 @@
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.el.ExpressionEvaluator;
import javax.servlet.jsp.el.VariableResolver;
+import javax.el.ELContext;
/**
*
@@ -298,4 +299,5 @@
public ExpressionEvaluator getExpressionEvaluator() { return null; }
public VariableResolver getVariableResolver() { return null; }
+ public ELContext getELContext() { return null; }
}
--- src/org/apache/taglibs/standard/extra/spath/SPathFilter.java (revision 655871)
+++ src/org/apache/taglibs/standard/extra/spath/SPathFilter.java (working copy)
@@ -20,9 +20,9 @@
import java.util.List;
import java.util.Stack;
-import org.apache.xalan.serialize.Serializer;
-import org.apache.xalan.serialize.SerializerFactory;
-import org.apache.xalan.templates.OutputProperties;
+import org.apache.xml.serializer.Serializer;
+import org.apache.xml.serializer.SerializerFactory;
+import org.apache.xml.serializer.OutputPropertiesFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -76,7 +76,7 @@
f1.setParent(r);
f2.setParent(f1);
Serializer sz = SerializerFactory.getSerializer
- (OutputProperties.getDefaultMethodProperties("xml"));
+ (OutputPropertiesFactory.getDefaultMethodProperties("xml"));
sz.setOutputStream(System.out);
f2.setContentHandler(sz.asContentHandler());
--- src/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java (revision 655871)
+++ src/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java (working copy)
@@ -58,8 +58,8 @@
validateStep();
}
- // stores the 'items' String we're passed
- public void setItems(String s) throws JspTagException {
+ // stores the 'items' Object we're passed
+ public void setItems(Object s) throws JspTagException {
items = s;
// use the empty string to indicate "no iteration"
if (s == null)
--- src/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java (revision 655871)
+++ src/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java (working copy)
@@ -39,12 +39,24 @@
private String password;
public void setDriverClassName(String driverClassName)
- throws ClassNotFoundException, InstantiationException,
- IllegalAccessException {
+ throws ClassNotFoundException, InstantiationException,
+ IllegalAccessException {
- this.driverClassName = driverClassName;
- Class.forName(driverClassName, true,
- Thread.currentThread().getContextClassLoader()).newInstance();
+ this.driverClassName = driverClassName;
+
+ //get the classloader
+ ClassLoader cl;
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ cl = Thread.currentThread().getContextClassLoader();
+ } else {
+ cl = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction()
+ {public ClassLoader run() {return Thread.currentThread().getContextClassLoader();}});
+ }
+ //done getting classloader
+
+ Class.forName(driverClassName, true, cl).newInstance();
}
public void setJdbcURL(String jdbcURL) {
@@ -110,6 +122,13 @@
public synchronized void setLogWriter(PrintWriter out) throws SQLException {
throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
}
+
+ public synchronized boolean isWrapperFor(Class c) throws SQLException {
+ throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
+ }
+ public synchronized Object unwrap(Class c) throws SQLException {
+ throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
+ }
}
--- src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java (revision 655871)
+++ src/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java (working copy)
@@ -200,8 +200,8 @@
if (locCtxt == null) {
// try using the root resource bundle with the given basename
try {
- bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE,
- Thread.currentThread().getContextClassLoader());
+ ClassLoader cl = getClassLoaderCheckingPrivilege();
+ bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE, cl);
if (bundle != null) {
locCtxt = new LocalizationContext(bundle, null);
}
@@ -278,9 +278,8 @@
ResourceBundle match = null;
try {
- ResourceBundle bundle =
- ResourceBundle.getBundle(basename, pref,
- Thread.currentThread().getContextClassLoader());
+ ClassLoader cl = getClassLoaderCheckingPrivilege();
+ ResourceBundle bundle = ResourceBundle.getBundle(basename, pref, cl);
Locale avail = bundle.getLocale();
if (pref.equals(avail)) {
// Exact match
@@ -325,4 +324,17 @@
return match;
}
+
+ private static ClassLoader getClassLoaderCheckingPrivilege() {
+ ClassLoader cl;
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ cl = Thread.currentThread().getContextClassLoader();
+ } else {
+ cl = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction()
+ {public ClassLoader run() {return Thread.currentThread().getContextClassLoader();}});
+ }
+ return cl;
+ }
}
--- src/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java (revision 655871)
+++ src/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java (working copy)
@@ -23,7 +23,13 @@
import java.util.Map;
import java.util.StringTokenizer;
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.IndexedValueExpression;
+import javax.servlet.jsp.jstl.core.IteratedExpression;
+import javax.servlet.jsp.jstl.core.IteratedValueExpression;
import javax.servlet.jsp.jstl.core.LoopTagSupport;
import org.apache.taglibs.standard.resources.Resources;
@@ -108,7 +114,133 @@
return i.next();
}
}
+
+ protected class DeferredForEachIterator implements ForEachIterator {
+ private ValueExpression itemsValueExpression;
+ private IteratedExpression itemsValueIteratedExpression;
+ private int length = -1;
+ private int currentIndex = 0;
+ private boolean isIndexedValueExpression = false;
+ private boolean anIterator = false;
+ private Iterator myIterator;
+ private boolean anEnumeration = false;
+ private Enumeration myEnumeration;
+ public DeferredForEachIterator(ValueExpression o) throws JspTagException {
+ itemsValueExpression = o;
+ determineLengthAndType();
+ }
+ public boolean hasNext() throws JspTagException {
+ if (isIndexedValueExpression) {
+ if (currentIndex initParms) {
super.setInitParameters(initParms);
String declarationsParm = (String) initParms.get("allowDeclarations");
String scriptletsParm = (String) initParms.get("allowScriptlets");
--- src/javax/servlet/jsp/jstl/core/IteratedExpression.java (revision 0)
+++ src/javax/servlet/jsp/jstl/core/IteratedExpression.java (revision 0)
@@ -0,0 +1,136 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jstl.core;
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+public final class IteratedExpression {
+ protected final ValueExpression orig;
+ protected final String delims;
+ private Object originalListObject = null;
+ private Iterator currentListObject = null;
+ private int currentIndex=0;
+ private enum TypesEnum {Undefined, ACollection, AnIterator, AnEnumeration, AMap, AString};
+ private TypesEnum type = TypesEnum.Undefined;
+
+ public IteratedExpression(ValueExpression valueExpression, String stringTokenSeparator) {
+ orig = valueExpression;
+ delims = stringTokenSeparator;
+ }
+
+ public Object getItem(ELContext context, int i) {
+ if (originalListObject == null) {
+ originalListObject = orig.getValue(context);
+ if (originalListObject instanceof Collection){
+ type=TypesEnum.ACollection;
+ } else if (originalListObject instanceof Iterator) {
+ type=TypesEnum.AnIterator;
+ } else if (originalListObject instanceof Enumeration) {
+ type=TypesEnum.AnEnumeration;
+ } else if (originalListObject instanceof Map) {
+ type=TypesEnum.AMap;
+ } else if (originalListObject instanceof String) { //StringTokens
+ type=TypesEnum.AString;
+ } else {
+ //it's of some other type ... should never get here
+ throw new RuntimeException("IteratedExpression.getItem: Object not of correct type.");
+ }
+ currentListObject = returnNewIterator(originalListObject, type);
+ }
+ Object currentObject=null;
+ if (i= end));
}
+ /**
+ * Get the delimiter for string tokens. Used only for constructing
+ * the deferred expression for it.
+ */
+ protected String getDelims() {
+ return ",";
+ }
}
--- src/javax/servlet/jsp/jstl/core/IndexedValueExpression.java (revision 0)
+++ src/javax/servlet/jsp/jstl/core/IndexedValueExpression.java (revision 0)
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jstl.core;
+
+import java.io.Serializable;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+public final class IndexedValueExpression extends ValueExpression implements Serializable {
+
+ private static final long serialVersionUID = -7300711701036452952L;
+ protected final Integer i;
+ protected final ValueExpression orig;
+
+ public IndexedValueExpression(ValueExpression valueExpression, int _i) {
+ orig = valueExpression;
+ i=_i;
+ }
+
+ public boolean equals(Object arg0) {
+ boolean rc=false;
+ if (arg0!=null) {
+ if (arg0.equals(orig)) {
+ rc = true;
+ }
+ }
+ return rc;
+ }
+
+ public Class getExpectedType() {
+ return orig.getExpectedType();
+ }
+
+ public String getExpressionString() {
+ return orig.getExpressionString();
+ }
+
+ public Class getType(ELContext elContext) {
+ return elContext.getELResolver().getType(elContext, orig.getValue(elContext), i);
+ }
+
+ public Object getValue(ELContext elContext) {
+ return elContext.getELResolver().getValue(elContext, orig.getValue(elContext), i);
+ }
+
+ public int hashCode() {
+ return orig.hashCode()+i;
+ }
+
+ public boolean isLiteralText() {
+ return false;
+ }
+
+ public boolean isReadOnly(ELContext elContext) {
+ return elContext.getELResolver().isReadOnly(elContext, orig.getValue(elContext), i);
+ }
+
+ public void setValue(ELContext elContext, Object arg1) {
+ elContext.getELResolver().setValue(elContext, orig.getValue(elContext), i, arg1);
+ }
+
+}
--- src/javax/servlet/jsp/jstl/core/IteratedValueExpression.java (revision 0)
+++ src/javax/servlet/jsp/jstl/core/IteratedValueExpression.java (revision 0)
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jstl.core;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+public final class IteratedValueExpression extends ValueExpression {
+
+ private static final long serialVersionUID = 2771035360633553883L;
+ //IteratedExpression is not serializable
+ protected final IteratedExpression iteratedExpression;
+ protected final int i;
+
+ public IteratedValueExpression(IteratedExpression _iteratedExpression, int _i) {
+ iteratedExpression = _iteratedExpression;
+ i = _i;
+ }
+
+ public boolean equals(Object arg0) {
+ if (arg0==null) {
+ return false;
+ }
+ if (iteratedExpression.getValueExpression().equals(arg0)) {
+ return true;
+ }
+ return false;
+ }
+
+ public Class getExpectedType() {
+ return iteratedExpression.getValueExpression().getExpectedType();
+ }
+
+ public String getExpressionString() {
+ return iteratedExpression.getValueExpression().getExpressionString();
+ }
+
+ public Class getType(ELContext elContext) {
+ return iteratedExpression.getValueExpression().getType(elContext);
+ }
+
+ public Object getValue(ELContext elContext) {
+ return iteratedExpression.getItem(elContext, i);
+ }
+
+ public int hashCode() {
+ return iteratedExpression.hashCode()+i;
+ }
+
+ public boolean isLiteralText() {
+ return false;
+ }
+
+ public boolean isReadOnly(ELContext elContext) {
+ return true;
+ }
+
+ public void setValue(ELContext elContext, Object arg1) {
+ }
+
+}