/** * Logout a Trade User Dispatch to the Trade Welcome JSP for display * * @param userID The User to logout * @param ctx the servlet context * @param req the HttpRequest object * @param resp the HttpResponse object * @param results A short description of the results/success of this web request provided on the * web page * @exception javax.servlet.ServletException If a servlet specific exception is encountered * @exception javax.io.IOException If an exception occurs while writing results back to the user */ void doLogout(ServletContext ctx, HttpServletRequest req, HttpServletResponse resp, String userID) throws ServletException, IOException { String results = ""; try { tAction.logout(userID); } catch (java.lang.IllegalArgumentException e) { // this is a user error so I will // forward them to another page, at the end of the page. req.setAttribute("results", results + "illegal argument:" + e.getMessage()); // log the exception with an error level of 3 which means, handled exception but would // invalidate a automation run Log.error( e, "TradeServletAction.doLogout(...)", "illegal argument, information should be in exception string", "treating this as a user error and forwarding on to a new page"); } catch (Exception e) { // log the exception and foward to a error page Log.error( e, "TradeServletAction.doLogout(...):", "Error logging out" + userID, "fowarding to an error page"); // set the status_code to 500 throw new ServletException( "TradeServletAction.doLogout(...)" + "exception logging out user " + userID, e); } HttpSession session = req.getSession(); if (session != null) { session.invalidate(); } Object o = req.getAttribute("TSS-RecreateSessionInLogout"); if (o != null && ((Boolean) o).equals(Boolean.TRUE)) { // Recreate Session object before writing output to the response // Once the response headers are written back to the client the opportunity // to create a new session in this request may be lost // This is to handle only the TradeScenarioServlet case session = req.getSession(true); } requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.WELCOME_PAGE)); }