Home Page Icon
Home Page
Table of Contents for
Mastering Spring MVC 4
Close
Mastering Spring MVC 4
by Geoffroy Warin
Mastering Spring MVC 4
Mastering Spring MVC 4
Table of Contents
Mastering Spring MVC 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Setting Up a Spring Web Application in No Time
Getting started with Spring Tool Suite
Getting started with IntelliJ
Getting started with start.Spring.io
Getting started with the command line
Let's get started
The Gradle build
Let me see the code!
Spring Boot behind the curtains
The dispatcher and multipart configuration
The view resolver, static resources, and locale configuration
Error and encoding configuration
Embedded Servlet container (Tomcat) configuration
The HTTP port
The SSL configuration
Other configurations
Summary
2. Mastering the MVC Architecture
The MVC architecture
MVC critics and best practices
Anemic Domain Model
Learning from the sources
Spring MVC 1-0-1
Using Thymeleaf
Our first page
Spring MVC architecture
DispatcherServlet
Passing data to the view
Spring Expression Language
Getting data with a request parameter
Enough Hello Worlds, let's fetch tweets!
Registering your application
Setting up Spring Social Twitter
Accessing Twitter
Java 8 streams and lambdas
Material design with WebJars
Using layouts
Navigation
The check point
Summary
3. Handling Forms and Complex URL Mapping
The profile page – a form
Validation
Customize validation messages
Custom annotation for validation
Internationalization
Changing the locale
Translating the application text
A list in a form
Client validation
The check point
Summary
4. File Upload and Error Handling
Uploading a file
Writing an image to the response
Managing upload properties
Displaying the uploaded picture
Handling file upload errors
Translating the error messages
Placing the profile in a session
Custom error pages
URL mapping with matrix variables
Putting it together
The check point
Summary
5. Crafting a RESTful Application
What is REST?
Richardson's maturity model
Level 0 – HTTP
Level 1 – Resources
Level 2 – HTTP verbs
Level 3 – Hypermedia controls
API versioning
Useful HTTP codes
Client is the king
Debugging a RESTful API
A JSON formatting extension
A RESTful client in your browser
httpie
Customizing the JSON output
A user management API
Status codes and exception handling
Status code with ResponseEntity
Status codes with exceptions
Documentation with Swagger
Generating XML
The check point
Summary
6. Securing Your Application
Basic authentication
Authorized users
Authorized URLs
Thymeleaf security tags
The login form
Twitter authentication
Setting up social authentication
Explanation
Distributed sessions
SSL
Generating a self-signed certificate
The easy way
The dual way
Behind a secured server
The check point
Summary
7. Leaving Nothing to Luck – Unit Tests and Acceptance Tests
Why should I test my code?
How should I test my code?
Test-driven development
The unit tests
The right tools for the job
The acceptance tests
Our first unit test
Mocks and stubs
Mocking with Mockito
Stubbing our beans while testing
Should I use mocks or stubs?
Unit testing REST controllers
Testing the authentication
Writing acceptance tests
The Gradle configuration
Our first FluentLenium test
Page Objects with FluentLenium
Making our tests more Groovy
Unit tests with Spock
Integration tests with Geb
Page Objects with Geb
The check point
Summary
8. Optimizing Your Requests
A production profile
Gzipping
Cache control
Application cache
Cache invalidation
Distributed cache
Async methods
ETags
WebSockets
The check point
Summary
9. Deploying Your Web Application to the Cloud
Choosing your host
Cloud Foundry
OpenShift
Heroku
Deploying your web application to Pivotal Web Services
Installing the Cloud Foundry CLI tools
Assembling the application
Activating Redis
Deploying your web application on Heroku
Installing the tools
Setting up the application
Gradle
Procfile
A Heroku profile
Running your application
Activating Redis
Improving your application
Summary
10. Beyond Spring Web
The Spring ecosystem
Core
Execution
Data
Other noteworthy projects
The deployment
Docker
Single Page Applications
The players
The future
Going stateless
Summary
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Table of Contents
Next
Next Chapter
Mastering Spring MVC 4
Mastering Spring MVC 4
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset