public static Cookie getCookie ( String name , HttpServletRequest request ) { Cookie [ ] cookies = request . getCookies ( ) ; if ( ArrayUtils . isNotEmpty ( cookies ) ) { for ( Cookie cookie : cookies ) { if ( cookie . getName ( ) . equals ( name ) ) { return cookie ; } } } return null ; }
Returns the cookie with the given name for the given request