boolean (@NotNull String url, @NotNull JBCefCookie jbCefCookie) { try { URI uri = new URI(url); String scheme = uri.getScheme(); String domain = uri.getHost(); domain = domain.startsWith("www") ? domain : "." + domain; if (scheme.equals("https") && !jbCefCookie.isSecure()) { LOG.warn("Cannot set cookie without secure flag for HTTPS web-site"); return false; } if (!domain.contains(jbCefCookie.getDomain())) { LOG.warn("Cookie domain `" + jbCefCookie.getDomain() + "` doesn't match URL host `" + domain + "`"); return false; } } catch (URISyntaxException e) { LOG.error(e); return false; } return true; }