Java判斷cookie中是否有某個具體的cookie


/** * 從request 中取出 cookie */
private String getUgcCookie(HttpServletRequest request) { String ugcInfo = null; try { Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } for (Cookie cookie : cookies) { if (CookieConst.COOKIE_UGC.equals(cookie.getName())) { ugcInfo = cookie.getValue(); } } } catch (Throwable e) { logger.error("getUgcCookie error, [msg = {}]", e.getMessage(), e); } return ugcInfo; }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM