absolute path and expires
@@ -25,10 +25,12 @@ package org.takes.facets.previous;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
+import java.util.concurrent.TimeUnit;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;
import org.takes.facets.cookies.RsWithCookie;
+import org.takes.misc.ExpirationDate;
import org.takes.rs.RsWrap;
/**
@@ -56,7 +58,11 @@ public final class RsPrevious extends RsWrap {
new RsWithCookie(
rsp,
TkPrevious.class.getSimpleName(),
- URLEncoder.encode(location, "UTF-8")
+ URLEncoder.encode(location, "UTF-8"),
+ "Path=/",
+ new ExpirationDate(
+ System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1L)
+ ).toString()
)
);
}
