Cookie c = new Cookie("ZM_AUTH_TOKEN", authToken); c.setPath("/"); c.setMaxAge(lifetime); resp.addCookie(c);
String authCookieVal = getCookieValue(req, "ZM_AUTH_TOKEN"); if (authCookieVal == null) { Cookie c = new Cookie("ZM_AUTH_TOKEN", authToken); c.setPath("/"); c.setMaxAge(lifetime); resp.addCookie(c); }
    public void doPost (HttpServletRequest req, HttpServletResponse resp) {                try {            String authToken = getReqParameter(req, PARAM_AUTH_TOKEN);            if (authToken == null) {                resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);                return;            } else {                String atl = getReqParameter(req, PARAM_AUTH_TOKEN_LIFETIME);                String publicComputer = getReqParameter(req,                                                        PARAM_PUBLIC_COMPUTER);                boolean isPublic = false;                if (publicComputer != null) {                    isPublic = new Boolean(publicComputer).booleanValue();                }                int lifetime = -1;                if (!isPublic){                    try {                        int lifetimeMs = Integer.parseInt(atl);                        lifetime = lifetimeMs / 1000;                    } catch (NumberFormatException ne){                        lifetime = -1;                    }                }                Cookie c = new Cookie("ZM_AUTH_TOKEN", authToken);                c.setPath("/");                c.setMaxAge(lifetime);                                resp.addCookie(c);            }                        String host = req.getHeader(HEADER_HOST);            String referer = req.getHeader(HEADER_REFERER);            //System.out.println("Host == " + host + " referer = " + referer);            boolean abs = true;            if (!shouldRedirectUrl(req) && referer != null && (referer.matches("[^/]*//" + host + "/.*")) ) {                abs = false;            } else {                abs = true;            }            String redirectTo = getRedirectUrl(req, redirectLocation, null,                                                abs, true);            //System.out.println("RedirectTo = " + redirectTo);                        resp.sendRedirect(redirectTo);        } catch (IOException ie) {	    // do nothing        } catch (IllegalStateException is){	    // do nothing        } catch (Exception ex) {            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);            ex.printStackTrace ();        }    }    