示例#1
0
 private Response set(final Request request, final Response response, final Cookie cookie) {
   if (cookieAlreadyHasSameValue(request, cookie)
       || (isEmptyJson(cookie.value()) && !request.cookies().contains(FLASH_COOKIE))) {
     return response;
   }
   return response.cookie(cookie);
 }
示例#2
0
  private static void setIncomingFlashValues(Request request, Flash flash) {
    CookieParameters requestCookies = request.cookies();

    if (!requestCookies.contains(FLASH_COOKIE)
        || isEmptyJson(requestCookies.getValue(FLASH_COOKIE))
        || isBlank(requestCookies.getValue(FLASH_COOKIE))) return;

    flash.merge(Json.parseMap(requestCookies.getValue(FLASH_COOKIE)).value());
  }
示例#3
0
 private boolean cookieAlreadyHasSameValue(final Request request, final Cookie cookie) {
   return cookie.value().equals(request.cookies().getValue(FLASH_COOKIE));
 }