Quantcast
Channel: J2EE
Viewing all articles
Browse latest Browse all 15

Servlet Filter - Redirect Session Timeout

$
0
0

Use the following to code to override the doFilter method, which redirects to login page on session timeout. The web.xml should be configured to use this filter.

        publicvoid doFilter(ServletRequest request, ServletResponse response, FilterChain chain)throwsIOException,
                        ServletException
        {
               
               
                String ipAddress = request.getRemoteAddr();
               
                System.out.println("IP "+ ipAddress +", Time "+newDate().toString());

                boolean authorized =false;
                String username =null;
                String role =null;
                if(request instanceof HttpServletRequest)
                {

Viewing all articles
Browse latest Browse all 15

Latest Images

Trending Articles





Latest Images