From 38db152c669ccbf88703adf35d90f12d3f22a2f4 Tue, 22 May 2012 13:26:22
+0200
From: Michael Wyraz <[email protected]>
Date: Tue, 22 May 2012 13:21:40 +0200
Subject: [PATCH] TAP5-1858 Cookie service should allow to set path,
domain AND maxAge
diff --git
a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
index 3c88006..0a89b02 100644
---
a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
+++
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
@@ -121,6 +121,32 @@
cookieSink.addCookie(cookie);
}
+
+ public void writeCookieValue(String name, String value, String
path, String domain, int maxAge)
+ {
+ Cookie cookie = new Cookie(name, value);
+ if (path==null) cookie.setPath(request.getContextPath() + "/");
+ else cookie.setPath(path);
+ if (domain!=null) cookie.setDomain(domain);
+ if (maxAge!=0) cookie.setMaxAge(maxAge);
+ else cookie.setMaxAge(defaultMaxAge);
+ cookie.setSecure(request.isSecure());
+
+ cookieSink.addCookie(cookie);
+ }
+
+ public void writeCookieValue(String name, String value, String
path, String domain, int maxAge)
+ {
+ Cookie cookie = new Cookie(name, value);
+ if (path==null) cookie.setPath(request.getContextPath() + "/");
+ else cookie.setPath(path);
+ if (domain!=null) cookie.setDomain(domain);
+ if (maxAge!=0) cookie.setMaxAge(maxAge);
+ else cookie.setMaxAge(defaultMaxAge);
+ cookie.setSecure(request.isSecure());
+
+ cookieSink.addCookie(cookie);
+ }
public void removeCookieValue(String name)
{
diff --git
a/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
b/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
index 4bcd653..a081a6d 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
@@ -67,6 +67,11 @@
void writeCookieValue(String name, String value, String path,
String domain);
/**
+ * As with {@link #writeCookieValue(String, String, String)} but an
explicit domain,path and maximum age may be set.
+ */
+ void writeCookieValue(String name, String value, String path,
String domain, int maxAge);
+
+ /**
* Removes a previously written cookie, by writing a new cookie
with a maxAge of 0.
*/
void removeCookieValue(String name);
--
Mit freundlichen Grüßen / Regards
Michael Wyraz
evermind GmbH
Schorlemmerstraße 1
04155 Leipzig
Tel.: +49 (0)341-25 39 66 - 0
Fax: +49 (0)341-25 39 66 - 1
Funk: +49 (0)177-73 00 00 3
E-Mail: [email protected]
HRB: 21586
Amtsgericht Leipzig
Geschäftsführer:
Christoph Klemm
Thomas Grünert
Michael Wyraz
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]