Author: apetrelli
Date: Wed May 7 12:17:15 2008
New Revision: 654222
URL: http://svn.apache.org/viewvc?rev=654222&view=rev
Log:
TILES-268
Now it works "only" with Tomcat 6. We should provide a profile to make it work
with Tomcat 5.
TILES-269
Removed JUEL dependency and using Tomcat/Jasper EL.
Using a factory of ExpressionFactory.
TILES-270
Updated to Servlet 2.5 and JSP 2.1.
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ExpressionFactoryFactory.java
(with props)
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/JspExpressionFactoryFactory.java
(with props)
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
(with props)
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/FunctionMapperImpl.java
(with props)
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/VariableMapperImpl.java
(with props)
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
(with props)
Modified:
tiles/framework/trunk/tiles-api/pom.xml
tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/TilesApplicationContext.java
tiles/framework/trunk/tiles-core/pom.xml
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/enhanced/EnhancedTilesApplicationContext.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContext.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContext.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/web/util/ServletContextAdapter.java
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
tiles/framework/trunk/tiles-jsp/pom.xml
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java
tiles/framework/trunk/tiles-test/pom.xml
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java
tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
Modified: tiles/framework/trunk/tiles-api/pom.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-api/pom.xml?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-api/pom.xml (original)
+++ tiles/framework/trunk/tiles-api/pom.xml Wed May 7 12:17:15 2008
@@ -100,7 +100,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
<scope>test</scope>
</dependency>
Modified:
tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/TilesApplicationContext.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/TilesApplicationContext.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/TilesApplicationContext.java
(original)
+++
tiles/framework/trunk/tiles-api/src/main/java/org/apache/tiles/TilesApplicationContext.java
Wed May 7 12:17:15 2008
@@ -36,6 +36,14 @@
public interface TilesApplicationContext {
/**
+ * Returns the original, technology-dependent, context.
+ *
+ * @return The original application context.
+ * @since 2.1.0
+ */
+ Object getContext();
+
+ /**
* Returns a mutable Map that maps application scope attribute names to
* their values.
*
Modified: tiles/framework/trunk/tiles-core/pom.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/pom.xml?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/pom.xml (original)
+++ tiles/framework/trunk/tiles-core/pom.xml Wed May 7 12:17:15 2008
@@ -147,7 +147,14 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
<scope>provided</scope>
</dependency>
@@ -159,10 +166,24 @@
</dependency>
<dependency>
- <groupId>de.odysseus.juel</groupId>
- <artifactId>juel</artifactId>
- <version>2.1.0</version>
- <scope>provided</scope>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper-el</artifactId>
+ <version>6.0.16</version>
+ <scope>compile</scope>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -193,6 +214,11 @@
<id>dtddoc</id>
<url>http://dtddoc.sf.net/maven2</url>
</repository>
+ <repository>
+ <id>java_net</id>
+ <url>http://download.java.net/maven/1/</url>
+ <layout>legacy</layout>
+ </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/enhanced/EnhancedTilesApplicationContext.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/enhanced/EnhancedTilesApplicationContext.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/enhanced/EnhancedTilesApplicationContext.java
(original)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/enhanced/EnhancedTilesApplicationContext.java
Wed May 7 12:17:15 2008
@@ -71,6 +71,10 @@
this.rootContext = rootContext;
}
+ /** [EMAIL PROTECTED] */
+ public Object getContext() {
+ return rootContext.getContext();
+ }
/**
* Returns the root context.
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
(original)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
Wed May 7 12:17:15 2008
@@ -36,9 +36,8 @@
import org.apache.tiles.awareness.TilesApplicationContextAware;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.evaluator.AttributeEvaluator;
-
-import de.odysseus.el.ExpressionFactoryImpl;
-import de.odysseus.el.util.SimpleContext;
+import org.apache.tiles.evaluator.el.tomcat.jasper.el.lang.ELContextImpl;
+import org.apache.tiles.util.ClassUtil;
/**
* Evaluates string expression with typical EL syntax.<br>
@@ -53,6 +52,15 @@
TilesApplicationContextAware {
/**
+ * Initialization parameter to decide the implementation of
+ * [EMAIL PROTECTED] ExpressionFactoryFactory}.
+ *
+ * @since 2.1.0
+ */
+ public static final String EXPRESSION_FACTORY_FACTORY_INIT_PARAM =
+ "org.apache.tiles.evaluator.el.ExpressionFactoryFactory";
+
+ /**
* The Tiles application context.
*
* @since 2.1.0
@@ -83,8 +91,20 @@
/** [EMAIL PROTECTED] */
public void init(Map<String, String> initParameters) {
- // FIXME Take a different strategy to hold the expression factory.
- expressionFactory = new ExpressionFactoryImpl();
+ String expressionFactoryClassName = initParameters
+ .get(EXPRESSION_FACTORY_FACTORY_INIT_PARAM);
+ ExpressionFactoryFactory efFactory;
+ if (expressionFactoryClassName != null) {
+ efFactory = (ExpressionFactoryFactory) ClassUtil
+ .instantiate(expressionFactoryClassName);
+ } else {
+ efFactory = new JspExpressionFactoryFactory();
+ }
+ if (efFactory instanceof TilesApplicationContextAware) {
+ ((TilesApplicationContextAware) efFactory)
+ .setApplicationContext(applicationContext);
+ }
+ expressionFactory = efFactory.getExpressionFactory();
resolver = new CompositeELResolver() {
{
add(new TilesContextELResolver());
@@ -124,7 +144,7 @@
/** [EMAIL PROTECTED] */
public Object evaluate(String expression, TilesRequestContext request) {
- SimpleContext context = new SimpleContext(resolver);
+ ELContextImpl context = new ELContextImpl(resolver);
context.putContext(TilesRequestContext.class, request);
context.putContext(TilesApplicationContext.class,
applicationContext);
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ExpressionFactoryFactory.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ExpressionFactoryFactory.java?rev=654222&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ExpressionFactoryFactory.java
(added)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ExpressionFactoryFactory.java
Wed May 7 12:17:15 2008
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * 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 org.apache.tiles.evaluator.el;
+
+import javax.el.ExpressionFactory;
+
+/**
+ * Interface to define a factory of [EMAIL PROTECTED] ExpressionFactory}.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.0
+ */
+public interface ExpressionFactoryFactory {
+
+ /**
+ * Returns the expression factory to use.
+ *
+ * @return The expression factory.
+ * @since 2.1.0
+ */
+ ExpressionFactory getExpressionFactory();
+}
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ExpressionFactoryFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ExpressionFactoryFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/JspExpressionFactoryFactory.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/JspExpressionFactoryFactory.java?rev=654222&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/JspExpressionFactoryFactory.java
(added)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/JspExpressionFactoryFactory.java
Wed May 7 12:17:15 2008
@@ -0,0 +1,64 @@
+/*
+ * $Id$
+ *
+ * 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 org.apache.tiles.evaluator.el;
+
+import javax.el.ExpressionFactory;
+import javax.servlet.ServletContext;
+import javax.servlet.jsp.JspFactory;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.awareness.TilesApplicationContextAware;
+
+/**
+ * Uses the JSP 2.1 [EMAIL PROTECTED] ExpressionFactory} to be used in Tiles.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.0
+ */
+public class JspExpressionFactoryFactory implements ExpressionFactoryFactory,
+ TilesApplicationContextAware {
+
+ /**
+ * The servlet context.
+ *
+ * @since 2.1.0
+ */
+ protected ServletContext servletContext;
+
+ /** [EMAIL PROTECTED] */
+ public void setApplicationContext(TilesApplicationContext
applicationContext) {
+ Object context = applicationContext.getContext();
+ if (context instanceof ServletContext) {
+ this.servletContext = (ServletContext) context;
+ } else {
+ throw new IllegalArgumentException(
+ "The application context does not hold an instance of "
+ + "ServletContext, consider using
JuelExpressionFactoryFactory");
+ }
+ }
+
+ /** [EMAIL PROTECTED] */
+ public ExpressionFactory getExpressionFactory() {
+ return JspFactory.getDefaultFactory().getJspApplicationContext(
+ servletContext).getExpressionFactory();
+ }
+}
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/JspExpressionFactoryFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/JspExpressionFactoryFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java?rev=654222&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
(added)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
Wed May 7 12:17:15 2008
@@ -0,0 +1,12 @@
+package org.apache.tiles.evaluator.el;
+
+import javax.el.ExpressionFactory;
+
+import org.apache.el.ExpressionFactoryImpl;
+
+public class TomcatExpressionFactoryFactory implements
ExpressionFactoryFactory {
+
+ public ExpressionFactory getExpressionFactory() {
+ return new ExpressionFactoryImpl();
+ }
+}
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/FunctionMapperImpl.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/FunctionMapperImpl.java?rev=654222&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/FunctionMapperImpl.java
(added)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/FunctionMapperImpl.java
Wed May 7 12:17:15 2008
@@ -0,0 +1,192 @@
+/*
+ * 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 org.apache.tiles.evaluator.el.tomcat.el.lang;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.el.FunctionMapper;
+
+import org.apache.el.util.ReflectionUtil;
+
+
+/**
+ * @author Jacob Hookom [EMAIL PROTECTED]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
+ */
+public class FunctionMapperImpl extends FunctionMapper implements
+ Externalizable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Map functions = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.el.FunctionMapper#resolveFunction(java.lang.String,
+ * java.lang.String)
+ */
+ public Method resolveFunction(String prefix, String localName) {
+ if (this.functions != null) {
+ Function f = (Function) this.functions.get(prefix + ":" +
localName);
+ return f.getMethod();
+ }
+ return null;
+ }
+
+ public void addFunction(String prefix, String localName, Method m) {
+ if (this.functions == null) {
+ this.functions = new HashMap();
+ }
+ Function f = new Function(prefix, localName, m);
+ synchronized (this) {
+ this.functions.put(prefix+":"+localName, f);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(this.functions);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.functions = (Map) in.readObject();
+ }
+
+ public static class Function implements Externalizable {
+
+ protected transient Method m;
+ protected String owner;
+ protected String name;
+ protected String[] types;
+ protected String prefix;
+ protected String localName;
+
+ /**
+ *
+ */
+ public Function(String prefix, String localName, Method m) {
+ if (localName == null) {
+ throw new NullPointerException("LocalName cannot be null");
+ }
+ if (m == null) {
+ throw new NullPointerException("Method cannot be null");
+ }
+ this.prefix = prefix;
+ this.localName = localName;
+ this.m = m;
+ }
+
+ public Function() {
+ // for serialization
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeUTF((this.prefix != null) ? this.prefix : "");
+ out.writeUTF(this.localName);
+ // make sure m isn't null
+ getMethod();
+ out.writeUTF((this.owner != null) ?
+ this.owner :
+ this.m.getDeclaringClass().getName());
+ out.writeUTF((this.name != null) ?
+ this.name :
+ this.m.getName());
+ out.writeObject((this.types != null) ?
+ this.types :
+
ReflectionUtil.toTypeNameArray(this.m.getParameterTypes()));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+
+ this.prefix = in.readUTF();
+ if ("".equals(this.prefix)) this.prefix = null;
+ this.localName = in.readUTF();
+ this.owner = in.readUTF();
+ this.name = in.readUTF();
+ this.types = (String[]) in.readObject();
+ }
+
+ public Method getMethod() {
+ if (this.m == null) {
+ try {
+ Class t = ReflectionUtil.forName(this.owner);
+ Class[] p = ReflectionUtil.toTypeArray(this.types);
+ this.m = t.getMethod(this.name, p);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return this.m;
+ }
+
+ public boolean matches(String prefix, String localName) {
+ if (this.prefix != null) {
+ if (prefix == null) return false;
+ if (!this.prefix.equals(prefix)) return false;
+ }
+ return this.localName.equals(localName);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Function) {
+ return this.hashCode() == obj.hashCode();
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return (this.prefix + this.localName).hashCode();
+ }
+ }
+
+}
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/FunctionMapperImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/FunctionMapperImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/VariableMapperImpl.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/VariableMapperImpl.java?rev=654222&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/VariableMapperImpl.java
(added)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/VariableMapperImpl.java
Wed May 7 12:17:15 2008
@@ -0,0 +1,56 @@
+/*
+ * 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 org.apache.tiles.evaluator.el.tomcat.el.lang;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+public class VariableMapperImpl extends VariableMapper implements
Externalizable {
+
+ private static final long serialVersionUID = 1L;
+
+ private Map vars = new HashMap();
+
+ public VariableMapperImpl() {
+ super();
+ }
+
+ public ValueExpression resolveVariable(String variable) {
+ return (ValueExpression) this.vars.get(variable);
+ }
+
+ public ValueExpression setVariable(String variable,
+ ValueExpression expression) {
+ return (ValueExpression) this.vars.put(variable, expression);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
+ this.vars = (Map) in.readObject();
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(this.vars);
+ }
+}
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/VariableMapperImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/lang/VariableMapperImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java?rev=654222&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
(added)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
Wed May 7 12:17:15 2008
@@ -0,0 +1,95 @@
+/*
+ * 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 org.apache.tiles.evaluator.el.tomcat.jasper.el.lang;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.FunctionMapper;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+/**
+ * Implementation of ELContext
+ *
+ * @author Jacob Hookom
+ */
+public final class ELContextImpl extends ELContext {
+
+ private final static FunctionMapper NullFunctionMapper = new
FunctionMapper() {
+ public Method resolveFunction(String prefix, String localName) {
+ return null;
+ }
+ };
+
+ private final static class VariableMapperImpl extends VariableMapper {
+
+ private Map<String, ValueExpression> vars;
+
+ public ValueExpression resolveVariable(String variable) {
+ if (vars == null) {
+ return null;
+ }
+ return vars.get(variable);
+ }
+
+ public ValueExpression setVariable(String variable,
+ ValueExpression expression) {
+ if (vars == null)
+ vars = new HashMap<String, ValueExpression>();
+ return vars.put(variable, expression);
+ }
+
+ }
+
+ private final ELResolver resolver;
+
+ private FunctionMapper functionMapper = NullFunctionMapper; // immutable
+
+ private VariableMapper variableMapper;
+
+ public ELContextImpl(ELResolver resolver) {
+ this.resolver = resolver;
+ }
+
+ public ELResolver getELResolver() {
+ return this.resolver;
+ }
+
+ public FunctionMapper getFunctionMapper() {
+ return this.functionMapper;
+ }
+
+ public VariableMapper getVariableMapper() {
+ if (this.variableMapper == null) {
+ this.variableMapper = new VariableMapperImpl();
+ }
+ return this.variableMapper;
+ }
+
+ public void setFunctionMapper(FunctionMapper functionMapper) {
+ this.functionMapper = functionMapper;
+ }
+
+ public void setVariableMapper(VariableMapper variableMapper) {
+ this.variableMapper = variableMapper;
+ }
+
+}
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContext.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContext.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContext.java
(original)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContext.java
Wed May 7 12:17:15 2008
@@ -68,6 +68,10 @@
initialize(context);
}
+ /** [EMAIL PROTECTED] */
+ public Object getContext() {
+ return context;
+ }
/**
* <p>Initialize (or reinitialize) this [EMAIL PROTECTED]
PortletTilesApplicationContext} instance
@@ -158,6 +162,4 @@
+ context.getClass().getName());
}
}
-
-
}
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContext.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContext.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContext.java
(original)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContext.java
Wed May 7 12:17:15 2008
@@ -68,6 +68,10 @@
initialize(servletContext);
}
+ /** [EMAIL PROTECTED] */
+ public Object getContext() {
+ return servletContext;
+ }
/** [EMAIL PROTECTED] */
public Map<String, Object> getApplicationScope() {
@@ -106,6 +110,7 @@
* Returns the servlet context.
*
* @return The servlet context.
+ * @deprecated Use [EMAIL PROTECTED] #getContext()}.
*/
public ServletContext getServletContext() {
return servletContext;
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java
(original)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java
Wed May 7 12:17:15 2008
@@ -54,7 +54,8 @@
public TilesRequestContext createRequestContext(TilesApplicationContext
context,
Object... requestItems) {
if (requestItems.length == 2) {
- ServletContext servletContext = getServletContext(context);
+ ServletContext servletContext = (ServletContext) context
+ .getContext();
if (servletContext != null) {
return new ServletTilesRequestContext(servletContext,
(HttpServletRequest) requestItems[0],
@@ -70,6 +71,7 @@
*
* @param context The application context.
* @return The original servlet context, if found.
+ * @deprecated Use [EMAIL PROTECTED] TilesApplicationContext#getContext()}.
*/
protected ServletContext getServletContext(TilesApplicationContext
context) {
if (context instanceof ServletTilesApplicationContext) {
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/web/util/ServletContextAdapter.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/web/util/ServletContextAdapter.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/web/util/ServletContextAdapter.java
(original)
+++
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/web/util/ServletContextAdapter.java
Wed May 7 12:17:15 2008
@@ -204,6 +204,11 @@
return rootContext.getServletContextName();
}
+ /** [EMAIL PROTECTED] */
+ public String getContextPath() {
+ return rootContext.getContextPath();
+ }
+
/**
* Composes an enumeration into a single one.
*/
Modified:
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java
(original)
+++
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java
Wed May 7 12:17:15 2008
@@ -69,7 +69,10 @@
EasyMock.replay(request, applicationContext);
evaluator.setApplicationContext(applicationContext);
- evaluator.init(null);
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(ELAttributeEvaluator.EXPRESSION_FACTORY_FACTORY_INIT_PARAM,
+ TomcatExpressionFactoryFactory.class.getName());
+ evaluator.init(params);
}
/**
Modified:
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
(original)
+++
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
Wed May 7 12:17:15 2008
@@ -31,10 +31,9 @@
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.evaluator.el.tomcat.jasper.el.lang.ELContextImpl;
import org.easymock.EasyMock;
-import de.odysseus.el.util.SimpleContext;
-
import junit.framework.TestCase;
/**
@@ -89,7 +88,7 @@
applicationScope).anyTimes();
EasyMock.replay(request, applicationContext);
- ELContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
context.putContext(TilesRequestContext.class, request);
context.putContext(TilesApplicationContext.class, applicationContext);
@@ -148,7 +147,7 @@
applicationScope).anyTimes();
EasyMock.replay(request, applicationContext);
- ELContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
context.putContext(TilesRequestContext.class, request);
context.putContext(TilesApplicationContext.class, applicationContext);
@@ -183,7 +182,7 @@
applicationScope).anyTimes();
EasyMock.replay(request, applicationContext);
- ELContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
context.putContext(TilesRequestContext.class, request);
context.putContext(TilesApplicationContext.class, applicationContext);
@@ -200,7 +199,7 @@
* [EMAIL PROTECTED]
TilesContextBeanELResolver#isReadOnly(javax.el.ELContext, java.lang.Object,
java.lang.Object)}.
*/
public void testIsReadOnlyELContextObjectObject() {
- SimpleContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
assertTrue("The value is not read only", resolver.isReadOnly(context,
null, null));
}
@@ -228,7 +227,7 @@
applicationScope).anyTimes();
EasyMock.replay(request, applicationContext);
- ELContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
context.putContext(TilesRequestContext.class, request);
context.putContext(TilesApplicationContext.class, applicationContext);
Modified:
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
(original)
+++
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
Wed May 7 12:17:15 2008
@@ -29,14 +29,15 @@
import java.util.Map;
import java.util.Set;
+import javax.el.ELContext;
+
import junit.framework.TestCase;
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.evaluator.el.tomcat.jasper.el.lang.ELContextImpl;
import org.easymock.EasyMock;
-import de.odysseus.el.util.SimpleContext;
-
/**
* Tests [EMAIL PROTECTED] TilesContextELResolver}.
*
@@ -97,7 +98,7 @@
.createMock(TilesRequestContext.class);
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- SimpleContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
EasyMock.replay(request, applicationContext);
context.putContext(TilesRequestContext.class, request);
context.putContext(TilesApplicationContext.class, applicationContext);
@@ -128,7 +129,7 @@
.createMock(TilesApplicationContext.class);
EasyMock.expect(applicationContext.getApplicationScope()).andReturn(
applicationScope);
- SimpleContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
EasyMock.replay(request, applicationContext);
context.putContext(TilesRequestContext.class, request);
context.putContext(TilesApplicationContext.class, applicationContext);
@@ -146,7 +147,7 @@
* [EMAIL PROTECTED] TilesContextELResolver#isReadOnly(javax.el.ELContext,
java.lang.Object, java.lang.Object)}.
*/
public void testIsReadOnly() {
- SimpleContext context = new SimpleContext(resolver);
+ ELContext context = new ELContextImpl(resolver);
assertTrue("The value is not read only", resolver.isReadOnly(context,
null, null));
}
Modified: tiles/framework/trunk/tiles-jsp/pom.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/pom.xml?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-jsp/pom.xml (original)
+++ tiles/framework/trunk/tiles-jsp/pom.xml Wed May 7 12:17:15 2008
@@ -144,14 +144,14 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
<scope>provided</scope>
</dependency>
Modified:
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java
(original)
+++
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java
Wed May 7 12:17:15 2008
@@ -332,6 +332,11 @@
return rootContext.getServletContextName();
}
+ /** [EMAIL PROTECTED] */
+ public String getContextPath() {
+ return rootContext.getContextPath();
+ }
+
/**
* Composes an enumeration and an iterator into a single enumeration.
*/
Modified: tiles/framework/trunk/tiles-test/pom.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/pom.xml?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/pom.xml (original)
+++ tiles/framework/trunk/tiles-test/pom.xml Wed May 7 12:17:15 2008
@@ -50,25 +50,19 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
- <version>1.1.2</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>taglibs</groupId>
- <artifactId>standard</artifactId>
- <version>1.1.2</version>
+ <version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -77,9 +71,16 @@
<version>2.3.10</version>
</dependency>
<dependency>
- <groupId>de.odysseus.juel</groupId>
- <artifactId>juel</artifactId>
- <version>2.1.0</version>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper-el</artifactId>
+ <version>6.0.16</version>
+ <scope>optional</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
@@ -105,9 +106,10 @@
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
<configuration>
<container>
- <containerId>tomcat5x</containerId>
+ <containerId>tomcat6x</containerId>
<home>${cargo.tomcat5x.home}</home>
<log>${project.build.directory}/tomcat5x.log</log>
<output>${project.build.directory}/tomcat5x.out</output>
@@ -286,6 +288,18 @@
</profile>
</profiles>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>codehaus.snapshots</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
</project>
\ No newline at end of file
Modified:
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java
(original)
+++
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java
Wed May 7 12:17:15 2008
@@ -25,6 +25,13 @@
import java.util.ArrayList;
import java.util.List;
+import javax.el.ArrayELResolver;
+import javax.el.CompositeELResolver;
+import javax.el.ELResolver;
+import javax.el.ListELResolver;
+import javax.el.MapELResolver;
+import javax.el.ResourceBundleELResolver;
+
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
import
org.apache.tiles.compat.definition.digester.CompatibilityDigesterDefinitionsReader;
@@ -34,6 +41,9 @@
import org.apache.tiles.definition.DefinitionsReader;
import org.apache.tiles.evaluator.AttributeEvaluator;
import org.apache.tiles.evaluator.el.ELAttributeEvaluator;
+import org.apache.tiles.evaluator.el.JspExpressionFactoryFactory;
+import org.apache.tiles.evaluator.el.TilesContextBeanELResolver;
+import org.apache.tiles.evaluator.el.TilesContextELResolver;
import org.apache.tiles.factory.BasicTilesContainerFactory;
import org.apache.tiles.impl.BasicTilesContainer;
import org.apache.tiles.impl.mgmt.CachingTilesContainer;
@@ -41,8 +51,6 @@
import org.apache.tiles.renderer.impl.BasicRendererFactory;
import org.apache.tiles.test.renderer.ReverseStringAttributeRenderer;
-import de.odysseus.el.ExpressionFactoryImpl;
-
/**
* Test Tiles container factory to customize Tiles behaviour.
*
@@ -92,8 +100,21 @@
TilesContextFactory contextFactory, LocaleResolver resolver) {
ELAttributeEvaluator evaluator = new ELAttributeEvaluator();
evaluator.setApplicationContext(applicationContext);
- evaluator.setExpressionFactory(new ExpressionFactoryImpl());
- evaluator.init(null);
+ JspExpressionFactoryFactory efFactory = new
JspExpressionFactoryFactory();
+ efFactory.setApplicationContext(applicationContext);
+ evaluator.setExpressionFactory(efFactory.getExpressionFactory());
+ ELResolver elResolver = new CompositeELResolver() {
+ {
+ add(new TilesContextELResolver());
+ add(new TilesContextBeanELResolver());
+ add(new ArrayELResolver(false));
+ add(new ListELResolver(false));
+ add(new MapELResolver(false));
+ add(new ResourceBundleELResolver());
+ }
+ };
+ evaluator.setResolver(elResolver);
+
return evaluator;
}
Modified: tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml?rev=654222&r1=654221&r2=654222&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml Wed May 7
12:17:15 2008
@@ -24,8 +24,8 @@
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
+ version="2.5">
<display-name>Tiles 2 Test Application</display-name>
<distributable/>