Spring Web Flow 1.0 Introduction

来源:互联网 发布:celtx for mac 中文版 编辑:程序博客网 时间:2024/05/23 13:25

Chapter 1. Introduction

1.1. Overview

Spring Web Flow (SWF) is a component of the Spring Framework's web stack focused on the definition and execution of UI flow within a web application.

The system allows you to capture a logical flow of your web application as a self-contained module that can be reused in different situations. Such a flow guides a single user through the implementation of a business process, and represents a single user conversation. Flows often execute across HTTP requests, have state, exhibit transactional characteristics, and may be dynamic and/or long-running in nature.

Spring Web Flow exists at a higher level of abstraction, integrating as a self-contained flow engine within base frameworks such as Struts, Spring MVC, Portlet MVC, and JSF. SWF provides you the capability to capture your application's page flow explicitly in a declarative, highly-portable, and highly-manageable fashion. SWF is a powerful controller framework based on a finite-state machine, fully addressing the "C" in MVC.

1.2. Packaging overview

Spring Web Flow has been architected as a self-contained flow engine with few required dependencies on third-party APIs. All dependencies are carefully managed.

At a minimum, to use Spring Web Flow you need:

  • spring-webflow (the framework)

  • spring-core (miscellaneous utility classes used internally by the framework)

  • spring-binding (the Spring data binding framework, used internally)

  • commons-logging (a simple logging facade, used internally)

Most users will embed SWF as a component within a larger web application development framework, as SWF is a focused controller technology that expects a calling system to care for request mapping and response rendering. In this case, those users will depend on a thin integration piece for their environment. For example, those executing flows within a Servlet might use the Spring MVC integration to care for dispatching requests to SWF and rendering responses for SWF view selections.

It is important to note that Spring Web Flow, like Spring, is a layered framework, packaged in a manner that allows teams to use the parts they need and nothing else. For example, one team might use Spring Web Flow in a Servlet environment with Spring MVC, and thus require the Spring MVC integration. Another team might use SWF in a Portlet environment, and thus require the Portlet MVC integration. Another team might mix and match. A major benefit of SWF is that it allows you to define reusable, self-contained controller modules that can execute in any environment.

1.3. High level architecture

A high-level diagram of Spring Web Flow's layered architecture is shown below:

Spring Web Flow

1.4. Package structure

This section provides an overview of the logical package structure of the SWF codebase. The dependencies for each package are clearly noted.

1.4.1. org.springframework.webflow

The webflow package contains the central foundational abstractions of the framework. These abstractions consist of definition artifacts such as Flow, State, and Action that define the core "domain language" for expressing flows.

  • Dependencies: spring-core, spring-binding, commons-logging

1.4.2. org.springframework.webflow.action

The action package contains implementations of the core "Action" abstraction for executing arbitrary command logic within a Flow.

  • Dependencies: webflow, spring-beans (optional), spring-context (optional)

1.4.3. org.springframework.webflow.builder

The builder package contains abstractions used at configuration-time for building and assembling Flows, in Java or from externalized resources such as XML files.

  • Dependencies: webflow, webflow.support

1.4.4. org.springframework.webflow.execution

The execution package contains runtime abstractions for executing Flows and managing flow executions. This is where the implementation of the Spring Web Flow's finite-state machine resides. This is also where the repository subsystem resides, for storing active flow executions beyond a single request into the server. This subsystem forms the basis for Spring Web Flow's continuation server.

  • Dependencies: webflow, webflow.util, commons-codec (optional)

1.4.5. org.springframework.webflow.executor

The executor package is the highest-level package in the framework. It contains implementations of "flow executors" that drive the execution of flows. This is where the facade for external systems that call into the Spring Web Flow system resides. This is also where integration layers for Spring MVC (Servlet and Portlet), Struts, and Java Server Faces (JSF) reside.

  • Dependencies: webflow.execution, spring-webmvc (optional), spring-portlet (optional), Struts (optional), Java Server Faces (optional).

1.4.6. org.springframework.webflow.registry

The registry package contains the subsystem for managing registries of flow definitions that are eligible for execution.

  • Dependencies: webflow, webflow.builder, webflow.execution, spring-beans (optional)

1.4.7. org.springframework.webflow.support

The support package contains general-purpose implementations of the core definitional artifacts. These implementations are mainly used internally by the other packages of the framework but are also usable directly by developers.

  • Dependencies: webflow

1.4.8. org.springframework.webflow.test

The test package contains support for testing Flow Executions out-of-container, as well as unit testing artifacts such as Actions in isolation.

  • Dependencies: webflow, webflow.execution, junit

A package dependency noted as (optional) means that the dependency is needed to compile the package but is optionally needed at runtime (depending on your use of the package). For example, use of Spring Web Flow in a Servlet environment entails use of the context.servlet package and requires the Servlet API to be in the classpath, but not the Portlet API.

For the exact list of dependencies, as well as supported product usage configurations, see the SWF ivy dependency manager descriptor located within the SWF distribution at spring-webflow/ivy.xml

1.5. Support

Spring Web Flow 1.0 is supported on Spring 1.2.7 or later. The Portlet integration requires Spring 2.0.

The community support forum is located at http://forum.springframework.org.