Java Apache httpclient interceptor for Spring MVC Configuration

import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.springframework.web.servlet.HandlerInterceptor;import org.springframework.web.servlet.ModelAndView;import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;public class SecurityWebInterceptor extends HandlerInterceptorAdapter {@Overridepublic boolean preHandle(HttpServletRequest requestServlet, HttpServletResponse responseServlet, Object handler) throws Exception{System.out.println("MINIMAL: INTERCEPTOR PREHANDLE CALLED");return true;}@Overridepublic void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception{System.out.println("MINIMAL: INTERCEPTOR POSTHANDLE CALLED");}@Overridepublic void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception exception) throws Exception{System.out.println("MINIMAL: INTERCEPTOR AFTERCOMPLETION CALLED");}}
public class WebConfiguration implements WebMvcConfigurer {

...
@Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new SecurityWebInterceptor()); } ...}

--

--

--

If you like my work or have question contact me.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

PTGui and PTGui Pro: What’s the Difference? (Infographic Included)

Day 06: Tip of the Day Pseudocode

Cucumber BDD (Part 1): Starting with Feature Mapping

Introduction to Monitoring with Prometheus

What’s Tailwind CSS?

What’s Tailwind CSS?

Migrating Hive ACID tables to BigQuery

Introduction to FragFlow

First Day of Programming Class

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Walter-Tscharf-Development

Walter-Tscharf-Development

If you like my work or have question contact me.

More from Medium

Exceptions Handling in Java..

Nested ,Inner Classes

Collections in Java

Reactive Revolution — RSocket