* Adds a cookie, as long as cookies are enabled.
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533693.aspx">MSDN documentation</a>
* @param newCookie in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure]
*/
public void jsxSet_cookie(final String newCookie) {
final CookieManager cookieManager = getHtmlPage().getWebClient().getCookieManager();
if (cookieManager.isCookiesEnabled()) {
URL url = getHtmlPage().getWebResponse().getRequestSettings().getUrl();
url = replaceForCookieIfNecessary(url);
final Cookie cookie = buildCookie(newCookie, url);
cookieManager.addCookie(cookie);
LOG.debug("Added cookie: " + cookie);
}
else {
LOG.debug("Skipped adding cookie: " + newCookie);
}