Remove remaining Portlet references
Issue: SWF-1692
This commit is contained in:
@@ -61,7 +61,7 @@ public class AbstractFlowConfiguration implements ApplicationContextAware {
|
||||
* @return the created builder
|
||||
*/
|
||||
protected FlowExecutorBuilder getFlowExecutorBuilder(FlowDefinitionLocator flowRegistry) {
|
||||
return new FlowExecutorBuilder(flowRegistry, this.applicationContext);
|
||||
return new FlowExecutorBuilder(flowRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ public class AbstractFlowConfiguration implements ApplicationContextAware {
|
||||
* @return the created builder
|
||||
*/
|
||||
protected FlowBuilderServicesBuilder getFlowBuilderServicesBuilder() {
|
||||
return new FlowBuilderServicesBuilder(this.applicationContext);
|
||||
return new FlowBuilderServicesBuilder();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,21 +52,17 @@ public class FlowBuilderServicesBuilder {
|
||||
private boolean enableDevelopmentMode;
|
||||
|
||||
|
||||
public FlowBuilderServicesBuilder() {
|
||||
this.viewFactoryCreator = new MvcViewFactoryCreator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance with the given ApplicationContext.
|
||||
*
|
||||
* @param applicationContext the ApplicationContext to use to initialize a
|
||||
* default ViewFactoryCreator instance with.
|
||||
* @deprecated as of 2.5 an ApplicationContext is no longer required
|
||||
*/
|
||||
public FlowBuilderServicesBuilder(ApplicationContext applicationContext) {
|
||||
Assert.notNull(applicationContext, "applicationContext is required");
|
||||
this.viewFactoryCreator = initViewFactoryCreator(applicationContext);
|
||||
}
|
||||
|
||||
private static ViewFactoryCreator initViewFactoryCreator(ApplicationContext applicationContext) {
|
||||
MvcViewFactoryCreator viewFactoryCreator = new MvcViewFactoryCreator();
|
||||
viewFactoryCreator.setApplicationContext(applicationContext);
|
||||
return viewFactoryCreator;
|
||||
this.viewFactoryCreator = new MvcViewFactoryCreator();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.webflow.config;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -67,7 +66,7 @@ public class FlowDefinitionRegistryBuilder {
|
||||
/**
|
||||
* Create a new instance with the given ApplicationContext.
|
||||
*
|
||||
* @param applicationContext the ApplicationContext to use for initializing the
|
||||
* @param appContext the ApplicationContext to use for initializing the
|
||||
* FlowDefinitionResourceFactory and FlowBuilderServices instances with
|
||||
*/
|
||||
public FlowDefinitionRegistryBuilder(ApplicationContext appContext) {
|
||||
@@ -77,7 +76,7 @@ public class FlowDefinitionRegistryBuilder {
|
||||
/**
|
||||
* Create a new instance with the given ApplicationContext and {@link FlowBuilderServices}.
|
||||
*
|
||||
* @param applicationContext the ApplicationContext to use for initializing the
|
||||
* @param appContext the ApplicationContext to use for initializing the
|
||||
* FlowDefinitionResourceFactory and FlowBuilderServices instances with
|
||||
* @param builderServices a {@link FlowBuilderServices} instance to configure
|
||||
* on the FlowDefinitionRegistry
|
||||
@@ -89,7 +88,7 @@ public class FlowDefinitionRegistryBuilder {
|
||||
this.flowBuilderServices = builderServices;
|
||||
}
|
||||
else {
|
||||
this.flowBuilderServices = new FlowBuilderServicesBuilder(appContext).build();
|
||||
this.flowBuilderServices = new FlowBuilderServicesBuilder().build();
|
||||
this.flowBuilderServices.setApplicationContext(appContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.webflow.execution.repository.snapshot.SerializedFlowE
|
||||
import org.springframework.webflow.execution.repository.snapshot.SimpleFlowExecutionSnapshotFactory;
|
||||
import org.springframework.webflow.executor.FlowExecutor;
|
||||
import org.springframework.webflow.executor.FlowExecutorImpl;
|
||||
import org.springframework.webflow.mvc.builder.MvcEnvironment;
|
||||
|
||||
/**
|
||||
* A builder for {@link FlowExecutor} instances designed for programmatic use in
|
||||
@@ -50,8 +49,6 @@ public class FlowExecutorBuilder {
|
||||
|
||||
private Integer maxFlowExecutionSnapshots;
|
||||
|
||||
private MvcEnvironment environment;
|
||||
|
||||
private LocalAttributeMap<Object> executionAttributes = new LocalAttributeMap<Object>();
|
||||
|
||||
private ConditionalFlowExecutionListenerLoader listenerLoader;
|
||||
@@ -61,18 +58,21 @@ public class FlowExecutorBuilder {
|
||||
private ConversationManager conversationManager;
|
||||
|
||||
|
||||
public FlowExecutorBuilder(FlowDefinitionLocator flowRegistry) {
|
||||
Assert.notNull(flowRegistry, "FlowDefinitionLocator is required");
|
||||
this.flowRegistry = flowRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance with the given flow registry and ApplicationContext.
|
||||
*
|
||||
* @param flowRegistry the flow registry that will locate flow definitions
|
||||
* @param applicationContext the Spring ApplicationContext to use for
|
||||
* initializing an instance of {@link MvcEnvironment}
|
||||
* @param applicationContext the Spring ApplicationContext
|
||||
* @deprecated as of 2.5 an ApplicationContext is no longer required
|
||||
*/
|
||||
public FlowExecutorBuilder(FlowDefinitionLocator flowRegistry, ApplicationContext applicationContext) {
|
||||
Assert.notNull(flowRegistry, "FlowDefinitionLocator is required");
|
||||
Assert.notNull(applicationContext, "applicationContext is required");
|
||||
this.flowRegistry = flowRegistry;
|
||||
this.environment = MvcEnvironment.environmentFor(applicationContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,10 +216,10 @@ public class FlowExecutorBuilder {
|
||||
private LocalAttributeMap<Object> getExecutionAttributes() {
|
||||
LocalAttributeMap<Object> attributes = new LocalAttributeMap<Object>(this.executionAttributes.asMap());
|
||||
if (!attributes.contains("alwaysRedirectOnPause")) {
|
||||
attributes.put("alwaysRedirectOnPause", (this.environment != MvcEnvironment.PORTLET));
|
||||
attributes.put("alwaysRedirectOnPause", true);
|
||||
}
|
||||
if (!attributes.contains("redirectInSameState")) {
|
||||
attributes.put("redirectInSameState", (this.environment != MvcEnvironment.PORTLET));
|
||||
attributes.put("redirectInSameState", true);
|
||||
}
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@@ -17,15 +17,12 @@ package org.springframework.webflow.config;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.binding.convert.ConversionExecutor;
|
||||
import org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.convert.service.DefaultConversionService;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.webflow.conversation.ConversationManager;
|
||||
@@ -45,7 +42,6 @@ import org.springframework.webflow.execution.repository.snapshot.SerializedFlowE
|
||||
import org.springframework.webflow.execution.repository.snapshot.SimpleFlowExecutionSnapshotFactory;
|
||||
import org.springframework.webflow.executor.FlowExecutor;
|
||||
import org.springframework.webflow.executor.FlowExecutorImpl;
|
||||
import org.springframework.webflow.mvc.builder.MvcEnvironment;
|
||||
|
||||
/**
|
||||
* This factory encapsulates the construction and assembly of a {@link FlowExecutor}, including the provision of its
|
||||
@@ -57,8 +53,7 @@ import org.springframework.webflow.mvc.builder.MvcEnvironment;
|
||||
* @author Keith Donald
|
||||
* @author Erwin Vervaet
|
||||
*/
|
||||
class FlowExecutorFactoryBean implements FactoryBean<FlowExecutor>, ApplicationContextAware, BeanClassLoaderAware,
|
||||
InitializingBean {
|
||||
class FlowExecutorFactoryBean implements FactoryBean<FlowExecutor>, BeanClassLoaderAware, InitializingBean {
|
||||
|
||||
private static final String ALWAYS_REDIRECT_ON_PAUSE = "alwaysRedirectOnPause";
|
||||
|
||||
@@ -80,8 +75,6 @@ class FlowExecutorFactoryBean implements FactoryBean<FlowExecutor>, ApplicationC
|
||||
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
private MvcEnvironment environment;
|
||||
|
||||
private ClassLoader classLoader;
|
||||
|
||||
/**
|
||||
@@ -133,12 +126,6 @@ class FlowExecutorFactoryBean implements FactoryBean<FlowExecutor>, ApplicationC
|
||||
this.conversationManager = conversationManager;
|
||||
}
|
||||
|
||||
// implementing ApplicationContextAware
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
environment = MvcEnvironment.environmentFor(applicationContext);
|
||||
}
|
||||
|
||||
// implement BeanClassLoaderAware
|
||||
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
@@ -186,12 +173,10 @@ class FlowExecutorFactoryBean implements FactoryBean<FlowExecutor>, ApplicationC
|
||||
|
||||
private void putDefaultFlowExecutionAttributes(LocalAttributeMap<Object> executionAttributes) {
|
||||
if (!executionAttributes.contains(ALWAYS_REDIRECT_ON_PAUSE)) {
|
||||
Boolean redirect = (environment != MvcEnvironment.PORTLET);
|
||||
executionAttributes.put(ALWAYS_REDIRECT_ON_PAUSE, redirect);
|
||||
executionAttributes.put(ALWAYS_REDIRECT_ON_PAUSE, true);
|
||||
}
|
||||
if (!executionAttributes.contains(REDIRECT_IN_SAME_STATE)) {
|
||||
Boolean redirect = (environment != MvcEnvironment.PORTLET);
|
||||
executionAttributes.put(REDIRECT_IN_SAME_STATE, redirect);
|
||||
executionAttributes.put(REDIRECT_IN_SAME_STATE, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,7 @@ public interface ExternalContext {
|
||||
* session and accessible to both internal and external SWF artifacts.
|
||||
* <p>
|
||||
* Note: most external context implementations do not distinguish between the concept of a "local" user session
|
||||
* scope and a "global" session scope. The Portlet world does, but not the Servlet for example. In those cases
|
||||
* calling this method returns the same map as calling {@link #getSessionMap()}.
|
||||
* scope and a "global" session scope. Otherwise this method returns the same map as calling {@link #getSessionMap()}.
|
||||
* @return the mutable global session attribute map
|
||||
*/
|
||||
public SharedAttributeMap<Object> getGlobalSessionMap();
|
||||
@@ -140,8 +139,7 @@ public interface ExternalContext {
|
||||
|
||||
/**
|
||||
* Is a <i>render</i> response allowed to be written for this request? Always return false after a response has been
|
||||
* completed. May return false before that to indicate a response is not allowed to be completed. For example, in a
|
||||
* Portlet environment, render responses are only allowed in render requests.
|
||||
* completed. May return false before that to indicate a response is not allowed to be completed.
|
||||
* @return true if yes, false otherwise
|
||||
*/
|
||||
public boolean isResponseAllowed();
|
||||
@@ -215,4 +213,4 @@ public interface ExternalContext {
|
||||
*/
|
||||
public boolean isResponseCompleteFlowExecutionRedirect();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Shared classes used by the Servlet and Portlet ExternalContext implementations.
|
||||
* Shared classes used with Servlet or alternative ExternalContext implementations.
|
||||
*/
|
||||
package org.springframework.webflow.context.web;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ import org.springframework.webflow.execution.RequestContext;
|
||||
* <p>
|
||||
* This class and the rest of the Spring Web Flow (SWF) engine have been designed with minimal dependencies on other
|
||||
* libraries. Spring Web Flow is usable in a standalone fashion. The engine system is fully usable outside an HTTP
|
||||
* servlet environment, for example in portlets, tests, or standalone applications. One of the major architectural
|
||||
* servlet environment, for example in tests, or standalone applications. One of the major architectural
|
||||
* benefits of Spring Web Flow is the ability to design reusable, high-level controller modules that may be executed in
|
||||
* <i>any</i> environment.
|
||||
* <p>
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.springframework.webflow.definition.TransitionDefinition;
|
||||
* The web flow system will ensure that a RequestContext object is local to the current thread. It can be safely
|
||||
* manipulated without needing to worry about concurrent access.
|
||||
* <p>
|
||||
* Note: this request context is in no way linked to an HTTP or Portlet request. It uses the familiar "request" naming
|
||||
* Note: this request context is in no way linked to an HTTP request. It uses the familiar "request" naming
|
||||
* convention to indicate a single call to manipulate a runtime execution of a flow definition.
|
||||
*
|
||||
* @author Keith Donald
|
||||
@@ -151,7 +151,7 @@ public interface RequestContext {
|
||||
* constructs within that environment.
|
||||
* <p>
|
||||
* In addition, this context may be downcastable to a specific context type for a specific client environment, such
|
||||
* as Servlets or Portlets. Such downcasting will give you full access to a native HttpServletRequest, for example.
|
||||
* as Servlets. Such downcasting will give you full access to a native HttpServletRequest, for example.
|
||||
* With that said, for portability reasons you should avoid coupling your flow artifacts to a specific deployment
|
||||
* environment when possible.
|
||||
* @return the originating external context, the one that triggered the current execution request
|
||||
@@ -208,4 +208,4 @@ public interface RequestContext {
|
||||
*/
|
||||
public String getFlowExecutionUrl() throws IllegalStateException;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +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.mvc.builder;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
/**
|
||||
* Supported Spring Web MVC environments.
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
public enum MvcEnvironment {
|
||||
|
||||
/**
|
||||
* Spring Web Servlet MVC.
|
||||
*/
|
||||
SERVLET,
|
||||
|
||||
/**
|
||||
* Spring Web Portlet MVC.
|
||||
*/
|
||||
PORTLET;
|
||||
|
||||
/**
|
||||
* Calculates the web environment from the state of the provided application context.
|
||||
* @param applicationContext the application context
|
||||
* @return the web environment the context is running in, or null if not running in a web environment
|
||||
*/
|
||||
public static MvcEnvironment environmentFor(ApplicationContext applicationContext) {
|
||||
if (applicationContext instanceof WebApplicationContext) {
|
||||
return MvcEnvironment.SERVLET;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,8 +22,6 @@ import org.springframework.binding.convert.ConversionService;
|
||||
import org.springframework.binding.expression.Expression;
|
||||
import org.springframework.binding.expression.ExpressionParser;
|
||||
import org.springframework.binding.expression.beanwrapper.BeanWrapperExpressionParser;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.DefaultMessageCodesResolver;
|
||||
import org.springframework.validation.MessageCodesResolver;
|
||||
@@ -43,9 +41,6 @@ import org.springframework.webflow.validation.WebFlowMessageCodesResolver;
|
||||
* Returns {@link ViewFactory view factories} that create native Spring MVC-based views. Used by a FlowBuilder to
|
||||
* configure a flow's view states with Spring MVC-based view factories.
|
||||
* <p>
|
||||
* This implementation detects whether it is running in a Servlet or Portlet MVC environment, and returns instances of
|
||||
* the default view factory implementation for that environment.
|
||||
* <p>
|
||||
* By default, this implementation creates view factories that resolve their views by loading flow-relative resources,
|
||||
* such as .jsp templates located in a flow working directory. This class also supports rendering views resolved by
|
||||
* pre-existing Spring MVC {@link ViewResolver view resolvers}.
|
||||
@@ -57,9 +52,7 @@ import org.springframework.webflow.validation.WebFlowMessageCodesResolver;
|
||||
* @author Keith Donald
|
||||
* @author Scott Andrews
|
||||
*/
|
||||
public class MvcViewFactoryCreator implements ViewFactoryCreator, ApplicationContextAware {
|
||||
|
||||
private MvcEnvironment environment;
|
||||
public class MvcViewFactoryCreator implements ViewFactoryCreator {
|
||||
|
||||
private FlowViewResolver flowViewResolver = new FlowResourceFlowViewResolver();
|
||||
|
||||
@@ -162,11 +155,6 @@ public class MvcViewFactoryCreator implements ViewFactoryCreator, ApplicationCon
|
||||
this.messageCodesResolver = messageCodesResolver;
|
||||
}
|
||||
|
||||
// implementing ApplicationContextAware
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
environment = MvcEnvironment.environmentFor(applicationContext);
|
||||
}
|
||||
|
||||
public ViewFactory createViewFactory(Expression viewId, ExpressionParser expressionParser,
|
||||
ConversionService conversionService, BinderConfiguration binderConfiguration,
|
||||
@@ -188,17 +176,13 @@ public class MvcViewFactoryCreator implements ViewFactoryCreator, ApplicationCon
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a concrete instance of an AbstractMvcViewFactory according to the runtime environment (Servlet or
|
||||
* Portlet).
|
||||
* Creates a concrete instance of an AbstractMvcViewFactory.
|
||||
*/
|
||||
protected AbstractMvcViewFactory createMvcViewFactory(Expression viewId, ExpressionParser expressionParser,
|
||||
ConversionService conversionService, BinderConfiguration binderConfiguration) {
|
||||
if (environment == MvcEnvironment.SERVLET) {
|
||||
return new ServletMvcViewFactory(viewId, flowViewResolver, expressionParser, conversionService,
|
||||
binderConfiguration, messageCodesResolver);
|
||||
} else {
|
||||
throw new IllegalStateException("Web MVC Environment " + environment + " not supported ");
|
||||
}
|
||||
|
||||
return new ServletMvcViewFactory(viewId, flowViewResolver, expressionParser, conversionService,
|
||||
binderConfiguration, messageCodesResolver);
|
||||
}
|
||||
|
||||
public String getViewIdByConvention(String viewStateId) {
|
||||
|
||||
@@ -60,7 +60,7 @@ import org.springframework.webflow.validation.ValidationHelper;
|
||||
import org.springframework.webflow.validation.ValidationHintResolver;
|
||||
|
||||
/**
|
||||
* Base view implementation for the Spring Web MVC Servlet and Spring Web MVC Portlet frameworks.
|
||||
* Base view implementation for the Spring Web MVC Servlet frameworks.
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
|
||||
@@ -47,8 +47,8 @@ import org.springframework.webflow.test.MockExternalContext;
|
||||
* <p>
|
||||
* A flow execution test can effectively automate and validate the orchestration required to drive an end-to-end
|
||||
* business task that spans several steps involving the user to complete. Such tests are a good way to test your system
|
||||
* top-down starting at the web-tier and pushing through all the way to the DB without having to deploy to a servlet or
|
||||
* portlet container. In addition, they can be used to effectively test a flow's execution (the web layer) standalone,
|
||||
* top-down starting at the web-tier and pushing through all the way to the DB without having to deploy to a servlet
|
||||
* container. In addition, they can be used to effectively test a flow's execution (the web layer) standalone,
|
||||
* typically with a mock service layer.
|
||||
*
|
||||
* @author Keith Donald
|
||||
|
||||
Reference in New Issue
Block a user