formatter registry service integration
This commit is contained in:
@@ -19,9 +19,13 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.binding.expression.el.DefaultExpressionFactoryUtils;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.binding.format.factories.DateFormatterFactory;
|
||||
import org.springframework.binding.format.factories.NumberFormatterFactory;
|
||||
import org.springframework.binding.format.impl.FormatterRegistryImpl;
|
||||
import org.springframework.faces.model.converter.FacesConversionService;
|
||||
import org.springframework.faces.webflow.JsfViewFactoryCreator;
|
||||
import org.springframework.faces.webflow.JsfManagedBeanAwareELExpressionParser;
|
||||
import org.springframework.faces.webflow.JsfViewFactoryCreator;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
|
||||
import org.springframework.webflow.expression.el.WebFlowELExpressionParser;
|
||||
@@ -47,6 +51,10 @@ public class FacesFlowBuilderServicesBeanDefinitionParser extends AbstractSingle
|
||||
|
||||
private static final String CONVERSION_SERVICE_PROPERTY = "conversionService";
|
||||
|
||||
private static final String FORMATTER_REGISTRY_ATTRIBUTE = "formatter-registry";
|
||||
|
||||
private static final String FORMATTER_REGISTRY_PROPERTY = "formatterRegistry";
|
||||
|
||||
protected Class getBeanClass(Element element) {
|
||||
return FlowBuilderServices.class;
|
||||
}
|
||||
@@ -59,8 +67,9 @@ public class FacesFlowBuilderServicesBeanDefinitionParser extends AbstractSingle
|
||||
} else {
|
||||
parseExpressionParser(element, definitionBuilder);
|
||||
}
|
||||
parseViewFactoryCreator(element, definitionBuilder);
|
||||
parseFormatterRegistry(element, definitionBuilder);
|
||||
parseConversionService(element, definitionBuilder);
|
||||
parseViewFactoryCreator(element, definitionBuilder);
|
||||
}
|
||||
|
||||
private boolean parseEnableManagedBeans(Element element, BeanDefinitionBuilder definitionBuilder) {
|
||||
@@ -72,6 +81,15 @@ public class FacesFlowBuilderServicesBeanDefinitionParser extends AbstractSingle
|
||||
}
|
||||
}
|
||||
|
||||
private void parseFormatterRegistry(Element element, BeanDefinitionBuilder definitionBuilder) {
|
||||
String formatterRegistry = element.getAttribute(FORMATTER_REGISTRY_ATTRIBUTE);
|
||||
if (StringUtils.hasText(formatterRegistry)) {
|
||||
definitionBuilder.addPropertyReference(FORMATTER_REGISTRY_PROPERTY, formatterRegistry);
|
||||
} else {
|
||||
definitionBuilder.addPropertyValue(FORMATTER_REGISTRY_PROPERTY, createDefaultFormatterRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
private void parseConversionService(Element element, BeanDefinitionBuilder definitionBuilder) {
|
||||
String conversionService = element.getAttribute(CONVERSION_SERVICE_ATTRIBUTE);
|
||||
if (StringUtils.hasText(conversionService)) {
|
||||
@@ -99,4 +117,12 @@ public class FacesFlowBuilderServicesBeanDefinitionParser extends AbstractSingle
|
||||
DefaultExpressionFactoryUtils.createExpressionFactory()));
|
||||
}
|
||||
}
|
||||
|
||||
private static FormatterRegistry createDefaultFormatterRegistry() {
|
||||
FormatterRegistryImpl registry = new FormatterRegistryImpl();
|
||||
registry.registerFormatter(new NumberFormatterFactory());
|
||||
registry.registerFormatter(new DateFormatterFactory());
|
||||
return registry;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ package org.springframework.faces.webflow;
|
||||
import javax.faces.lifecycle.Lifecycle;
|
||||
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
@@ -33,7 +35,8 @@ public class JsfViewFactoryCreator implements ViewFactoryCreator {
|
||||
|
||||
private Lifecycle lifecycle;
|
||||
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ResourceLoader resourceLoader) {
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
|
||||
FormatterRegistry formatterRegistry, ResourceLoader resourceLoader) {
|
||||
return new JsfViewFactory(viewIdExpression, resourceLoader, getLifecycle());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* 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.config;
|
||||
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.webflow.config.scope.ScopeRegistrar;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* {@link BeanDefinitionParser} for the <code><enable-flow-scopes></code> tag.
|
||||
* @author Ben Hale
|
||||
*/
|
||||
class EnableFlowScopesBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
protected Class getBeanClass(Element element) {
|
||||
return ScopeRegistrar.class;
|
||||
}
|
||||
|
||||
protected boolean shouldGenerateId() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,10 @@ import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.binding.convert.support.DefaultConversionService;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.binding.format.factories.DateFormatterFactory;
|
||||
import org.springframework.binding.format.factories.NumberFormatterFactory;
|
||||
import org.springframework.binding.format.impl.FormatterRegistryImpl;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
|
||||
import org.springframework.webflow.expression.DefaultExpressionParserFactory;
|
||||
@@ -20,12 +24,16 @@ import org.w3c.dom.Element;
|
||||
*/
|
||||
class FlowBuilderServicesBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
private static final String FORMATTER_REGISTRY_ATTRIBUTE = "formatter-registry";
|
||||
|
||||
private static final String CONVERSION_SERVICE_ATTRIBUTE = "conversion-service";
|
||||
|
||||
private static final String EXPRESSION_PARSER_ATTRIBUTE = "expression-parser";
|
||||
|
||||
private static final String VIEW_FACTORY_CREATOR_ATTRIBUTE = "view-factory-creator";
|
||||
|
||||
private static final String FORMATTER_REGISTRY_PROPERTY = "formatterRegistry";
|
||||
|
||||
private static final String CONVERSION_SERVICE_PROPERTY = "conversionService";
|
||||
|
||||
private static final String EXPRESSION_PARSER_PROPERTY = "expressionParser";
|
||||
@@ -37,11 +45,21 @@ class FlowBuilderServicesBeanDefinitionParser extends AbstractSingleBeanDefiniti
|
||||
}
|
||||
|
||||
protected void doParse(Element element, ParserContext context, BeanDefinitionBuilder builder) {
|
||||
parseFormatterRegistry(element, builder, context);
|
||||
parseConversionService(element, builder, context);
|
||||
parseExpressionParser(element, builder, context);
|
||||
parseViewFactoryCreator(element, builder, context);
|
||||
}
|
||||
|
||||
private void parseFormatterRegistry(Element element, BeanDefinitionBuilder definitionBuilder, ParserContext context) {
|
||||
String formatterRegistry = element.getAttribute(FORMATTER_REGISTRY_ATTRIBUTE);
|
||||
if (StringUtils.hasText(formatterRegistry)) {
|
||||
definitionBuilder.addPropertyReference(FORMATTER_REGISTRY_PROPERTY, formatterRegistry);
|
||||
} else {
|
||||
definitionBuilder.addPropertyValue(FORMATTER_REGISTRY_PROPERTY, createDefaultFormatterRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
private void parseConversionService(Element element, BeanDefinitionBuilder definitionBuilder, ParserContext context) {
|
||||
String conversionService = element.getAttribute(CONVERSION_SERVICE_ATTRIBUTE);
|
||||
if (StringUtils.hasText(conversionService)) {
|
||||
@@ -82,6 +100,7 @@ class FlowBuilderServicesBeanDefinitionParser extends AbstractSingleBeanDefiniti
|
||||
public static BeanDefinitionHolder registerDefaultFlowBuilderServicesBeanDefinition(ParserContext context) {
|
||||
FlowBuilderServicesBeanDefinitionParser parser = new FlowBuilderServicesBeanDefinitionParser();
|
||||
BeanDefinitionBuilder defaultBuilder = BeanDefinitionBuilder.genericBeanDefinition(FlowBuilderServices.class);
|
||||
defaultBuilder.addPropertyValue(FORMATTER_REGISTRY_PROPERTY, createDefaultFormatterRegistry());
|
||||
defaultBuilder.addPropertyValue(CONVERSION_SERVICE_PROPERTY, new DefaultConversionService());
|
||||
defaultBuilder.addPropertyValue(EXPRESSION_PARSER_PROPERTY, DefaultExpressionParserFactory
|
||||
.getExpressionParser());
|
||||
@@ -92,4 +111,12 @@ class FlowBuilderServicesBeanDefinitionParser extends AbstractSingleBeanDefiniti
|
||||
parser.registerBeanDefinition(holder, context.getRegistry());
|
||||
return holder;
|
||||
}
|
||||
|
||||
private static FormatterRegistry createDefaultFormatterRegistry() {
|
||||
FormatterRegistryImpl registry = new FormatterRegistryImpl();
|
||||
registry.registerFormatter(new NumberFormatterFactory());
|
||||
registry.registerFormatter(new DateFormatterFactory());
|
||||
return registry;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,5 @@ public class WebFlowConfigNamespaceHandler extends NamespaceHandlerSupport {
|
||||
registerBeanDefinitionParser("flow-execution-listeners", new FlowExecutionListenerLoaderBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("flow-registry", new FlowRegistryBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("flow-builder-services", new FlowBuilderServicesBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("enable-flow-scopes", new EnableFlowScopesBeanDefinitionParser());
|
||||
}
|
||||
}
|
||||
@@ -208,17 +208,6 @@ The default value 'flowRegistry'.
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="enable-flow-scopes">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
Enables the Spring Web Flow bean scopes of 'request', 'flash', 'flow', and 'conversation'.
|
||||
With this tag, Spring bean can be placed in the Web Flow scopes.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="flow-builder-services">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.webflow.engine.builder;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.webflow.action.BeanInvokingActionFactory;
|
||||
import org.springframework.webflow.core.collection.AttributeMap;
|
||||
import org.springframework.webflow.definition.registry.FlowDefinitionLocator;
|
||||
|
||||
@@ -54,10 +54,11 @@ public interface FlowBuilderContext {
|
||||
public FlowArtifactFactory getFlowArtifactFactory();
|
||||
|
||||
/**
|
||||
* Returns the factory for bean invoking actions.
|
||||
* @return the bean invoking action factory
|
||||
* Returns a generic type conversion service for converting between types, typically from string to a rich value
|
||||
* object.
|
||||
* @return the generic conversion service
|
||||
*/
|
||||
public BeanInvokingActionFactory getBeanInvokingActionFactory();
|
||||
public ConversionService getConversionService();
|
||||
|
||||
/**
|
||||
* Returns the view factory creator for configuring a ViewFactory per view state
|
||||
@@ -72,11 +73,10 @@ public interface FlowBuilderContext {
|
||||
public ExpressionParser getExpressionParser();
|
||||
|
||||
/**
|
||||
* Returns a generic type conversion service for converting between types, typically from string to a rich value
|
||||
* object.
|
||||
* @return the generic conversion service
|
||||
* Returns an application-wide registry of formatters for formatting view values.
|
||||
* @return the formatter registry
|
||||
*/
|
||||
public ConversionService getConversionService();
|
||||
public FormatterRegistry getFormatterRegistry();
|
||||
|
||||
/**
|
||||
* Returns a generic resource loader for accessing file-based resources.
|
||||
@@ -89,4 +89,5 @@ public interface FlowBuilderContext {
|
||||
* @return the bean factory
|
||||
*/
|
||||
public BeanFactory getBeanFactory();
|
||||
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
package org.springframework.webflow.engine.builder;
|
||||
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.webflow.execution.View;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
@@ -30,10 +32,12 @@ public interface ViewFactoryCreator {
|
||||
* Create a view factory capable of creating {@link View} objects that can render the view template with the
|
||||
* provided identifier.
|
||||
* @param viewIdExpression an expression that resolves the id of the view template
|
||||
* @param viewResourceLoader an optional resource loader to use to load the view template from an input stream
|
||||
* @param expressionParser an optional expression parser to use to resolve view expressions
|
||||
* @param formatterRegistry an optional formatter registry to use to format text values
|
||||
* @return the view factory
|
||||
*/
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ResourceLoader viewResourceLoader);
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
|
||||
FormatterRegistry formatterRegistry, ResourceLoader resourceLoader);
|
||||
|
||||
/**
|
||||
* Get the default id of the view to render in the provided view state by convention.
|
||||
|
||||
@@ -4,9 +4,9 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.convert.support.GenericConversionService;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.webflow.action.BeanInvokingActionFactory;
|
||||
import org.springframework.webflow.core.collection.AttributeMap;
|
||||
import org.springframework.webflow.definition.registry.FlowDefinitionLocator;
|
||||
import org.springframework.webflow.engine.builder.FlowArtifactFactory;
|
||||
@@ -66,20 +66,20 @@ public class FlowBuilderContextImpl implements FlowBuilderContext {
|
||||
return flowBuilderServices.getFlowArtifactFactory();
|
||||
}
|
||||
|
||||
public BeanInvokingActionFactory getBeanInvokingActionFactory() {
|
||||
return flowBuilderServices.getBeanInvokingActionFactory();
|
||||
public ConversionService getConversionService() {
|
||||
return conversionService;
|
||||
}
|
||||
|
||||
public ViewFactoryCreator getViewFactoryCreator() {
|
||||
return flowBuilderServices.getViewFactoryCreator();
|
||||
}
|
||||
|
||||
public ExpressionParser getExpressionParser() {
|
||||
return flowBuilderServices.getExpressionParser();
|
||||
public FormatterRegistry getFormatterRegistry() {
|
||||
return flowBuilderServices.getFormatterRegistry();
|
||||
}
|
||||
|
||||
public ConversionService getConversionService() {
|
||||
return conversionService;
|
||||
public ExpressionParser getExpressionParser() {
|
||||
return flowBuilderServices.getExpressionParser();
|
||||
}
|
||||
|
||||
public ResourceLoader getResourceLoader() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.context.ResourceLoaderAware;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -15,7 +16,6 @@ import org.springframework.webflow.engine.State;
|
||||
import org.springframework.webflow.engine.builder.FlowArtifactFactory;
|
||||
import org.springframework.webflow.engine.builder.FlowBuilderContext;
|
||||
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
|
||||
import org.springframework.webflow.execution.Action;
|
||||
|
||||
/**
|
||||
* A simple holder for configuring the services used by flow builders. These services are exposed to a builder in a
|
||||
@@ -37,12 +37,6 @@ public class FlowBuilderServices implements ResourceLoaderAware, BeanFactoryAwar
|
||||
*/
|
||||
private FlowArtifactFactory flowArtifactFactory = new FlowArtifactFactory();
|
||||
|
||||
/**
|
||||
* The factory encapsulating the creation of bean invoking actions, actions that adapt methods on objects to the
|
||||
* {@link Action} interface.
|
||||
*/
|
||||
private BeanInvokingActionFactory beanInvokingActionFactory = new BeanInvokingActionFactory();
|
||||
|
||||
/**
|
||||
* The view factory creator for creating views to render during flow execution. The default is <code>null</code>
|
||||
* and this service must be configured externally.
|
||||
@@ -54,6 +48,11 @@ public class FlowBuilderServices implements ResourceLoaderAware, BeanFactoryAwar
|
||||
*/
|
||||
private ConversionService conversionService;
|
||||
|
||||
/**
|
||||
* The service for formatting string values for display in a UI.
|
||||
*/
|
||||
private FormatterRegistry formatterRegistry;
|
||||
|
||||
/**
|
||||
* The parser for parsing expression strings into expression objects. The default is Web Flow's default expression
|
||||
* parser implementation.
|
||||
@@ -78,14 +77,6 @@ public class FlowBuilderServices implements ResourceLoaderAware, BeanFactoryAwar
|
||||
this.flowArtifactFactory = flowArtifactFactory;
|
||||
}
|
||||
|
||||
public BeanInvokingActionFactory getBeanInvokingActionFactory() {
|
||||
return beanInvokingActionFactory;
|
||||
}
|
||||
|
||||
public void setBeanInvokingActionFactory(BeanInvokingActionFactory beanInvokingActionFactory) {
|
||||
this.beanInvokingActionFactory = beanInvokingActionFactory;
|
||||
}
|
||||
|
||||
public ViewFactoryCreator getViewFactoryCreator() {
|
||||
return viewFactoryCreator;
|
||||
}
|
||||
@@ -102,6 +93,14 @@ public class FlowBuilderServices implements ResourceLoaderAware, BeanFactoryAwar
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
public FormatterRegistry getFormatterRegistry() {
|
||||
return formatterRegistry;
|
||||
}
|
||||
|
||||
public void setFormatterRegistry(FormatterRegistry formatterRegistry) {
|
||||
this.formatterRegistry = formatterRegistry;
|
||||
}
|
||||
|
||||
public ExpressionParser getExpressionParser() {
|
||||
return expressionParser;
|
||||
}
|
||||
@@ -130,9 +129,9 @@ public class FlowBuilderServices implements ResourceLoaderAware, BeanFactoryAwar
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(flowArtifactFactory, "The flow artifact factory is required");
|
||||
Assert.notNull(beanInvokingActionFactory, "The bean invoking action factory is required");
|
||||
Assert.notNull(viewFactoryCreator, "The view factory creator is required");
|
||||
Assert.notNull(conversionService, "The type conversion service is required");
|
||||
Assert.notNull(formatterRegistry, "The formatter registry is required");
|
||||
Assert.notNull(expressionParser, "The expression parser is required");
|
||||
Assert.notNull(resourceLoader, "The resource loader is required");
|
||||
Assert.notNull(beanFactory, "The bean factory is required");
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.webflow.engine.builder.xml;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.webflow.action.BeanInvokingActionFactory;
|
||||
import org.springframework.webflow.core.collection.AttributeMap;
|
||||
import org.springframework.webflow.definition.registry.FlowDefinitionLocator;
|
||||
import org.springframework.webflow.engine.builder.FlowArtifactFactory;
|
||||
@@ -67,12 +67,11 @@ class LocalFlowBuilderContext implements FlowBuilderContext {
|
||||
}
|
||||
}
|
||||
|
||||
public BeanInvokingActionFactory getBeanInvokingActionFactory() {
|
||||
if (localFlowContext.containsLocalBean("beanInvokingActionFactory")) {
|
||||
return (BeanInvokingActionFactory) localFlowContext.getBean("beanInvokingActionFactory",
|
||||
BeanInvokingActionFactory.class);
|
||||
public ConversionService getConversionService() {
|
||||
if (localFlowContext.containsLocalBean("conversionService")) {
|
||||
return (ConversionService) localFlowContext.getBean("conversionService", ConversionService.class);
|
||||
} else {
|
||||
return parent.getBeanInvokingActionFactory();
|
||||
return parent.getConversionService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,11 +83,11 @@ class LocalFlowBuilderContext implements FlowBuilderContext {
|
||||
}
|
||||
}
|
||||
|
||||
public ConversionService getConversionService() {
|
||||
if (localFlowContext.containsLocalBean("conversionService")) {
|
||||
return (ConversionService) localFlowContext.getBean("conversionService", ConversionService.class);
|
||||
public FormatterRegistry getFormatterRegistry() {
|
||||
if (localFlowContext.containsLocalBean("formatterRegistry")) {
|
||||
return (FormatterRegistry) localFlowContext.getBean("formatterRegistry", FormatterRegistry.class);
|
||||
} else {
|
||||
return parent.getConversionService();
|
||||
return parent.getFormatterRegistry();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -602,10 +602,9 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
return null;
|
||||
} else {
|
||||
encodedView = getLocalContext().getViewFactoryCreator().getViewIdByConvention(parseId(element));
|
||||
Expression viewName = getExpressionParser().parseExpression(encodedView,
|
||||
Expression viewId = getExpressionParser().parseExpression(encodedView,
|
||||
new ParserContextImpl().template().eval(RequestContext.class).expect(String.class));
|
||||
return getLocalContext().getViewFactoryCreator().createViewFactory(viewName,
|
||||
getLocalContext().getResourceLoader());
|
||||
return createViewFactory(element, viewId);
|
||||
}
|
||||
} else if (encodedView.startsWith("externalRedirect:")) {
|
||||
String encodedUrl = encodedView.substring("externalRedirect:".length());
|
||||
@@ -620,11 +619,15 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
} else {
|
||||
Expression viewId = getExpressionParser().parseExpression(encodedView,
|
||||
new ParserContextImpl().template().eval(RequestContext.class).expect(String.class));
|
||||
return getLocalContext().getViewFactoryCreator().createViewFactory(viewId,
|
||||
getLocalContext().getResourceLoader());
|
||||
return createViewFactory(element, viewId);
|
||||
}
|
||||
}
|
||||
|
||||
private ViewFactory createViewFactory(Element element, Expression viewId) {
|
||||
return getLocalContext().getViewFactoryCreator().createViewFactory(viewId, getExpressionParser(),
|
||||
getLocalContext().getFormatterRegistry(), getLocalContext().getResourceLoader());
|
||||
}
|
||||
|
||||
private Action[] parseRenderActions(Element element) {
|
||||
Element renderActionsElement = DomUtils.getChildElementByTagName(element, "on-render");
|
||||
if (renderActionsElement != null) {
|
||||
|
||||
@@ -69,13 +69,21 @@ public class BindingModel extends ViewRenderingErrors {
|
||||
}
|
||||
|
||||
private Object getFormattedValue(String field) {
|
||||
Expression exp = parseFieldExpression(field);
|
||||
Class valueType = exp.getValueType(boundObject);
|
||||
Formatter formatter = formatterRegistry.getFormatter(valueType);
|
||||
Expression fieldExpression = parseFieldExpression(field);
|
||||
Formatter formatter = getFormatter(fieldExpression);
|
||||
if (formatter != null) {
|
||||
return formatter.formatValue(exp.getValue(boundObject));
|
||||
return formatter.formatValue(fieldExpression.getValue(boundObject));
|
||||
} else {
|
||||
return exp.getValue(boundObject);
|
||||
return fieldExpression.getValue(boundObject);
|
||||
}
|
||||
}
|
||||
|
||||
private Formatter getFormatter(Expression fieldExpression) {
|
||||
if (formatterRegistry != null) {
|
||||
Class valueType = fieldExpression.getValueType(boundObject);
|
||||
return formatterRegistry.getFormatter(valueType);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.springframework.webflow.mvc.view;
|
||||
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.ContextResource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
@@ -25,9 +27,15 @@ class InternalFlowResourceMvcViewFactory implements ViewFactory {
|
||||
|
||||
private ResourceLoader resourceLoader;
|
||||
|
||||
public InternalFlowResourceMvcViewFactory(Expression viewIdExpression, ApplicationContext context,
|
||||
ResourceLoader resourceLoader) {
|
||||
private ExpressionParser expressionParser;
|
||||
|
||||
private FormatterRegistry formatterRegistry;
|
||||
|
||||
public InternalFlowResourceMvcViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
|
||||
FormatterRegistry formatterRegistry, ApplicationContext context, ResourceLoader resourceLoader) {
|
||||
this.viewIdExpression = viewIdExpression;
|
||||
this.expressionParser = expressionParser;
|
||||
this.formatterRegistry = formatterRegistry;
|
||||
this.applicationContext = context;
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
@@ -47,14 +55,22 @@ class InternalFlowResourceMvcViewFactory implements ViewFactory {
|
||||
if (JSTL_PRESENT) {
|
||||
JstlView view = new JstlView(viewPath);
|
||||
view.setApplicationContext(applicationContext);
|
||||
return new MvcView(view, context);
|
||||
return createMvcView(view, context);
|
||||
} else {
|
||||
InternalResourceView view = new InternalResourceView(viewPath);
|
||||
view.setApplicationContext(applicationContext);
|
||||
return new MvcView(view, context);
|
||||
return createMvcView(view, context);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported view type " + viewPath + " only types supported are [.jsp]");
|
||||
}
|
||||
}
|
||||
|
||||
private MvcView createMvcView(org.springframework.web.servlet.View view, RequestContext context) {
|
||||
MvcView mvcView = new MvcView(view, context);
|
||||
mvcView.setExpressionParser(expressionParser);
|
||||
mvcView.setFormatterRegistry(formatterRegistry);
|
||||
return mvcView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,9 +32,6 @@ import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.expression.support.ParserContextImpl;
|
||||
import org.springframework.binding.format.Formatter;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.binding.format.factories.DateFormatterFactory;
|
||||
import org.springframework.binding.format.factories.NumberFormatterFactory;
|
||||
import org.springframework.binding.format.impl.FormatterRegistryImpl;
|
||||
import org.springframework.binding.mapping.MappingResult;
|
||||
import org.springframework.binding.mapping.MappingResults;
|
||||
import org.springframework.binding.mapping.MappingResultsCriteria;
|
||||
@@ -72,7 +69,6 @@ class MvcView implements View {
|
||||
public MvcView(org.springframework.web.servlet.View view, RequestContext context) {
|
||||
this.view = view;
|
||||
this.context = context;
|
||||
this.formatterRegistry = createDefaultFormatterRegistry();
|
||||
}
|
||||
|
||||
public void setExpressionParser(ExpressionParser expressionParser) {
|
||||
@@ -130,13 +126,6 @@ class MvcView implements View {
|
||||
return new Event(this, eventId, context.getRequestParameters().asAttributeMap());
|
||||
}
|
||||
|
||||
protected FormatterRegistry createDefaultFormatterRegistry() {
|
||||
FormatterRegistryImpl registry = new FormatterRegistryImpl();
|
||||
registry.registerFormatter(new NumberFormatterFactory());
|
||||
registry.registerFormatter(new DateFormatterFactory());
|
||||
return registry;
|
||||
}
|
||||
|
||||
private Map flowScopes() {
|
||||
return context.getConversationScope().union(context.getFlowScope()).union(context.getFlashScope()).union(
|
||||
context.getRequestScope()).asMap();
|
||||
@@ -279,7 +268,7 @@ class MvcView implements View {
|
||||
if (targetClass == null) {
|
||||
return formattedValue;
|
||||
}
|
||||
Formatter formatter = formatterRegistry.getFormatter(target.getExpressionString(), targetClass);
|
||||
Formatter formatter = getFormatter(target, targetClass);
|
||||
if (formatter != null) {
|
||||
return formatter.parseValue(formattedValue);
|
||||
} else {
|
||||
@@ -287,6 +276,14 @@ class MvcView implements View {
|
||||
}
|
||||
}
|
||||
|
||||
private Formatter getFormatter(Expression target, Class targetClass) {
|
||||
if (formatterRegistry != null) {
|
||||
return formatterRegistry.getFormatter(target.getExpressionString(), targetClass);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Class getSourceClass() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@@ -40,10 +40,6 @@ import org.springframework.webflow.execution.ViewFactory;
|
||||
*/
|
||||
public class MvcViewFactoryCreator implements ViewFactoryCreator, ApplicationContextAware {
|
||||
|
||||
private ExpressionParser expressionParser;
|
||||
|
||||
private FormatterRegistry formatterRegistry;
|
||||
|
||||
private List viewResolvers;
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
@@ -61,11 +57,13 @@ public class MvcViewFactoryCreator implements ViewFactoryCreator, ApplicationCon
|
||||
this.applicationContext = context;
|
||||
}
|
||||
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ResourceLoader viewResourceLoader) {
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
|
||||
FormatterRegistry formatterRegistry, ResourceLoader resourceLoader) {
|
||||
if (viewResolvers != null) {
|
||||
return new ViewResolvingMvcViewFactory(viewIdExpression, viewResolvers);
|
||||
return new ViewResolvingMvcViewFactory(viewIdExpression, expressionParser, formatterRegistry, viewResolvers);
|
||||
} else {
|
||||
return new InternalFlowResourceMvcViewFactory(viewIdExpression, applicationContext, viewResourceLoader);
|
||||
return new InternalFlowResourceMvcViewFactory(viewIdExpression, expressionParser, formatterRegistry,
|
||||
applicationContext, resourceLoader);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@ package org.springframework.webflow.mvc.view;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
@@ -16,26 +19,35 @@ import org.springframework.webflow.execution.ViewFactory;
|
||||
* @author Keith Donald
|
||||
*/
|
||||
class ViewResolvingMvcViewFactory implements ViewFactory {
|
||||
|
||||
private Expression viewIdExpression;
|
||||
|
||||
private ExpressionParser expressionParser;
|
||||
|
||||
private FormatterRegistry formatterRegistry;
|
||||
|
||||
private List viewResolvers;
|
||||
|
||||
public ViewResolvingMvcViewFactory(Expression viewIdExpression, List viewResolvers) {
|
||||
public ViewResolvingMvcViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
|
||||
FormatterRegistry formatterRegistry, List viewResolvers) {
|
||||
this.viewIdExpression = viewIdExpression;
|
||||
this.viewResolvers = viewResolvers;
|
||||
}
|
||||
|
||||
public View getView(RequestContext context) {
|
||||
String view = (String) viewIdExpression.getValue(context);
|
||||
return new MvcView(resolveView(view), context);
|
||||
String viewName = (String) viewIdExpression.getValue(context);
|
||||
MvcView view = new MvcView(resolveView(viewName), context);
|
||||
view.setExpressionParser(expressionParser);
|
||||
view.setFormatterRegistry(formatterRegistry);
|
||||
return view;
|
||||
}
|
||||
|
||||
protected org.springframework.web.servlet.View resolveView(String viewName) {
|
||||
for (Iterator it = viewResolvers.iterator(); it.hasNext();) {
|
||||
ViewResolver viewResolver = (ViewResolver) it.next();
|
||||
try {
|
||||
org.springframework.web.servlet.View view = viewResolver.resolveViewName(viewName,
|
||||
LocaleContextHolder.getLocale());
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
org.springframework.web.servlet.View view = viewResolver.resolveViewName(viewName, locale);
|
||||
if (view != null) {
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ package org.springframework.webflow.test;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.webflow.action.ViewFactoryActionAdapter;
|
||||
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
|
||||
import org.springframework.webflow.execution.Action;
|
||||
import org.springframework.webflow.execution.Event;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.View;
|
||||
@@ -34,12 +34,10 @@ import org.springframework.webflow.execution.ViewFactory;
|
||||
* @author Keith Donald
|
||||
*/
|
||||
class MockViewFactoryCreator implements ViewFactoryCreator {
|
||||
public Action createRenderViewAction(Expression viewId, ResourceLoader viewResourceLoader) {
|
||||
return new ViewFactoryActionAdapter(createViewFactory(viewId, viewResourceLoader));
|
||||
}
|
||||
|
||||
public ViewFactory createViewFactory(Expression viewId, ResourceLoader viewResourceLoader) {
|
||||
return new MockViewFactory(viewId);
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
|
||||
FormatterRegistry formatterRegistry, ResourceLoader resourceLoader) {
|
||||
return new MockViewFactory(viewIdExpression);
|
||||
}
|
||||
|
||||
public String getViewIdByConvention(String viewStateId) {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package org.springframework.webflow.config;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.webflow.core.collection.AttributeMap;
|
||||
import org.springframework.webflow.execution.FlowExecutionListenerAdapter;
|
||||
import org.springframework.webflow.execution.FlowSession;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.executor.FlowExecutor;
|
||||
import org.springframework.webflow.test.MockExternalContext;
|
||||
|
||||
public class EnableScopesBeanDefinitionParserTests extends TestCase {
|
||||
|
||||
private ClassPathXmlApplicationContext context;
|
||||
|
||||
private FlowExecutor executor;
|
||||
|
||||
public void setUp() {
|
||||
context = new ClassPathXmlApplicationContext("org/springframework/webflow/config/enable-flow-scopes.xml");
|
||||
executor = (FlowExecutor) context.getBean("flowExecutor");
|
||||
}
|
||||
|
||||
public void testExecute() {
|
||||
MockExternalContext context = new MockExternalContext();
|
||||
}
|
||||
|
||||
public static class ConfigurationListener extends FlowExecutionListenerAdapter {
|
||||
public void sessionEnded(RequestContext context, FlowSession session, AttributeMap output) {
|
||||
assertNotNull(session.getScope().get("user"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,11 +7,12 @@ import org.springframework.binding.convert.ConversionExecutor;
|
||||
import org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.convert.support.DefaultConversionService;
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
|
||||
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
|
||||
import org.springframework.webflow.execution.Action;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
import org.springframework.webflow.mvc.view.MvcViewFactoryCreator;
|
||||
|
||||
@@ -42,11 +43,8 @@ public class FlowBuilderServicesBeanDefinitionParserTests extends TestCase {
|
||||
|
||||
public static class TestViewFactoryCreator implements ViewFactoryCreator {
|
||||
|
||||
public Action createRenderViewAction(Expression viewId, ResourceLoader viewResourceLoader) {
|
||||
throw new UnsupportedOperationException("Auto-generated method stub");
|
||||
}
|
||||
|
||||
public ViewFactory createViewFactory(Expression viewId, ResourceLoader viewResourceLoader) {
|
||||
public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser,
|
||||
FormatterRegistry formatterRegistry, ResourceLoader resourceLoader) {
|
||||
throw new UnsupportedOperationException("Auto-generated method stub");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.webflow.execution.Event;
|
||||
import org.springframework.webflow.execution.View;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
import org.springframework.webflow.mvc.view.MvcViewFactoryCreator;
|
||||
import org.springframework.webflow.test.GeneratedFlowExecutionKey;
|
||||
import org.springframework.webflow.test.MockExternalContext;
|
||||
import org.springframework.webflow.test.MockRequestContext;
|
||||
@@ -51,7 +50,7 @@ public class MvcViewFactoryTests extends TestCase {
|
||||
}
|
||||
};
|
||||
Expression viewId = new StaticExpression("myview.jsp");
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, viewResourceLoader);
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, null, null, viewResourceLoader);
|
||||
MockRequestContext context = new MockRequestContext();
|
||||
MockExternalContext externalContext = new MockExternalContext();
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
@@ -71,7 +70,7 @@ public class MvcViewFactoryTests extends TestCase {
|
||||
creator.setApplicationContext(context);
|
||||
creator.setViewResolvers(Collections.singletonList(viewResolver));
|
||||
Expression viewId = new StaticExpression("myview");
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, null);
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, null, null, null);
|
||||
MockRequestContext context = new MockRequestContext();
|
||||
MockExternalContext externalContext = new MockExternalContext();
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
@@ -98,7 +97,7 @@ public class MvcViewFactoryTests extends TestCase {
|
||||
}
|
||||
};
|
||||
Expression viewId = new StaticExpression("myview.jsp");
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, viewResourceLoader);
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, null, null, viewResourceLoader);
|
||||
MockRequestContext context = new MockRequestContext();
|
||||
MockExternalContext externalContext = new MockExternalContext();
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
@@ -130,7 +129,7 @@ public class MvcViewFactoryTests extends TestCase {
|
||||
}
|
||||
};
|
||||
Expression viewId = new StaticExpression("myview.jsp");
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, viewResourceLoader);
|
||||
ViewFactory viewFactory = creator.createViewFactory(viewId, null, null, viewResourceLoader);
|
||||
MockRequestContext context = new MockRequestContext();
|
||||
MockExternalContext externalContext = new MockExternalContext();
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
@@ -11,6 +11,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.binding.expression.support.StaticExpression;
|
||||
import org.springframework.binding.format.factories.DateFormatterFactory;
|
||||
import org.springframework.binding.format.factories.NumberFormatterFactory;
|
||||
import org.springframework.binding.format.impl.FormatterRegistryImpl;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
@@ -25,6 +28,13 @@ public class MvcViewTests extends TestCase {
|
||||
|
||||
private Map model;
|
||||
|
||||
private FormatterRegistryImpl formatterRegistry = new FormatterRegistryImpl();
|
||||
|
||||
public void setUp() {
|
||||
formatterRegistry.registerFormatter(new NumberFormatterFactory());
|
||||
formatterRegistry.registerFormatter(new DateFormatterFactory());
|
||||
}
|
||||
|
||||
public void testRender() throws Exception {
|
||||
MockRequestContext context = new MockRequestContext();
|
||||
context.getRequestScope().put("foo", "bar");
|
||||
@@ -39,6 +49,7 @@ public class MvcViewTests extends TestCase {
|
||||
context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
|
||||
org.springframework.web.servlet.View mvcView = new MockView();
|
||||
MvcView view = new MvcView(mvcView, context);
|
||||
view.setFormatterRegistry(formatterRegistry);
|
||||
view.render();
|
||||
assertTrue(renderCalled);
|
||||
assertEquals("bar", model.get("foo"));
|
||||
@@ -65,6 +76,7 @@ public class MvcViewTests extends TestCase {
|
||||
context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
|
||||
org.springframework.web.servlet.View mvcView = new MockView();
|
||||
MvcView view = new MvcView(mvcView, context);
|
||||
view.setFormatterRegistry(formatterRegistry);
|
||||
view.render();
|
||||
assertEquals(context.getFlowScope().get("bindBean"), model.get("bindBean"));
|
||||
BindingModel bm = (BindingModel) model.get(BindingResult.MODEL_KEY_PREFIX + "bindBean");
|
||||
@@ -96,6 +108,7 @@ public class MvcViewTests extends TestCase {
|
||||
context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
|
||||
org.springframework.web.servlet.View mvcView = new MockView();
|
||||
MvcView view = new MvcView(mvcView, context);
|
||||
view.setFormatterRegistry(formatterRegistry);
|
||||
view.resume();
|
||||
assertTrue(view.eventSignaled());
|
||||
assertEquals("submit", view.getEvent().getId());
|
||||
@@ -118,6 +131,7 @@ public class MvcViewTests extends TestCase {
|
||||
context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
|
||||
org.springframework.web.servlet.View mvcView = new MockView();
|
||||
MvcView view = new MvcView(mvcView, context);
|
||||
view.setFormatterRegistry(formatterRegistry);
|
||||
view.resume();
|
||||
assertTrue(view.eventSignaled());
|
||||
assertEquals("submit", view.getEvent().getId());
|
||||
|
||||
Reference in New Issue
Block a user