Pro Spring MVC. Marten Deinum Koen Serneels. With Web Flow. Spring Web Flow project founder. Foreword by Erwin Vervaet,

Similar documents
Index. Combined lifecycle strategy, annotation, 93 ContentNegotiatingViewResolver, 78

"Charting the Course... SharePoint 2007 Hands-On Labs Course Summary

Java EE 6: Develop Web Applications with JSF

Fast Track to Spring 3 and Spring MVC / Web Flow

object/relational persistence What is persistence? 5

Java Advance Frameworks

"Charting the Course... MOC A: Developing with the SharePoint Framework. Course Summary

Adobe Experience Manager

Table of Contents. Introduction... xxi

Struts: Struts 1.x. Introduction. Enterprise Application

"Charting the Course... MOC A Introduction to Web Development with Microsoft Visual Studio Course Summary

Mastering Spring MVC 3

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

1.2 Wicket in a nutshell 10 Just Java 11 Just HTML 12 The right abstractions 13

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

Distributed Applications Spring MVC 2.5

Introduction to PTC Windchill ProjectLink 11.0

Beginning Groovy, Grails and Griffon. Vishal Layka Christopher M. Judd Joseph Faisal Nusairat Jim Shingler

JVA-117A. Spring-MVC Web Applications

> Dmitry Sklyut > Matt Swartley. Copyright 2005 Chariot Solutions

Developing Applications with Java EE 6 on WebLogic Server 12c

Introduction to Spring Framework: Hibernate, Spring MVC & REST

1 CUSTOM TAG FUNDAMENTALS PREFACE... xiii. ACKNOWLEDGMENTS... xix. Using Custom Tags The JSP File 5. Defining Custom Tags The TLD 6

TABLE OF CONTENTS CHAPTER TITLE PAGE

Introduction to Spring Framework: Hibernate, Web MVC & REST

foreword xvii preface xix acknowledgments xxi about this book xxiv about the title xxviii about the cover illustration

IN PRACTICE. Daniele Bochicchio Stefano Mostarda Marco De Sanctis. Includes 106 practical techniques MANNING

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

Pro ASP.NET MVC 2 Framework

Spring MVC. PA 165, Lecture 8. Martin Kuba

Spring & Hibernate. Knowledge of database. And basic Knowledge of web application development. Module 1: Spring Basics

Application Development

Building Spring 2 Enterprise Applications

Spring Web Flow Reference Guide

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

Spring Persistence. with Hibernate PAUL TEPPER FISHER BRIAN D. MURPHY

"Charting the Course... WebSphere Portal 8 Development using Rational Application Developer 8.5. Course Summary

ADVANCED JAVA COURSE CURRICULUM

"Charting the Course... Comprehensive Angular. Course Summary

Full Stack Web Developer

"Charting the Course... Agile Database Design Techniques Course Summary

Contents at a Glance

Excel Programming with VBA (Macro Programming) 24 hours Getting Started

"Charting the Course... Java Programming Language. Course Summary

Business Component Development with EJB Technology, Java EE 5

Session 25. Spring Controller. Reading & Reference

The Java EE 6 Tutorial

The Definitive Guide to. NetBeans Platform 7. Heiko Bock. Apress*

Introduction to Spring 5, Spring MVC and Spring REST

Architect Exam Guide. OCM EE 6 Enterprise. (Exams IZO-807,1ZO-865 & IZO-866) Oracle Press ORACLG. Paul R* Allen and Joseph J.

Specialized - Mastering Spring 4.2

"Charting the Course... MOC B Developing Microsoft SharePoint Server 2013 Core Solutions. Course Summary

Java.. servlets and. murach's TRAINING & REFERENCE 2ND EDITION. Joel Murach Andrea Steelman. IlB MIKE MURACH & ASSOCIATES, INC.

Call: Core&Advanced Java Springframeworks Course Content:35-40hours Course Outline

Mathematics Shape and Space: Polygon Angles

Configuring BGP on Cisco Routers Volume 1

Desarrollo de Aplicaciones Web Empresariales con Spring 4

Remote Health Service System based on Struts2 and Hibernate

SECTION I: ALL ABOUT STRUTS2 FRAMEWORK 1. FUNDAMENTALS OF STRUTS AND STRUTS2...

RESTful Java with JAX-RS

COPYRIGHTED MATERIAL

Whom Is This Book For?... xxiv How Is This Book Organized?... xxiv Additional Resources... xxvi

Java Programming Language

Oracle Fusion Middleware 11g: Build Applications with ADF I

Call: JSP Spring Hibernate Webservice Course Content:35-40hours Course Outline

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

This Document is intended as a user guide for providers who are planning to use the eligibility check system.

JVA-117E. Developing RESTful Services with Spring

Java J Course Outline

Web Application Development Using Spring, Hibernate and JPA

Web Application Development Using Spring, Hibernate and JPA

Flask Web Development Course Catalog

Django with Python Course Catalog

Improve and Expand JavaServer Faces Technology with JBoss Seam

Course Outline. ProTech Professional Technical Services, Inc. Veritas Backup Exec 20.1: Administration. Course Summary.

Spring Web Flow Reference Guide

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

Web Application Development Using Spring, Hibernate and JPA

Beginning ASP.NET. 4.5 in C# Matthew MacDonald

2.) ilit Welcome Screen

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

JVA-163. Enterprise JavaBeans

JAVA MICROSERVICES. Java Language Environment. Java Set Up. Java Fundamentals. Packages. Operations

Pro Angular 6. Third Edition. Adam Freeman

Introduction to Windchill PDMLink 10.2 for the Implementation Team

CITY UNIVERSITY OF NEW YORK. Creating a New Project in IRBNet. i. After logging in, click Create New Project on left side of the page.

Oracle Fusion Middleware 11g: Build Applications with ADF I

Restlet in Action. Developing RESTful web APIs injava JEROME LOUVEL MANNING THIERRY TEMPLIER THIERRY BOILEAU. Shelter Island

Installing and Administering a Satellite Environment

Automation through Chef Opscode

Open Source Library Developer & IT Pro

Oracle Fusion Middleware 11g: Build Applications with ADF Accel

Lesson 1: Hello ios! 1

JAVA. 1. Introduction to JAVA

Acknowledgments Introduction. Part I: Programming Access Applications 1. Chapter 1: Overview of Programming for Access 3

Full Stack Web Developer

Acknowledgments Introduction. Chapter 1: Introduction to Access 2007 VBA 1. The Visual Basic Editor 18. Testing Phase 24

What s new in Spring Web Flow 2.0

Transcription:

Pro Spring MVC With Web Flow Marten Deinum Koen Serneels with Colin Yates, Seth Ladd, and Christophe Vanfleteren Foreword by Erwin Vervaet, Spring Web Flow project founder

Contents Foreword About the Authors About the Technical Reviewer Acknowledgments xvi xviii xx xxi 8 Introduction xxiii «Chapter 1: Configuring a Spring Development Environment 1 Prerequisites 1 Java Development Kit 2 Servlet Container 2 Integrated Development Environment 2 The Sample Application 2 A Bookstore Sample Application 3 The Build System 4 Building the Sample Application 6 Deploying the Sample Application 8 SpringSource Tool Suite (STS) 10 Configuring STS for Gradle projects 10 Importing the Sample into STS 12 Running the Application on the SpringSource vfabric tc Server 17 Editing the Application 19 Summary 22 V

CONTENTS a Chapter 2: Spring Framework Fundamentals 25 The Spring Framework 25 Dependency Injection 29 ApplicationContexts 34 Resource Loading 38 Component-Scanning 40 Scopes 41 Profiles 41 Enabling Features 44 Aspect-Oriented Programming 45 Web Applications 47 Summary 50 Chapter 3: Web Application Architecture 51 The MVC Pattern, 51 Application Layering 53 Separation of Concerns 56 Spring MVC Application Layers 56 The Domain Layer 56 The User Interface Layer 57 The Web Layer 58 The Service Layer 59 The Data Access Layer 62 More Roads to Rome 63 Summary 64 Chapter 4: Spring MVC Architecture 65 DispatcherServlet Request Processing Workflow 65 The Workflow 66 vi

CONTENTS The Request Processing Summary 73 The DispatcherServlet 74 Bootstrapping the DispatcherServlet 74 Configuring the DispatcherServlet 78 The Spring MVC Components 88 HandlerMapping 88 HandlerAdapter 94 MultipartResolver 96 LocaleResolver 97 ThemeResolver 99 HandlerExceptionResolver 101 RequestToViewNameTranslator 102 ViewResolver 103 FlashMapManager 104 Summary 105 i Chapter 5: Implementing Controllers 107 Introducing Controllers 107 Interface-based Controllers 108 Annotation-based Controllers 110 Configuring View Controllers 111 Request-Handling Methods 112 Supported Method Argument Types 115 Supported Method Argument Annotations 118 Supported Method Return Values 123 Writing Annotation-based Controllers 125 A Simple Login Controller 125 Book Search Page 130 Book Detail Page 133 vii

