国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

YMP-Online-Handbuch / Cookies操作

Cookies操作

WebMVC模塊針對Cookies這個小甜點提供了一個名為CookieHelper的小工具類,支持Cookie參數(shù)的設(shè)置、讀取和移除操作,同時支持對編碼和加密處理,并允許通過配置參數(shù)調(diào)整Cookie策略;

Cookie配置參數(shù)
#-------------------------------------
# Cookie配置參數(shù)
#-------------------------------------

# Cookie鍵前綴,可選參數(shù),默認(rèn)值為空
ymp.configs.webmvc.cookie_prefix=

# Cookie作用域,可選參數(shù),默認(rèn)值為空
ymp.configs.webmvc.cookie_domain=

# Cookie作用路徑,可選參數(shù),默認(rèn)值為'/'
ymp.configs.webmvc.cookie_path=

# Cookie密鑰,可選參數(shù),默認(rèn)值為空
ymp.configs.webmvc.cookie_auth_key=

# Cookie密鑰驗證是否默認(rèn)開啟, 默認(rèn)值為false
ymp.configs.webmvc.default_enabled_cookie_auth=
示例代碼:演示Cookie操作
// 創(chuàng)建CookieHelper對象
CookieHelper _helper = CookieHelper.bind(WebContext.getContext().getOwner());

// 設(shè)置開啟采用密鑰加密(將默認(rèn)開啟Base64編碼)
_helper.allowUseAuthKey();

// 設(shè)置開啟采用Base64編碼(默認(rèn)支持UrlEncode編碼)
_helper.allowUseBase64();

// 添加或重設(shè)Cookie,過期時間基于Session時效
_helper.setCookie("current_username", "YMPer");

// 添加或重設(shè)Cookie,并指定過期時間
_helper.setCookie("current_username", "YMPer", 1800);

// 獲取Cookie值
BlurObject _currUsername = _helper.getCookie("current_username");

// 獲取全部Cookie
Map<String, BlurObject> _cookies = _helper.getCookies();

// 移除Cookie
_helper.removeCookie("current_username");

// 清理所有的Cookie
_helper.clearCookies();