SlideShare a Scribd company logo
Spring Web Flow
A little flow of happiness.
Presented by – Vikrant
Agenda
 Why Web – Flow ?
 Spring Web-Flow (Basic Introduction)
 Spring Web-Flow Grails Plugin
 Demo
Introduction
Spring Web Flow builds on Spring MVC and allows
implementing the "flows" of a web application. A flow
encapsulates a sequence of steps that guide a user through the
execution of some business task. It spans multiple HTTP
requests, has state, deals with transactional data, is reusable.
Stateful web applications with controlled navigation such as checking
in for a flight, applying for a loan, shopping cart checkout and many
more.
These scenarios have in common is one or more of the following traits:
● There is a clear start and an end point.
● The user must go through a set of screens in a specific order.
● The changes are not finalized until the last step.
● Once complete it shouldn't be possible to repeat a transaction accidentally
Disadvantages of MVC
 Visualizing the flow is very difficult
 Mixed navigation and view
 Overall navigation rules complexity
 All-in-one navigation storage
 Lack of state control/navigation customization
Use Case
Request Diagram
Basic Components
● Flow – A flow defined as a complete life-span of all States transitions.
● States - Within a flow stuff happens. Either the application performs some logic, the
user answers a question or fills out a form, or a decision is made to determine the next
step to take. The points in the flow where these things happen are known as states.
Five different kinds of state: View, Active, Decision, Subflow, and End.
● Transitions - A view state, action state, or subflow state may have any number of
transitions that direct them to other states.
● Flow Data - As a flow progresses, data is either collected, created, or otherwise
manipulated. Depending on the scope of the data, it may be carried around for periods of
time to be processed or evaluated within the flow
● Events – Events are responsible for transition in between states.
Types of State
View States : A view state displays information to a user or obtains user input
using a form. (e.g. JSP.,jsf, gsp etc)
Action States : Action states are where actions are perfomed by the spring beans.
The action state transitions to another state. The action states generally have an
evaluate property that describes what needs to be done.
Decision States: A decision state has two transitions depending on whether the
decision evaluates to true or false.
Subflow States :It may be advantageous to call another flow from one flow to
complete some steps. Passing inputs and expecting outputs.
End States : The end state signifies the end of flow. If the end state is part of a root
flow then the execution is ended. However, if its part of a sub flow then the root flow
is resumed.
Note :­ Once a flow has ended it can only be resumed from the start state, in this case 
showCart, and not from any other state.
Grails Flow Scopes
Grails flows have five different scopes you can utilize:
● request - Stores an object for the scope of the current request
● flash - Stores the object for the current and next request only
● flow - Stores objects for the scope of the flow, removing them when the flow
reaches an end state
● conversation - Stores objects for the scope of the conversation including the
root flow and nested subflows
● session - Stores objects in the user's session
Events
Exception Handling
● Transition on exception
on(Exception).to('error')
● Custom exception handler
on(MyCustomException).to('error')
Dependencies for Spring/Grails
Spring Maven/Gradle Dependencies
Maven POM
<dependencies>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.4.4.RELEASE</version>
</dependency>
</dependencies>
Gradle
dependencies {
compile 'org.springframework.webflow:spring-webflow:2.4.4.RELEASE'
}
Grails Plugin Installation
plugins{
....
compile ":webflow:2.1.0"
.....
}
Grails Web Flow Plugin
How to define a flow...
class BookController {
def shoppingCartFlow ={ // add flow to action in Controller
state {
}
…
state {
}
...
}
}
Here, Shopping Cart will be considered as a action and will work like a flow.
Note - Views are stored within a directory that matches the name of the flow:
grails-app/views/book/shoppingCart.
URL - localhost:8080/applicationName/book/shoppingCart
Grails Web Flow Plugin
How to define a state...
def shoppingCartFlow ={
showCart {
on("checkout").to "enterPersonalDetails"
on("continueShopping").to "displayCatalogue"
}
…
displayCatalogue {
redirect(controller: "catalogue", action: "show")
}
displayInvoice()
}
Here, “showCart” and “displayCatelog” will be considered as a state
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
Grails Web Flow Plugin
Action State ...
enterPersonalDetails {
on("submit") {
def p = new Person(params)
flow.person = p
if (!p.validate()) return error()
}.to "enterShipping"
on("return").to "showCart"
}
Here, action{....} state used to perform some action when it enters into the
ShippingNeeded State
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
enterPersonalDetails {
action { //action State defined and used to
perform stuffs
}
on("submit") .to "enterShipping"
on("return").to "showCart"
}
Grails Web Flow Plugin
Decision State ...
shippingNeeded {
action { //action State defined and used to perform stuffs
if (params.shippingRequired) yes()
else no()
}
on("yes").to "enterShipping"
on("no").to "enterPayment"
}
Here, action{....} state used to perform some action when it enters into the
ShippingNeeded State
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
Grails Web Flow Plugin
Sub-Flow State ...
def extendedSearchFlow = {
startExtendedSearch {
on("findMore").to "searchMore"
on("searchAgain").to "noResults"
}
searchMore {
Action {
.........
........
}
on("success").to "moreResults"
on("error").to "noResults"
}
moreResults()
noResults()
}
Here, extendedSearchFlow state used as sub-state
extendedSearch {
// Extended search subflow
subflow(controller: "searchExtensions",
action: "extendedSearch")
on("moreResults").to
"displayMoreResults"
on("noResults").to
"displayNoMoreResults"
}
displayMoreResults()
displayNoMoreResults()
Grails Web Flow Plugin
Transition ...
def shoppingCartFlow ={
showCart {
on("checkout").to "enterPersonalDetails" // Transition from one flow to another
on("continueShopping").to "displayCatalogue"
}
…
displayCatalogue {
redirect(controller: "catalogue", action: "show")
}
displayInvoice()
}
Here, On().to() used to transition from one state to another defined in sequence.
URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
Grails Web Flow Plugin
Take a special care...
● Once a flow has ended it can only be resumed from the start state
● Throughout the flow life-cycle each html/grails control name should be unique.
● Maintain JSessionId is maintained throughout the flow execution.
● Spring Security is checked only before entering into a flow not in between the states
of executing flow
● When placing objects in flash, flow or conversation scope they must implement
java.io.Serializable or an exception will be thrown
● built-in error() and success() methods.
● Any Exception class in-heirarchy or CustomException Handler Class used to handle
Exceptions
References
1. https://dzone.com/refcardz/spring-web-flow
2. http://projects.spring.io/spring-webflow/
3. https://grails-plugins.github.io/grails-webflow-plugin/guide/
4. https://grails.org/plugin/webflow
Questions ?
Take a look aside practically
Demo !!
Thank You !!

More Related Content

What's hot

DBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs WorldDBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs World
Kellyn Pot'Vin-Gorman
 
Data Flow Diagram and USe Case Diagram
Data Flow Diagram and USe Case DiagramData Flow Diagram and USe Case Diagram
Data Flow Diagram and USe Case Diagram
Kumar
 
Introduction to UML
Introduction to UMLIntroduction to UML
SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)
Hussain Mansoor
 
Credit Fraud Prevention with Spark and Graph Analysis
Credit Fraud Prevention with Spark and Graph AnalysisCredit Fraud Prevention with Spark and Graph Analysis
Credit Fraud Prevention with Spark and Graph Analysis
Jen Aman
 
Cloud Security, Standards and Applications
Cloud Security, Standards and ApplicationsCloud Security, Standards and Applications
Cloud Security, Standards and Applications
Dr. Sunil Kr. Pandey
 
Fundamental MLOps
Fundamental MLOpsFundamental MLOps
Fundamental MLOps
Saripudin Gon
 
IaaS - Infrastructure as a Service
IaaS - Infrastructure as a ServiceIaaS - Infrastructure as a Service
IaaS - Infrastructure as a Service
Rajind Ruparathna
 
How to Build a Platform Team
How to Build a Platform TeamHow to Build a Platform Team
How to Build a Platform Team
VMware Tanzu
 
Microservices
MicroservicesMicroservices
Microservices
Gyanendra Yadav
 
DevOps: What, who, why and how?
DevOps: What, who, why and how?DevOps: What, who, why and how?
DevOps: What, who, why and how?
Red Gate Software
 
TCL_CUI_training.pptx
TCL_CUI_training.pptxTCL_CUI_training.pptx
TCL_CUI_training.pptx
AnthonyPearce17
 
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya RaghunathanCamunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
camunda services GmbH
 
Importance of software architecture
Importance of software architectureImportance of software architecture
Importance of software architecture
Himanshu
 
Cloud computing lecture 1
Cloud computing lecture 1Cloud computing lecture 1
Cloud computing lecture 1
Md. Mashiur Rahman
 
Jump-Start Health Data Interoperability with Apigee Health APIx
Jump-Start Health Data Interoperability with Apigee Health APIxJump-Start Health Data Interoperability with Apigee Health APIx
Jump-Start Health Data Interoperability with Apigee Health APIx
Apigee | Google Cloud
 
MLOps for production-level machine learning
MLOps for production-level machine learningMLOps for production-level machine learning
MLOps for production-level machine learning
cnvrg.io AI OS - Hands-on ML Workshops
 
cloud computing architecture.pptx
cloud computing architecture.pptxcloud computing architecture.pptx
cloud computing architecture.pptx
SourodeepChakraborty3
 
Microservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design PatternMicroservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design Pattern
jeetendra mandal
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
Amazon Web Services
 

What's hot (20)

DBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs WorldDBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs World
 
Data Flow Diagram and USe Case Diagram
Data Flow Diagram and USe Case DiagramData Flow Diagram and USe Case Diagram
Data Flow Diagram and USe Case Diagram
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)
 
Credit Fraud Prevention with Spark and Graph Analysis
Credit Fraud Prevention with Spark and Graph AnalysisCredit Fraud Prevention with Spark and Graph Analysis
Credit Fraud Prevention with Spark and Graph Analysis
 
Cloud Security, Standards and Applications
Cloud Security, Standards and ApplicationsCloud Security, Standards and Applications
Cloud Security, Standards and Applications
 
Fundamental MLOps
Fundamental MLOpsFundamental MLOps
Fundamental MLOps
 
IaaS - Infrastructure as a Service
IaaS - Infrastructure as a ServiceIaaS - Infrastructure as a Service
IaaS - Infrastructure as a Service
 
How to Build a Platform Team
How to Build a Platform TeamHow to Build a Platform Team
How to Build a Platform Team
 
Microservices
MicroservicesMicroservices
Microservices
 
DevOps: What, who, why and how?
DevOps: What, who, why and how?DevOps: What, who, why and how?
DevOps: What, who, why and how?
 
TCL_CUI_training.pptx
TCL_CUI_training.pptxTCL_CUI_training.pptx
TCL_CUI_training.pptx
 
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya RaghunathanCamunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
 
Importance of software architecture
Importance of software architectureImportance of software architecture
Importance of software architecture
 
Cloud computing lecture 1
Cloud computing lecture 1Cloud computing lecture 1
Cloud computing lecture 1
 
Jump-Start Health Data Interoperability with Apigee Health APIx
Jump-Start Health Data Interoperability with Apigee Health APIxJump-Start Health Data Interoperability with Apigee Health APIx
Jump-Start Health Data Interoperability with Apigee Health APIx
 
MLOps for production-level machine learning
MLOps for production-level machine learningMLOps for production-level machine learning
MLOps for production-level machine learning
 
cloud computing architecture.pptx
cloud computing architecture.pptxcloud computing architecture.pptx
cloud computing architecture.pptx
 
Microservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design PatternMicroservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design Pattern
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 

Viewers also liked

Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJava
NexThoughts Technologies
 
RESTEasy
RESTEasyRESTEasy
JFree chart
JFree chartJFree chart
Hamcrest
HamcrestHamcrest
Grails with swagger
Grails with swaggerGrails with swagger
Grails with swagger
NexThoughts Technologies
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
NexThoughts Technologies
 
Introduction to es6
Introduction to es6Introduction to es6
Introduction to es6
NexThoughts Technologies
 
Jsoup
JsoupJsoup
Jmh
JmhJmh
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
NexThoughts Technologies
 
Progressive Web-App (PWA)
Progressive Web-App (PWA)Progressive Web-App (PWA)
Progressive Web-App (PWA)
NexThoughts Technologies
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
NexThoughts Technologies
 
Actors model in gpars
Actors model in gparsActors model in gpars
Actors model in gpars
NexThoughts Technologies
 
Cosmos DB Service
Cosmos DB ServiceCosmos DB Service
Cosmos DB Service
NexThoughts Technologies
 
Unit test-using-spock in Grails
Unit test-using-spock in GrailsUnit test-using-spock in Grails
Unit test-using-spock in Grails
NexThoughts Technologies
 
Apache tika
Apache tikaApache tika
Vertx
VertxVertx

Viewers also liked (17)

Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJava
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
JFree chart
JFree chartJFree chart
JFree chart
 
Hamcrest
HamcrestHamcrest
Hamcrest
 
Grails with swagger
Grails with swaggerGrails with swagger
Grails with swagger
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Introduction to es6
Introduction to es6Introduction to es6
Introduction to es6
 
Jsoup
JsoupJsoup
Jsoup
 
Jmh
JmhJmh
Jmh
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
 
Progressive Web-App (PWA)
Progressive Web-App (PWA)Progressive Web-App (PWA)
Progressive Web-App (PWA)
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Actors model in gpars
Actors model in gparsActors model in gpars
Actors model in gpars
 
Cosmos DB Service
Cosmos DB ServiceCosmos DB Service
Cosmos DB Service
 
Unit test-using-spock in Grails
Unit test-using-spock in GrailsUnit test-using-spock in Grails
Unit test-using-spock in Grails
 
Apache tika
Apache tikaApache tika
Apache tika
 
Vertx
VertxVertx
Vertx
 

Similar to Spring Web Flow

Spring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginSpring Web Flow Grail's Plugin
Spring Web Flow Grail's Plugin
C-DAC
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.
Alex Tumanoff
 
Silicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for ReusabilitySilicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for Reusability
jcruizjdev
 
Introduction to Srping Web Flow
Introduction to Srping Web Flow Introduction to Srping Web Flow
Introduction to Srping Web Flow
Emad Omara
 
Web flowpresentation
Web flowpresentationWeb flowpresentation
Web flowpresentation
Roman Brovko
 
Asp dot net lifecycle in details
Asp dot net lifecycle in detailsAsp dot net lifecycle in details
Asp dot net lifecycle in details
Ayesha Khan
 
Why ASP.NET Development is Important?
Why ASP.NET Development is Important?Why ASP.NET Development is Important?
Why ASP.NET Development is Important?
Ayesha Khan
 
Windows Workflow Foundation
Windows Workflow FoundationWindows Workflow Foundation
Windows Workflow Foundation
Usman Zafar Malik
 
Spring Web Webflow
Spring Web WebflowSpring Web Webflow
Spring Web Webflow
Emprovise
 
Asp.net life cycle in depth
Asp.net life cycle in depthAsp.net life cycle in depth
Asp.net life cycle in depth
sonia merchant
 
Grails services
Grails servicesGrails services
Grails services
Vijay Shukla
 
Discrete event-simulation
Discrete event-simulationDiscrete event-simulation
Discrete event-simulation
PrimeAsia University
 
