//force creation of new session HttpSession session = req.getSession(true); //get session if active, return null otherwise HttpSession session = req.getSession(false);