CONTENTS Data Binding 136 Customizing Data Binding 137 Per Controller Customization 139 ModelAttributes 141 Type Conversion 148 Validating Model Attributes 162 Internationalization 170 Message Source 170 LocaleResolver 172 LocaleChangelnterceptor 172 Summary 176 Chapter 6: Implementing Controllers Advanced 177 Using Scoped Beans 177 Adding Something to the Cart 178 Implementing the Checkout 183 Crosscutting Concerns 185 Interceptors 186 Exception Handling 197 SimpleMappingExceptionResolver 201 Extending Spring @MVC 205 Extending RequestMappingHandlerMapping 205 Extending the RequestMappingHandlerAdapter 207 Using the RequestDataValueProcessor 212 Summary 213 Chapter 7: REST and AJAX 215 Representational State Transfer (REST) 215 Identifying Resources 215 viii

CONTENTS Working with Resources 216 Asynchronous JavaScript and XML (AJAX) 220 Adding AJAX to Our Application 221 Combining AJAX and REST 226 Progressive Enhancement 227 Handling File Uploads 228 Configuration 228 Request Handling Method for File Upload 231 Exception Handling 235 Summary 235 Chapter 8: Resolving and Implementing Views 237 View Resolvers and Views 237 View Resolvers 238 BeanNameViewResolver 239 XmlViewResolver 240 ResourceBundleViewResolver 241 UrIBasedViewResolver 243 InternalResourceViewResolver 245 XsltViewResolver 245 ContentNegotiatingViewResolver 246 Implementing Your Own ViewResolver 247 View Technologies 248 Java Server Pages.249 JavaServer Faces 249 Tiles 250 Velocity and FreeMarker 254 PDF 263 Excel 265 ix

«CONTENTS Selecting the Category 381 Selecting Books and Delivery Options 387 Form Validation Using JSR 303 Annotations 388 Setting Variables and Accessing Scopes 400 Flow Variables 401 Accessing Scoped Variables from Views 402 Programmatically Accessing Scopes 402 Controlling Action Execution 404 <on-start> 404 <on-end> 404 <on-entry> 404 <on-exit> 405 <on-render> 405 Controlling Action Execution: Sub-elements 405 Global Transitions 406 Subflows 406 Further Enhancing the Bookstore 408 Implementing Authentication as a Subflow 410 Decision State 416 Action State 417 Working with Outcome Events 419 Overview 420 Subflow Input/Output Mapping 421 Creating the Order Process as a Subflow 423 End State 425 Summary 427 xii

* CONTENTS Chapter 12: Advanced Spring Web Flow 429 Inheritance 429 Flow Inheritance 430 State Inheritance 434 Web Flow Configuration Customizations 434 Execution and Conversation Snapshots 435 Changing the Expression Parser 436 Web Flow 1 Migration 437 Exception Handling 439 The On Exception Transition 439 Custom Exception Handler 440 Explicit Form Binding 443 Web Flow AJAX Support 445 Configuring Web Flow for AJAX 447 Preparing the View 447 Adjusting the Flow 453 Adding AJAX to the View with Spring JS and JQuery 454 Flow Execution Listeners 459 Writing Flow Execution Listeners 459 Flow Execution Listener Methods 460 Flow Managed Persistence Context 463 From Database to View 463 Prolonging the Persistence Context 465 Applying Flow Managed Persistence Context 466 Reworking the Orders Overview 468 Summary 475 xiii

S CONTENTS Chapter 13: Spring Security 477 Introducing Security 478 What Is Application Security? 478 General Security Principles 478 What We Will Cover 479 Preparing the Example Application.. 480 Securing Our Bookstore 482 Adding the Right Dependencies 482 Enabling Spring Security 484 Defining Which Resources to Secure 489 Configuring Access to Resources 490 Configuring Authentication, 494 Putting It All Together 497 The Complete Security Configuration 503 Going to the Database 504 Securing Our Flows, the Right Way 506 Adding Access Attributes to Your Flows 507 Configuring the SecurityFlowExecutionListener 508 Transport Security 510 Localization 516 Role-Based Access Control 517 Authorizing Access 523 Using Tag Libraries in Our Pages 523 Using Annotations in Our Code 531 Summary 533 Appendix: Cloud Foundry: Deploying to the Cloud 535 Cloud Computing 535 xiv

m CONTENTS Cloud Foundry 536 Deploying Our Application 537 Installing the Cloud Foundry Plug-in 537 Making Some Adjustments 538 Deploying 544 Configuring the Services 547 How Does It Work? 551 Other Configuration Options 551 Deploying Locally 552 Debugging with Cloud Foundry 552 Summary 554 Index 555 XV