removed Apache JSTL references completely
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1990 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
c032a53d71
commit
a59eb986b5
|
|
@ -1,92 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2002-2009 the original author or authors.
|
|
||||||
*
|
|
||||||
* 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 org.springframework.mock.web;
|
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
|
||||||
import javax.servlet.jsp.PageContext;
|
|
||||||
import javax.servlet.jsp.el.ELException;
|
|
||||||
import javax.servlet.jsp.el.Expression;
|
|
||||||
import javax.servlet.jsp.el.ExpressionEvaluator;
|
|
||||||
import javax.servlet.jsp.el.FunctionMapper;
|
|
||||||
import javax.servlet.jsp.el.VariableResolver;
|
|
||||||
|
|
||||||
import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mock implementation of the JSP 2.0 {@link javax.servlet.jsp.el.ExpressionEvaluator}
|
|
||||||
* interface, delegating to the Jakarta JSTL ExpressionEvaluatorManager.
|
|
||||||
*
|
|
||||||
* <p>Used for testing the web framework; only necessary for testing
|
|
||||||
* applications when testing custom JSP tags.
|
|
||||||
*
|
|
||||||
* <p>Note that the Jakarta JSTL implementation (jstl.jar, standard.jar)
|
|
||||||
* has to be available on the class path to use this expression evaluator.
|
|
||||||
*
|
|
||||||
* @author Juergen Hoeller
|
|
||||||
* @since 1.1.5
|
|
||||||
* @see org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager
|
|
||||||
*/
|
|
||||||
public class MockExpressionEvaluator extends ExpressionEvaluator {
|
|
||||||
|
|
||||||
private final PageContext pageContext;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new MockExpressionEvaluator for the given PageContext.
|
|
||||||
* @param pageContext the JSP PageContext to run in
|
|
||||||
*/
|
|
||||||
public MockExpressionEvaluator(PageContext pageContext) {
|
|
||||||
this.pageContext = pageContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Expression parseExpression(
|
|
||||||
final String expression, final Class expectedType, final FunctionMapper functionMapper)
|
|
||||||
throws ELException {
|
|
||||||
|
|
||||||
return new Expression() {
|
|
||||||
public Object evaluate(VariableResolver variableResolver) throws ELException {
|
|
||||||
return doEvaluate(expression, expectedType, functionMapper);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object evaluate(
|
|
||||||
String expression, Class expectedType, VariableResolver variableResolver, FunctionMapper functionMapper)
|
|
||||||
throws ELException {
|
|
||||||
|
|
||||||
if (variableResolver != null) {
|
|
||||||
throw new IllegalArgumentException("Custom VariableResolver not supported");
|
|
||||||
}
|
|
||||||
return doEvaluate(expression, expectedType, functionMapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Object doEvaluate(
|
|
||||||
String expression, Class expectedType, FunctionMapper functionMapper)
|
|
||||||
throws ELException {
|
|
||||||
|
|
||||||
if (functionMapper != null) {
|
|
||||||
throw new IllegalArgumentException("Custom FunctionMapper not supported");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return ExpressionEvaluatorManager.evaluate("JSP EL expression", expression, expectedType, this.pageContext);
|
|
||||||
}
|
|
||||||
catch (JspException ex) {
|
|
||||||
throw new ELException("Parsing of JSP EL expression \"" + expression + "\" failed", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -275,7 +275,7 @@ public class MockPageContext extends PageContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpressionEvaluator getExpressionEvaluator() {
|
public ExpressionEvaluator getExpressionEvaluator() {
|
||||||
return new MockExpressionEvaluator(this);
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ELContext getELContext() {
|
public ELContext getELContext() {
|
||||||
|
|
|
||||||
|
|
@ -164,17 +164,6 @@
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</orderEntry>
|
</orderEntry>
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library>
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$IVY_CACHE$/org.apache.taglibs/com.springsource.org.apache.taglibs.standard/1.1.2/com.springsource.org.apache.taglibs.standard-1.1.2.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$IVY_CACHE$/org.apache.taglibs/com.springsource.org.apache.taglibs.standard/1.1.2/com.springsource.org.apache.taglibs.standard-sources-1.1.2.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="module-library">
|
<orderEntry type="module-library">
|
||||||
<library>
|
<library>
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
|
|
@ -318,6 +307,17 @@
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</orderEntry>
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$IVY_CACHE$/org.jaxen/com.springsource.org.jaxen/1.1.1/com.springsource.org.jaxen-1.1.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$IVY_CACHE$/org.jaxen/com.springsource.org.jaxen/1.1.1/com.springsource.org.jaxen-sources-1.1.1.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
<orderEntry type="module-library">
|
<orderEntry type="module-library">
|
||||||
<library>
|
<library>
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue