Exploring handler mappings and interceptors

In the version before Spring 2.5 (before there was support for annotations), the mapping between a URL and a controller (also called a handler) was expressed using something called a handler mapping. It is almost a historical fact today. The use of annotations eliminated the need for explicit handler mapping.

HandlerInterceptors can be used to intercept requests to handlers (or controllers). Sometimes, you would want to do some processing before and after a request. You might want to log the content of the request and response, or you might want to find out how much time a specific request took.

There are two steps in creating HandlerInterceptor:

  1. Define the HandlerInterceptor.
  2. Map the HandlerInterceptor to the specific handlers to be intercepted.

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

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