[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture
Naukri.com
 
Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in Swift
Seyhun AKYUREK
 
Asp.net control
Asp.net controlAsp.net control
Asp.net control
Paneliya Prince
 
Oracle ADF Task Flows for Beginners
Oracle ADF Task Flows for BeginnersOracle ADF Task Flows for Beginners
Oracle ADF Task Flows for Beginners
DataNext Solutions
 
Transaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaTransaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in Java
Ersen Öztoprak
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from Flipkart
Shyam Kumar Akirala
 
Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...
Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...
Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...
Flink Forward
 
Sessionizing Uber Trips in Realtime - Flink Forward '18, Berlin
Sessionizing Uber Trips in Realtime  - Flink Forward '18, BerlinSessionizing Uber Trips in Realtime  - Flink Forward '18, Berlin
Sessionizing Uber Trips in Realtime - Flink Forward '18, Berlin
Amey Chaugule
 

Similar to Spring Web Flow (20)

Spring Web Flow Grail's Plugin
Spring Web Flow Grail's PluginSpring Web Flow Grail's Plugin
Spring Web Flow Grail's Plugin
 
Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.Spring Web Flow. A little flow of happiness.
Spring Web Flow. A little flow of happiness.
 
Silicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for ReusabilitySilicon Valley Code Camp - JSF Controller for Reusability
Silicon Valley Code Camp - JSF Controller for Reusability
 
Introduction to Srping Web Flow
Introduction to Srping Web Flow Introduction to Srping Web Flow
Introduction to Srping Web Flow
 
Web flowpresentation
Web flowpresentationWeb flowpresentation
Web flowpresentation
 
Asp dot net lifecycle in details
Asp dot net lifecycle in detailsAsp dot net lifecycle in details
Asp dot net lifecycle in details
 
Why ASP.NET Development is Important?
Why ASP.NET Development is Important?Why ASP.NET Development is Important?
Why ASP.NET Development is Important?
 
Windows Workflow Foundation
Windows Workflow FoundationWindows Workflow Foundation
Windows Workflow Foundation
 
Spring Web Webflow
Spring Web WebflowSpring Web Webflow
Spring Web Webflow
 
Asp.net life cycle in depth
Asp.net life cycle in depthAsp.net life cycle in depth
Asp.net life cycle in depth
 
Grails services
Grails servicesGrails services
Grails services
 
Discrete event-simulation
Discrete event-simulationDiscrete event-simulation
Discrete event-simulation
 
[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture[@NaukriEngineering] Flux Architecture
[@NaukriEngineering] Flux Architecture
 
Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in Swift
 
Asp.net control
Asp.net controlAsp.net control
Asp.net control
 
Oracle ADF Task Flows for Beginners
Oracle ADF Task Flows for BeginnersOracle ADF Task Flows for Beginners
Oracle ADF Task Flows for Beginners
 
Transaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaTransaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in Java
 
Flux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from FlipkartFlux - An open sourced Workflow orchestrator from Flipkart
Flux - An open sourced Workflow orchestrator from Flipkart
 
Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...
Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...
Flink Forward Berlin 2018: Amey Chaugule - "Threading Needles in a Haystack: ...
 
Sessionizing Uber Trips in Realtime - Flink Forward '18, Berlin
Sessionizing Uber Trips in Realtime  - Flink Forward '18, BerlinSessionizing Uber Trips in Realtime  - Flink Forward '18, Berlin
Sessionizing Uber Trips in Realtime - Flink Forward '18, Berlin
 

More from NexThoughts Technologies

Alexa skill
Alexa skillAlexa skill
GraalVM
GraalVMGraalVM
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
NexThoughts Technologies
 
Apache commons
Apache commonsApache commons
Apache commons
NexThoughts Technologies
 
HazelCast
HazelCastHazelCast
MySQL Pro
MySQL ProMySQL Pro
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
NexThoughts Technologies
 
Swagger
SwaggerSwagger
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
NexThoughts Technologies
 
Arango DB
Arango DBArango DB
Jython
JythonJython
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
NexThoughts Technologies
 
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
NexThoughts Technologies
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
NexThoughts Technologies
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
NexThoughts Technologies
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
NexThoughts Technologies
 
Ethereum
EthereumEthereum
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
NexThoughts Technologies
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
NexThoughts Technologies
 
Google authentication
Google authenticationGoogle authentication
Google authentication
NexThoughts Technologies
 

More from NexThoughts Technologies (20)

Alexa skill
Alexa skillAlexa skill
Alexa skill
 
GraalVM
GraalVMGraalVM
GraalVM
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Apache commons
Apache commonsApache commons
Apache commons
 
HazelCast
HazelCastHazelCast
HazelCast
 
MySQL Pro
MySQL ProMySQL Pro
MySQL Pro
 
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
 
Swagger
SwaggerSwagger
Swagger
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Arango DB
Arango DBArango DB
Arango DB
 
Jython
JythonJython
Jython
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
 
Ethereum
EthereumEthereum
Ethereum
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
Google authentication
Google authenticationGoogle authentication
Google authentication
 

Recently uploaded

How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 

Recently uploaded (20)

How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 

Spring Web Flow

  • 2. Agenda  Why Web – Flow ?  Spring Web-Flow (Basic Introduction)  Spring Web-Flow Grails Plugin  Demo
  • 3. Introduction Spring Web Flow builds on Spring MVC and allows implementing the "flows" of a web application. A flow encapsulates a sequence of steps that guide a user through the execution of some business task. It spans multiple HTTP requests, has state, deals with transactional data, is reusable. Stateful web applications with controlled navigation such as checking in for a flight, applying for a loan, shopping cart checkout and many more. These scenarios have in common is one or more of the following traits: ● There is a clear start and an end point. ● The user must go through a set of screens in a specific order. ● The changes are not finalized until the last step. ● Once complete it shouldn't be possible to repeat a transaction accidentally
  • 4. Disadvantages of MVC  Visualizing the flow is very difficult  Mixed navigation and view  Overall navigation rules complexity  All-in-one navigation storage  Lack of state control/navigation customization
  • 7. Basic Components ● Flow – A flow defined as a complete life-span of all States transitions. ● States - Within a flow stuff happens. Either the application performs some logic, the user answers a question or fills out a form, or a decision is made to determine the next step to take. The points in the flow where these things happen are known as states. Five different kinds of state: View, Active, Decision, Subflow, and End. ● Transitions - A view state, action state, or subflow state may have any number of transitions that direct them to other states. ● Flow Data - As a flow progresses, data is either collected, created, or otherwise manipulated. Depending on the scope of the data, it may be carried around for periods of time to be processed or evaluated within the flow ● Events – Events are responsible for transition in between states.
  • 8. Types of State View States : A view state displays information to a user or obtains user input using a form. (e.g. JSP.,jsf, gsp etc) Action States : Action states are where actions are perfomed by the spring beans. The action state transitions to another state. The action states generally have an evaluate property that describes what needs to be done. Decision States: A decision state has two transitions depending on whether the decision evaluates to true or false. Subflow States :It may be advantageous to call another flow from one flow to complete some steps. Passing inputs and expecting outputs. End States : The end state signifies the end of flow. If the end state is part of a root flow then the execution is ended. However, if its part of a sub flow then the root flow is resumed. Note :­ Once a flow has ended it can only be resumed from the start state, in this case  showCart, and not from any other state.
  • 9. Grails Flow Scopes Grails flows have five different scopes you can utilize: ● request - Stores an object for the scope of the current request ● flash - Stores the object for the current and next request only ● flow - Stores objects for the scope of the flow, removing them when the flow reaches an end state ● conversation - Stores objects for the scope of the conversation including the root flow and nested subflows ● session - Stores objects in the user's session
  • 11. Exception Handling ● Transition on exception on(Exception).to('error') ● Custom exception handler on(MyCustomException).to('error')
  • 12. Dependencies for Spring/Grails Spring Maven/Gradle Dependencies Maven POM <dependencies> <dependency> <groupId>org.springframework.webflow</groupId> <artifactId>spring-webflow</artifactId> <version>2.4.4.RELEASE</version> </dependency> </dependencies> Gradle dependencies { compile 'org.springframework.webflow:spring-webflow:2.4.4.RELEASE' } Grails Plugin Installation plugins{ .... compile ":webflow:2.1.0" ..... }
  • 13. Grails Web Flow Plugin How to define a flow... class BookController { def shoppingCartFlow ={ // add flow to action in Controller state { } … state { } ... } } Here, Shopping Cart will be considered as a action and will work like a flow. Note - Views are stored within a directory that matches the name of the flow: grails-app/views/book/shoppingCart. URL - localhost:8080/applicationName/book/shoppingCart
  • 14. Grails Web Flow Plugin How to define a state... def shoppingCartFlow ={ showCart { on("checkout").to "enterPersonalDetails" on("continueShopping").to "displayCatalogue" } … displayCatalogue { redirect(controller: "catalogue", action: "show") } displayInvoice() } Here, “showCart” and “displayCatelog” will be considered as a state URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
  • 15. Grails Web Flow Plugin Action State ... enterPersonalDetails { on("submit") { def p = new Person(params) flow.person = p if (!p.validate()) return error() }.to "enterShipping" on("return").to "showCart" } Here, action{....} state used to perform some action when it enters into the ShippingNeeded State URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14 enterPersonalDetails { action { //action State defined and used to perform stuffs } on("submit") .to "enterShipping" on("return").to "showCart" }
  • 16. Grails Web Flow Plugin Decision State ... shippingNeeded { action { //action State defined and used to perform stuffs if (params.shippingRequired) yes() else no() } on("yes").to "enterShipping" on("no").to "enterPayment" } Here, action{....} state used to perform some action when it enters into the ShippingNeeded State URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
  • 17. Grails Web Flow Plugin Sub-Flow State ... def extendedSearchFlow = { startExtendedSearch { on("findMore").to "searchMore" on("searchAgain").to "noResults" } searchMore { Action { ......... ........ } on("success").to "moreResults" on("error").to "noResults" } moreResults() noResults() } Here, extendedSearchFlow state used as sub-state extendedSearch { // Extended search subflow subflow(controller: "searchExtensions", action: "extendedSearch") on("moreResults").to "displayMoreResults" on("noResults").to "displayNoMoreResults" } displayMoreResults() displayNoMoreResults()
  • 18. Grails Web Flow Plugin Transition ... def shoppingCartFlow ={ showCart { on("checkout").to "enterPersonalDetails" // Transition from one flow to another on("continueShopping").to "displayCatalogue" } … displayCatalogue { redirect(controller: "catalogue", action: "show") } displayInvoice() } Here, On().to() used to transition from one state to another defined in sequence. URL - localhost:8080/applicationName/book/shoppingCart?execution=e3s14
  • 19. Grails Web Flow Plugin Take a special care... ● Once a flow has ended it can only be resumed from the start state ● Throughout the flow life-cycle each html/grails control name should be unique. ● Maintain JSessionId is maintained throughout the flow execution. ● Spring Security is checked only before entering into a flow not in between the states of executing flow ● When placing objects in flash, flow or conversation scope they must implement java.io.Serializable or an exception will be thrown ● built-in error() and success() methods. ● Any Exception class in-heirarchy or CustomException Handler Class used to handle Exceptions
  • 20. References 1. https://dzone.com/refcardz/spring-web-flow 2. http://projects.spring.io/spring-webflow/ 3. https://grails-plugins.github.io/grails-webflow-plugin/guide/ 4. https://grails.org/plugin/webflow
  • 22. Take a look aside practically Demo !!