From: Gustavo Martin Morcuende Date: Wed, 20 Jul 2016 20:35:56 +0000 (+0200) Subject: Spring JPA: Username HTTP Handler X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=923b2e1826dd2b974eabe2263a579a3dd16c82f5;p=JavaForFun Spring JPA: Username HTTP Handler --- diff --git a/SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/handler/UsernameHandler.java b/SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/handler/UsernameHandler.java index 9878f3d..55d99b6 100644 --- a/SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/handler/UsernameHandler.java +++ b/SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/handler/UsernameHandler.java @@ -29,4 +29,11 @@ public class UsernameHandler extends HandlerInterceptorAdapter { return super.preHandle(request, response, handler); } + + @Override + public void afterCompletion( + HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) + throws Exception { + usernameThreadContext.clearUsername(); + } }