use of com.genexus.servlet.http.Cookie in project JavaClasses by genexuslabs.
the class HttpContextWeb method setCookieRaw.
public byte setCookieRaw(String name, String value, String path, java.util.Date expiry, String domain, double secure, Boolean httpOnly) {
if (response != null) {
ICookie cookie = new Cookie(name, value);
if (path.trim().length() > 0)
cookie.setPath(path.trim());
if (!expiry.equals(CommonUtil.nullDate())) {
long expiryTime = ((expiry.getTime() - new Date().getTime()) / 1000);
if (expiryTime < 0) {
expiryTime = 0;
}
cookie.setMaxAge((int) expiryTime);
}
if (domain.trim().length() > 0)
cookie.setDomain(domain.trim());
cookie.setSecure(secure != 0);
if (servletContext.getMajorVersion() >= 3)
// Requiere servlet version 3.0
cookie.setHttpOnly(httpOnly);
response.addCookie(cookie);
cookies.put(name, value);
}
return 0;
}