Mapping & tracking session servlet :



Create abstract servlet BServletSession, all your servlet need to extend BServletSession for mapping specific component servlet session :

package com.jservlet.servlet.monitor;
[...]
public abstract class BServletSession extends HttpServlet
{

   /**
    * Override
method service for monitored object Session of specific User
    *
    * @exception ServletException  If a exception
    * @exception IOException       If a I/O exception
    */
    protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    {
        // session
        HttpSession session = req.getSession();

        if (session !=null)
        {
            String ip_client = session.getAttribute("USER") + "@" + req.getRemoteHost() + " (" + req.getRemoteAddr() + ")";
            session.setAttribute("CLIENT_IDENTIFICATION", ip_client);

            // object singleton monitor session...
            MonitorSession.getInstance().monitorSession((String) session.getId(), session);

        }
      
        // call super service
        super.service(req, res);
    }
} //  end BServletSession...

Now you can see all objects in session (complet ip client come from User identification client, extends this servlet...), make introspection of specific object in session of servlet engine is now easy. See servlet monitor session and object monitor session for more details :

ServletMonitorSession.java
MonitorSession.java