<?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-2.0.xsd">

  <secured attributes="ROLE_USER, ROLE_ADMIN"/>

  <on-start>
    <evaluate expression="mailViewAndReplyAction.init"/>
  </on-start>

  <view-state id="form" view="mail.ViewAndReply">
    <on-entry>
      <evaluate expression="mailViewAndReplyAction.view"/>
    </on-entry>
    <on-render>
      <evaluate expression="mailViewAndReplyAction.setupForm"/>
    </on-render>
    <transition on="submit" to="reply">
      <evaluate expression="mailViewAndReplyAction.bindAndValidate"/>
    </transition>
  </view-state>

  <action-state id="reply">
    <evaluate expression="mailViewAndReplyAction.reply"/>
    <transition on="success" to="finish"/>
  </action-state>

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

</flow>
