/* ------------------------------------------------------------ */ protected void onResponseHeader(Buffer name, Buffer value) throws IOException { super.onResponseHeader(name, value); if (HttpHeaders.CACHE.getOrdinal(name) == HttpHeaders.SET_COOKIE_ORDINAL) { String cname = null; String cvalue = null; QuotedStringTokenizer tok = new QuotedStringTokenizer(value.toString(), "=;", false, false); tok.setSingle(false); if (tok.hasMoreElements()) cname = tok.nextToken(); if (tok.hasMoreElements()) cvalue = tok.nextToken(); Cookie cookie = new Cookie(cname, cvalue); while (tok.hasMoreTokens()) { String token = tok.nextToken(); if ("Version".equalsIgnoreCase(token)) cookie.setVersion(Integer.parseInt(tok.nextToken())); else if ("Comment".equalsIgnoreCase(token)) cookie.setComment(tok.nextToken()); else if ("Path".equalsIgnoreCase(token)) cookie.setPath(tok.nextToken()); else if ("Domain".equalsIgnoreCase(token)) cookie.setDomain(tok.nextToken()); else if ("Expires".equalsIgnoreCase(token)) { tok.nextToken(); // TODO } else if ("Max-Age".equalsIgnoreCase(token)) { tok.nextToken(); // TODO } else if ("Secure".equalsIgnoreCase(token)) cookie.setSecure(true); } BayeuxClient.this.setCookie(cookie); } }