How to create a new session for http client
To create an HttpSession object if the user is visiting the web app for the first time or fetch the session if one already exists, use the methods getSession() or getSession(true) of the HttpServletRequest objecta shown below.
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); }
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(true); }