javadoc
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007 the original author or authors.
|
||||
* Copyright 2004-2008 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.
|
||||
@@ -26,14 +26,15 @@ import org.springframework.util.ClassUtils;
|
||||
import org.springframework.webflow.expression.el.WebFlowELExpressionParser;
|
||||
|
||||
/**
|
||||
* Static factory that returns the default {@link ExpressionParser} for use by Spring Web Flow. Marked final with a
|
||||
* private constructor to prevent subclassing.
|
||||
* Static factory that returns the default {@link ExpressionParser} used by Spring Web Flow. Marked final with a private
|
||||
* constructor to prevent subclassing.
|
||||
* <p>
|
||||
* This factory employs the following algorithm when the returned ExpressionParser instance is used for the first time:
|
||||
* <ul>
|
||||
* <li>If a Unified EL implementation is configured for the VM, make the ELExpressionParser the default.
|
||||
* <li>If no Unified EL implementation is configured and OGNL is configured, make the OgnlExpressionParser the default.
|
||||
* <li>If neither Unified EL or OGNL are configured, throw an IllegalStateException.
|
||||
* <li>If a Unified EL implementation is configured for the VM, make a {@link WebFlowELExpressionParser} the default.
|
||||
* <li>If no Unified EL implementation is configured and OGNL is configured, make a {@link WebFlowOgnlExpressionParser}
|
||||
* the default.
|
||||
* <li>If neither Unified EL or OGNL are configured, throw an IllegalStateException with a nice error message.
|
||||
* </ul>
|
||||
*
|
||||
* @author Keith Donald
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2007 the original author or authors.
|
||||
* Copyright 2004-2008 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.
|
||||
@@ -37,7 +37,7 @@ import org.springframework.webflow.execution.Action;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
|
||||
/**
|
||||
* An extension of {@link OgnlExpressionParser} that registers web flow specific property accessors.
|
||||
* An extension of {@link OgnlExpressionParser} that registers Web Flow-specific PropertyAccessors.
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ public class WebFlowOgnlExpressionParser extends OgnlExpressionParser {
|
||||
private static final Log logger = LogFactory.getLog(WebFlowOgnlExpressionParser.class);
|
||||
|
||||
/**
|
||||
* Creates a webflow-specific ognl expression parser.
|
||||
* Creates a Web Flow OGNL Expression Parser.
|
||||
*/
|
||||
public WebFlowOgnlExpressionParser() {
|
||||
addPropertyAccessor(MapAdaptable.class, new MapAdaptablePropertyAccessor());
|
||||
@@ -55,6 +55,9 @@ public class WebFlowOgnlExpressionParser extends OgnlExpressionParser {
|
||||
addPropertyAccessor(Action.class, new ActionPropertyAccessor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves Map Adaptable properties.
|
||||
*/
|
||||
private static class MapAdaptablePropertyAccessor implements PropertyAccessor {
|
||||
public Object getProperty(Map context, Object target, Object name) throws OgnlException {
|
||||
return ((MapAdaptable) target).asMap().get(name);
|
||||
@@ -66,12 +69,18 @@ public class WebFlowOgnlExpressionParser extends OgnlExpressionParser {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves Mutable Attribute Map properties, also capable of setting properties.
|
||||
*/
|
||||
private static class MutableAttributeMapPropertyAccessor extends MapAdaptablePropertyAccessor {
|
||||
public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
|
||||
((MutableAttributeMap) target).put((String) name, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves RequestContext properties. Supports several implicit variables and scope searching routines.
|
||||
*/
|
||||
private static class RequestContextPropertyAccessor implements PropertyAccessor {
|
||||
|
||||
private static boolean securityPresent = ClassUtils
|
||||
@@ -179,6 +188,9 @@ public class WebFlowOgnlExpressionParser extends OgnlExpressionParser {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves multi action methods.
|
||||
*/
|
||||
private static class ActionPropertyAccessor implements PropertyAccessor {
|
||||
public Object getProperty(Map context, Object target, Object name) throws OgnlException {
|
||||
Action action = (Action) target;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2004-2008 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.webflow.expression.el;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -16,6 +31,8 @@ import org.springframework.webflow.execution.Action;
|
||||
* {@link org.springframework.webflow.action.MultiAction}. Returns an AnnotatedAction wrapper around the target Action
|
||||
* configured with the appropriate method dispatching rules.
|
||||
*
|
||||
* @see org.springframework.webflow.action.EvaluateAction
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
public class ActionMethodELResolver extends ELResolver {
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2004-2008 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.webflow.expression.el;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -14,6 +29,23 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.RequestContextHolder;
|
||||
|
||||
/**
|
||||
* Resolves "implicit" or well-known flow variables; for example "flowScope" in an expression like #{flowScope.foo}. The
|
||||
* list of implicit flow variables consists of:
|
||||
*
|
||||
* <pre>
|
||||
* requestParameters
|
||||
* requestScope
|
||||
* flashScope
|
||||
* flowScope
|
||||
* conversationScope
|
||||
* messageContext
|
||||
* flowExecutionContext
|
||||
* flowExecutionUrl
|
||||
* </pre>
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
public class ImplicitFlowVariableELResolver extends ELResolver {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ImplicitFlowVariableELResolver.class);
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2004-2008 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.webflow.expression.el;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -12,8 +27,10 @@ import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.RequestContextHolder;
|
||||
|
||||
/**
|
||||
* Custom EL resolver that resolves to a thread-bound RequestContext object for binding expressions prefixed with a
|
||||
* {@link #REQUEST_CONTEXT_VARIABLE_NAME}. For instance "#{flowRequestContext.conversationScope.myProperty}".
|
||||
* Custom EL resolver that resolves the current RequestContext under the variable {@link #REQUEST_CONTEXT_VARIABLE_NAME}.
|
||||
* Allows for accessing any propert of the RequestContext instance. For example:
|
||||
* "#{flowRequestContext.conversationScope.myProperty}".
|
||||
*
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
public class RequestContextELResolver extends ELResolver {
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2004-2008 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.webflow.expression.el;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2004-2008 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.webflow.expression.el;
|
||||
|
||||
import javax.el.ELContext;
|
||||
@@ -9,7 +24,7 @@ import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.RequestContextHolder;
|
||||
|
||||
/**
|
||||
* EL resolver for Spring Beans accessible to the flow's local bean factory.
|
||||
* EL resolver for resolving Spring Beans accessible by a flow's bean factory.
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
public class SpringBeanWebFlowELResolver extends SpringBeanELResolver {
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2004-2008 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.webflow.expression.el;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2004-2008 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.webflow.expression.el;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -17,8 +32,7 @@ import org.springframework.webflow.core.collection.MutableAttributeMap;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
|
||||
/**
|
||||
* An ExpressionParser that allows Spring and Web Flow managed beans to be referenced in expressions in the
|
||||
* FlowDefinition.
|
||||
* Allows for Unified EL expressions in a FlowDefinition.
|
||||
*
|
||||
* @author Jeremy Grelle
|
||||
* @author Scott Andrews
|
||||
@@ -28,12 +42,20 @@ public class WebFlowELExpressionParser extends ELExpressionParser {
|
||||
private static boolean securityPresent = ClassUtils
|
||||
.isPresent("org.springframework.security.context.SecurityContextHolder");
|
||||
|
||||
/**
|
||||
* Creates a new Web Flow EL expression parser.
|
||||
* @param expressionFactory the underlying EL expression factory (EL provider specific)
|
||||
*/
|
||||
public WebFlowELExpressionParser(ExpressionFactory expressionFactory) {
|
||||
super(expressionFactory);
|
||||
putContextFactory(RequestContext.class, new RequestContextELContextFactory());
|
||||
putContextFactory(MutableAttributeMap.class, new AttributeMapELContextFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures EL context instances for evaluating against a Web Flow request context.
|
||||
* @author Keith Donald
|
||||
*/
|
||||
private static class RequestContextELContextFactory implements ELContextFactory {
|
||||
public ELContext getELContext(Object target) {
|
||||
RequestContext context = (RequestContext) target;
|
||||
@@ -51,6 +73,10 @@ public class WebFlowELExpressionParser extends ELExpressionParser {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures EL context instances for evaluating against an AttributeMap.
|
||||
* @author Keith Donald
|
||||
*/
|
||||
private static class AttributeMapELContextFactory implements ELContextFactory {
|
||||
public ELContext getELContext(Object target) {
|
||||
ELResolver resolver = new DefaultELResolver(target, null);
|
||||
|
||||
Reference in New Issue
Block a user