Contents

Image Foreword

Image About the Authors

Image About the Technical Reviewer

Image Acknowledgments

Image Introduction

Image Chapter 1: Configuring a Spring Development Environment

Prerequisites

Java Development Kit

Servlet Container

Integrated Development Environment

The Sample Application

A Bookstore Sample Application

The Build System

Building the Sample Application

Deploying the Sample Application

SpringSource Tool Suite (STS)

Configuring STS for Gradle projects

Importing the Sample into STS

Running the Application on the SpringSource vFabric tc Server

Editing the Application

Summary

Image Chapter 2: Spring Framework Fundamentals

The Spring Framework

Dependency Injection

ApplicationContexts

Resource Loading

Component-Scanning

Scopes

Profiles

Enabling Features

Aspect-Oriented Programming

Web Applications

Summary

Image Chapter 3: Web Application Architecture

The MVC Pattern

Application Layering

Separation of Concerns

Spring MVC Application Layers

The Domain Layer

The User Interface Layer

The Web Layer

The Service Layer

The Data Access Layer

More Roads to Rome

Summary

Image Chapter 4: Spring MVC Architecture

DispatcherServlet Request Processing Workflow

The Workflow

The Request Processing Summary

The DispatcherServlet

Bootstrapping the DispatcherServlet

Configuring the DispatcherServlet

The Spring MVC Components

HandlerMapping

HandlerAdapter

MultipartResolver

LocaleResolver

ThemeResolver

HandlerExceptionResolver

RequestToViewNameTranslator

ViewResolver

FlashMapManager

Summary

Image Chapter 5: Implementing Controllers

Introducing Controllers

Interface-based Controllers

Annotation-based Controllers

Configuring View Controllers

Request-Handling Methods

Supported Method Argument Types

Supported Method Argument Annotations

Supported Method Return Values

Writing Annotation-based Controllers

A Simple Login Controller

Book Search Page

Book Detail Page

Data Binding

Customizing Data Binding

Per Controller Customization

ModelAttributes

Type Conversion

Validating Model Attributes

Internationalization

Message Source

LocaleResolver

LocaleChangeInterceptor

Summary

Image Chapter 6: Implementing Controllers — Advanced

Using Scoped Beans

Adding Something to the Cart

Implementing the Checkout

Crosscutting Concerns

Interceptors

Exception Handling

SimpleMappingExceptionResolver

Extending Spring @MVC

Extending RequestMappingHandlerMapping

Extending the RequestMappingHandlerAdapter

Using the RequestDataValueProcessor

Summary

Image Chapter 7: REST and AJAX

Representational State Transfer (REST)

Identifying Resources

Working with Resources

Asynchronous JavaScript and XML (AJAX)

Adding AJAX to Our Application

Combining AJAX and REST

Progressive Enhancement

Handling File Uploads

Configuration

Request Handling Method for File Upload

Exception Handling

Summary

Image Chapter 8: Resolving and Implementing Views

View Resolvers and Views

View Resolvers

BeanNameViewResolver

XmlViewResolver

ResourceBundleViewResolver

UrlBasedViewResolver

InternalResourceViewResolver

XsltViewResolver

ContentNegotiatingViewResolver

Implementing Your Own ViewResolver

View Technologies

Java Server Pages

JavaServer Faces

Tiles

Velocity and FreeMarker

PDF

Excel

XML and JSON

JasperReports

Summary

Image Chapter 9: Testing Spring MVC Applications

Introducing Testing

Why Should I Bother Writing Tests?

Promoting Testing Within Your Project

Different Types of Testing

Setting Up a Basic Unit Test

Testing Code Coverage

Using Spring’s Test Support

Setting Up Our Integration Test

Testing the JpaBookRepository

Using Mock Objects

What Are Mock Objects?

Testing the AccountService

Testing Your MVC Logic

Using Spring Mock Objects

Introducing Spring MVC Test

Automated Front-End Testing

Front-End Testing Using Selenium

Writing a Selenium Test

Using the Selenium IDE

Running the Front-End Tests via Gradle

Summary

Image Chapter 10: Spring Web Flow

Why Web Flow

The Flow Concept

Fine-Grained Scoping

Automatic State Management

Request Synchronization

Post Redirect Get (PRG)

Controlled Navigation

When to Avoid Web Flow

The Basic Ingredients of a Flow

Flow

The View State

State Transitions

The Evaluate Action

Expressions

Configuration

Dependencies

Web Flow Configuration

Gluing Spring MVC and Spring Web Flow

Building Your First Flow

Creating the Home Page

Implementing the Create Order Flow

Overview

Summary

Image Chapter 11: Building Applications with Spring Web Flow

Important Web Flow Concepts

Flow Definition

Different Web Flow Scopes

Implicit Objects

Enhancing the Bookstore

Selecting the Category

Selecting Books and Delivery Options

Form Validation Using JSR 303 Annotations

Setting Variables and Accessing Scopes

Flow Variables

Accessing Scoped Variables from Views

Programmatically Accessing Scopes

Controlling Action Execution

<on-start>

<on-end>

<on-entry>

<on-exit>

<on-render>

Controlling Action Execution: Sub-elements

Global Transitions

Subflows

Further Enhancing the Bookstore

Implementing Authentication as a Subflow

Decision State

Action State

Working with Outcome Events

Overview

Subflow Input/Output Mapping

Creating the Order Process as a Subflow

End State

Summary

Image Chapter 12: Advanced Spring Web Flow

Inheritance

Flow Inheritance

State Inheritance

Web Flow Configuration Customizations

Execution and Conversation Snapshots

Changing the Expression Parser

Web Flow 1 Migration

Exception Handling

The On Exception Transition

Custom Exception Handler

Explicit Form Binding

Web Flow AJAX Support

Configuring Web Flow for AJAX

Preparing the View

Adjusting the Flow

Adding AJAX to the View with Spring JS and JQuery

Flow Execution Listeners

Writing Flow Execution Listeners

Flow Execution Listener Methods

Flow Managed Persistence Context

From Database to View

Prolonging the Persistence Context

Applying Flow Managed Persistence Context

Reworking the Orders Overview

Summary

Image Chapter 13: Spring Security

Introducing Security

What Is Application Security?

General Security Principles

What We Will Cover

Preparing the Example Application

Securing Our Bookstore

Adding the Right Dependencies

Enabling Spring Security

Defining Which Resources to Secure

Configuring Access to Resources

Configuring Authentication

Putting It All Together

The Complete Security Configuration

Going to the Database

Securing Our Flows, the Right Way

Adding Access Attributes to Your Flows

Configuring the SecurityFlowExecutionListener

Transport Security

Localization

Role-Based Access Control

Authorizing Access

Using Tag Libraries in Our Pages

Using Annotations in Our Code

Summary

Image Appendix A: Cloud Foundry: Deploying to the Cloud

Cloud Computing

Cloud Foundry

Deploying Our Application

Installing the Cloud Foundry Plug-in

Making Some Adjustments

Deploying

Configuring the Services

How Does It Work?

Other Configuration Options

Deploying Locally

Debugging with Cloud Foundry

Summary

Image Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset