code: public static String getCookieValue(ServletRequest request, String key)
  	{
  		Cookie[] cookies = ((HttpServletRequest) request).getCookies();
  		if (cookies != null)
  		{
  			for (int i = 0; i < cookies.length; i++)
  			{
  				if (cookies[i].getName().equals(key))
  				{
  					return cookies[i].getValue();
  				}
  			}
  		}
  		return null;
  	}
docs: Retrieves a value from a cookie
  
  @param request
  @param key
  @return