Spring JPA: Username HTTP Handler
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 20 Jul 2016 20:35:56 +0000 (22:35 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 20 Jul 2016 20:35:56 +0000 (22:35 +0200)
SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/handler/UsernameHandler.java

index 9878f3d..55d99b6 100644 (file)
@@ -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();
+       }
 }