boolean write_db = false;
Cookie u_cookie = RequestUtils.getCookie(request, KEY_COOKIE);
String ident = getSiteIdAsString(site);
if(u_cookie == null){
//����Cookie��Ч�ڵ��������
Calendar t = Calendar.getInstance();
t.add(Calendar.DATE, 1);
DateUtils.resetTime(t);
int maxAge = (int)(t.getTime().getTime()-System.currentTimeMillis()) / 1000;
RequestUtils.setCookie(request, response, KEY_COOKIE, ident, maxAge);
write_db = true;
}
else{
String cookie_value = u_cookie.getValue();
if(cookie_value.indexOf(ident)<0){
//����Cookie��Ч�ڵ��������
Calendar t = Calendar.getInstance();
t.add(Calendar.DATE, 1);
DateUtils.resetTime(t);
int maxAge = (int)(t.getTime().getTime()-System.currentTimeMillis()) / 1000;
//����Cookie
RequestUtils.setCookie(request, response, KEY_COOKIE, cookie_value+ident, maxAge);
write_db = true;
}
}