/** Show appropriate order page. */ @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServletContext sc = getServletContext(); Connection conn = (Connection) sc.getAttribute("dbConnection"); HttpSession session = request.getSession(); synchronized (session) { LoginSession ls = (LoginSession) session.getAttribute("loginSession"); if (ls == null) { return; } Basket basket = ls.getUser().getBasket(); // If there is no basket, do nothing if (basket == null) { return; } if (request.getParameter("dialog").equals("yes")) { String msg = null; Order order = null; try { order = new Order(); msg = order.form(basket, conn); } catch (SQLException exc) { request.setAttribute("sqlExc", exc); request.getRequestDispatcher("/error").forward(request, response); return; } // If there is a message (that means can't form an order) if (msg != null) { request.setAttribute("errMsg", msg); } } if (request.getParameter("dialog").equals("show")) { request.setAttribute("itemList", basket.getItemList()); } request.setAttribute("url", request.getRequestURI()); request.getRequestDispatcher("/WEB-INF/OrderVerified.jsp").forward(request, response); } }
public void run() { OfxRequest req = session.newRequest(); AccountInfoMsgReq acctReq = new AccountInfoMsgReq(); acctReq.acctListAge = session.profile.acctListAge; req.addRequest(acctReq); List<OfxMessageResp> response; try { response = req.submit(this); for (OfxMessageResp resp : response) { if (resp instanceof AccountInfoMsgResp) { AccountInfoMsgResp acctResp = (AccountInfoMsgResp) resp; session.profile.acctListAge = acctResp.acctListAge; accountList = acctResp.accounts; } } } catch (HttpResponseException e) { sendExceptionMsg(QH_ERR_STATUS, e); } catch (OfxError e) { sendExceptionMsg(QH_ERR_OFX, e); } catch (XmlPullParserException e) { sendExceptionMsg(QH_ERR_PARSE, e); } catch (SSLPeerUnverifiedException e) { sendExceptionMsg(QH_ERR_SSL_VERIFY, e); } catch (ClientProtocolException e) { sendExceptionMsg(QH_ERR_HTTP, e); } catch (ConnectException e) { sendExceptionMsg(QH_ERR_TIMEOUT, e); } catch (SocketException e) { sendExceptionMsg(QH_ERR_CONN, e); } catch (SSLException e) { sendExceptionMsg(QH_ERR_SSL, e); } catch (Exception e) { sendExceptionMsg(QH_ERR, e); } ProfileTable db = new ProfileTable(this); try { db.openWritable(); db.syncAccounts(session, accountList); } catch (SQLiteException e) { sendExceptionMsg(QH_ERR, e); } finally { db.close(); } queryHandler.sendEmptyMessage(QH_OK); }