<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/webflow
    http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">

  <start-state idref="init"/>

  <action-state id="init">
    <action bean="mail.viewAndReplyAction" method="init"/>
    <transition to="form"/>
  </action-state>

  <view-state id="form" view="mail.ViewAndReply">
    <entry-actions>
      <action bean="mail.viewAndReplyAction" method="view"/>
    </entry-actions>
    <render-actions>
      <action bean="mail.viewAndReplyAction" method="setupForm"/>
    </render-actions>
    <transition on="submit" to="reply">
      <action bean="mail.viewAndReplyAction" method="bindAndValidate"/>
    </transition>
  </view-state>

  <action-state id="reply">
    <action bean="mail.viewAndReplyAction" method="reply"/>
    <transition on="success" to="finish"/>
  </action-state>

  <end-state id="finish" view="externalRedirect:/mail/${flowScope.thread.code}/index.html"/>

</flow>
