@Override
    public void postHandle(HttpServletRequest httpServletRequest,
                           HttpServletResponse httpServletResponse,
                           Object obj, ModelAndView modelAndView)
            throws Exception {
        // Add the current user into the request
        User currentUser = userService.getCurrentUser();
        if (currentUser != null) {
            httpServletRequest.setAttribute("currentUser", currentUser);
        }
    }
A Spring MVC interceptor that adds the currentUser into the request as a request attribute
before the JSP is rendered.  This operation is assumed to be fast because the User should be
cached in the Hibernate second-level cache.
samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/web/CurrentUserInterceptor.java