gwt-ext

一,gwt-ext的cookie实现

//获取cookie管理器
public static CookieProvider getCookieProvider(){
CookieProviderConfig cookieConfig = new CookieProviderConfig();
cookieConfig.setSecure(false);
CookieProvider provider = new CookieProvider(cookieConfig);
return provider;
}

public static void saveCommentCookie(String id, String opt){
Long userId = getUserId();
String cookieName = "proposal_" + id + opt + userId;
CookieProvider provider =  getCookieProvider();
provider.set(cookieName, "true"); 
}

public static boolean hasCommentCookie(String id){
Long userId = getUserId();
String cookieName = "proposal_" + id + "_save_" + userId;
CookieProvider provider =  getCookieProvider();
String cookieValue = provider.getAsString(cookieName);
if (cookieValue == null)return false;
MessageBox.alert("");
return true;
}
public static boolean checkSupcountCoookies(String token, String opt, String msg){
Long userId = getUserId();
CookieProvider provider =  getCookieProvider();

String cookieName = "proposal_" + token + opt + userId;
String cookieValue = provider.getAsString(cookieName);
if (cookieValue == null){
provider.set(cookieName, "true"); 
return false;
}

MessageBox.alert(msg);
return true;
}

你可能感兴趣的:(ext,gwt)