first pass at conversion guide. incomplete

This commit is contained in:
Scott Andrews
2008-04-08 21:59:25 +00:00
parent 54ba149619
commit 2226b1d487
3 changed files with 1351 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,8 @@
<!ENTITY el SYSTEM "el.xml">
<!ENTITY flow-security SYSTEM "flow-security.xml">
<!ENTITY flow-inheritance SYSTEM "flow-inheritance.xml">
<!ENTITY upgrade-guide SYSTEM "upgrade-guide.xml">
<!ENTITY flow-definition-field-mappings SYSTEM "flow-definition-field-mappings.xml">
]>
<book>
@@ -70,5 +72,7 @@
&el;
&flow-security;
&flow-inheritance;
&upgrade-guide;
&flow-definition-field-mappings;
</book>

View File

@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="upgrade-guide">
<title>Upgrading from 1.0</title>
<sect1 id="upgrade-guide-definition-language">
<title>Flow Definition Language</title>
<sect2 id="upgrade-guide-definition-language-tool">
<title>Flow Definition Updater Tool</title>
<para>
An automated tool is available to aid in the conversion of existing 1.0 flows to the new 2.0 syntax.
The tool will convert all the old tag names into their new equivalents, if needed.
While the tool will make a best effort attempt at conversion, there is not a one-to-one mapping for all 1.0 concepts.
If the tool was unable to convert a portion of the flow, it will be marked with a <code>WARNING</code> comment in the resulting flow.
</para>
<para>
The conversion tool requires spring-webflow.jar, spring-core.jar and an XSLT 1.0 engine.
<ulink url="http://xalan.apache.org/">Xalan</ulink> 2.7.1 or later is strongly recommended.
</para>
<para>
The tool can be run from the command line with the following command.
Required libraries must be available on the classpath.
The source must be a single flow to convert.
The resulting converted flow will be sent to standard output.
</para>
<programlisting language="shell">
java org.springframework.webflow.engine.model.builder.xml.WebFlowUpgrader flowToUpgrade.xml
</programlisting>
<sect3 id="upgrade-guide-definition-language-tool-warnings">
<title>Flow Definition Updater Tool Warnings</title>
<sect4 id="upgrade-guide-definition-language-tool-warnings-argument-parameter-type">
<title>argument parameter-type no longer supported</title>
<para>
Bean actions have been deprecated in favor of EL based evaluate expressions.
The EL expression is able to accept method parameters directly, so there is no longer a need for the argument tag.
A side effect of this change is that method arguments must be of the correct type before invoking the action.
</para>
</sect4>
<sect4 id="upgrade-guide-definition-language-tool-warnings-inline-flow">
<title>inline-flow is no longer supported</title>
<para>
Inline flow are no longer supported.
The contents of the inline flow must be moved into a new top-level flow.
The inline flow's content has been converted for your convenience.
</para>
</sect4>
<sect4 id="upgrade-guide-definition-language-tool-warnings-mapping-target-collection">
<title>mapping target-collection is no longer supported</title>
<para>
Output mappings can no longer add an item to a collection.
Only assignment is supported.
</para>
</sect4>
<sect4 id="upgrade-guide-definition-language-tool-warnings-var-bean">
<title>var bean is no longer supported</title>
<para>
The var bean attribute is no longer needed to allow the flow access to a spring bean.
All spring beans can be resolved via EL.
</para>
</sect4>
<sect4 id="upgrade-guide-definition-language-tool-warnings-var=scope">
<title>var scope is no longer supported</title>
<para>
The var element will automatically place all variable into flow scope.
Conversation scope was previously allowed.
</para>
</sect4>
</sect3>
</sect2>
<sect2 id="upgrade-guide-definition-language-el">
<title>EL Expressions</title>
<para>
EL expressions are used heavily throughout the flow definition language.
Many of the attributes that appear to be plain text are actually interpreted as EL.
The standard EL delimiters (either ${} or #{}) are not necessary and will often cause an exception if they are included.
</para>
<para>
EL delimiters may need to be removed manually from the converted flow.
</para>
</sect2>
</sect1>
<sect1 id="upgrade-guide-webflow-config">
<title>Web Flow Configuration</title>
<para>
In Web Flow 1.0 there were two options available for configuring Web Flow, with standard spring bean or with the webflow config schema.
The schema configuration option simplifies the configuration process keeping long internal class name hidden and contextual auto-complete.
The schema configuration option is the standard way to configure Web Flow 2.0
</para>
<sect2 id="upgrade-guide-webflow-config-beans">
<title>Web Flow Bean Configuration</title>
<para>
The bean configuration method used in Web Flow 1.0 is no longer supported.
The schema configuration method should be used instead.
In particular beans defining <code>FlowExecutorFactoryBean</code> and <code>XmlFlowRegistryFactoryBean</code> should be updated.
Continue reading Web Flow Schema Configuration for details.
</para>
</sect2>
<sect2 id="upgrade-guide-webflow-config-schema">
<title>Web Flow Schema Configuration</title>
<para>
The configuration schema has change slightly in 2.0.
The simplest way to update your application is modify the version of the schema to 2.0 then fix any errors.
The most common change is add 'flow-' to the name of elements defined by the schema.
</para>
<programlisting language="xml"><![CDATA[
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">
]]></programlisting>
<sect3 id="upgrade-guide-webflow-config-schema-executor">
<title>flow-executor</title>
<para>
The flow executor is the core of Web Flow.
This element replaces previous bean definitions for <code>FlowExecutorFactoryBean</code>.
</para>
<programlisting language="xml"><![CDATA[
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>
]]></programlisting>
</sect3>
<sect3 id="upgrade-guide-webflow-config-schema-listeners">
<title>flow-execution-listeners</title>
<para>
Flow execution listeners are also defined in the flow executor.
Listeners are defined using standard bean definitions and added by reference.
</para>
<programlisting language="xml"><![CDATA[
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
<webflow:flow-execution-listeners>
<webflow:listener ref="securityFlowExecutionListener"/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
<bean id="securityFlowExecutionListener"
class="org.springframework.webflow.security.SecurityFlowExecutionListener" />
]]></programlisting>
</sect3>
<sect3 id="upgrade-guide-webflow-config-schema-registry">
<title>flow-registry</title>
<para>
The <code>flow-registry</code> contains a set of <code>flow-location</code>s.
Every flow definition used by Web Flow must be added to the registry.
This element replaces previous bean definitions for <code>XmlFlowRegistryFactoryBean</code>.
</para>
<programlisting language="xml"><![CDATA[
<webflow:flow-registry id="flowRegistry">
<webflow:flow-location path="/WEB-INF/hotels/booking/booking.xml" />
</webflow:flow-registry>
]]></programlisting>
</sect3>
</sect2>
<sect2 id="upgrade-guide-java-controller">
<title>Flow Controller</title>
<para>
The package name for flow controllers has changed from <code>org.springframework.webflow.executor.mvc.FlowController</code> and is now <code>org.springframework.webflow.mvc.servlet.FlowController</code> for Servlet MVC requests.
The portlet flow controller <code>org.springframework.webflow.executor.mvc.PortletFlowController</code> has been replaced by a flow handler adapter available at <code>org.springframework.webflow.mvc.portlet.FlowHandlerAdapter</code>.
It will need to be updated in the bean definitions.
</para>
<para>
The flowExecutor can no longer be set via a mutator.
It must be set as a constructor argument.
</para>
<programlisting language="xml"><![CDATA[
<bean name="/pos.htm" class="org.springframework.webflow.mvc.servlet.FlowController">
<constructor-arg ref="flowExecutor"/>
</bean>
]]></programlisting>
</sect2>
<sect2 id="upgrade-guide-java-url-handler">
<title>Flow Request URL Handler</title>
<para>
The default URL handler has changed in Web Flow 2.0.
The flow identifier is now inferred from the URL rather then passed explicitly.
In order to maintain comparability with existing views and URL structures using Web Flow 1.0 a <code>ParameterBasedFlowUrlHandler</code> is available.
</para>
<programlisting language="xml"><![CDATA[
<bean name="/pos.htm" class="org.springframework.webflow.mvc.servlet.FlowController">
<constructor-arg ref="flowExecutor"/>
<property name="flowRequestUrlHandler"><bean class="org.springframework.webflow.context.servlet.ParameterBasedFlowUrlHandler"/></property>
</bean>
]]></programlisting>
</sect2>
<sect2 id="upgrade-guide-webflow-config-view-resolver">
<title>Custom View Resolvers</title>
</sect2>
</sect1>
<sect1 id="upgrade-guide-webflow-concepts">
<title>Web Flow Concepts</title>
<sect2 id="upgrade-guide-webflow-concepts-el-v-ognl">
<title>OGNL vs EL</title>
<para>
Web Flow 1.0 used OGNL exclusively for expressions within the flow definitions.
Web Flow 2.0 adds support for Unified EL.
United EL is used when it is available, OGNL will continue to be used when a Unified EL implementation is not available.
</para>
</sect2>
<sect2 id="upgrade-guide-webflow-concepts-flash-scope">
<title>Flash Scope</title>
</sect2>
<sect2 id="upgrade-guide-webflow-concepts-redirects">
<title>External Redirects</title>
</sect2>
<sect2 id="upgrade-guide-webflow-concepts-views">
<title>Views</title>
<para>
Views are handled differently in Web Flow 2.0.
Previously, Web Flow returned a reference to the view to render.
Then a view resolver would render the view.
Web Flow 2.0 will both select and render views.
</para>
</sect2>
<sect2 id="upgrade-guide-webflow-concepts-jsf">
<title>JavaServer Faces</title>
</sect2>
<sect2 id="upgrade-guide-webflow-concepts-binding">
<title>Automatic Model Binding</title>
</sect2>
</sect1>
</chapter>