From 923b2e1826dd2b974eabe2263a579a3dd16c82f5 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Wed, 20 Jul 2016 22:35:56 +0200 Subject: [PATCH] Spring JPA: Username HTTP Handler --- .../main/java/de/spring/example/rest/handler/UsernameHandler.java | 7 +++++++ 1 file changed, 7 insertions(+) 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(); + } } -- 2.1.4