Author: hlship
Date: Fri Nov 7 10:16:22 2008
New Revision: 712218
URL: http://svn.apache.org/viewvc?rev=712218&view=rev
Log:
TAP5-47: Cookie is not a secure cookie even though all connection are HTTPS
connections
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/CookiesImplTest.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java?rev=712218&r1=712217&r2=712218&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CookiesImpl.java
Fri Nov 7 10:16:22 2008
@@ -80,6 +80,7 @@
Cookie cookie = new Cookie(name, value);
cookie.setPath(request.getContextPath() + "/");
cookie.setMaxAge(maxAge);
+ cookie.setSecure(request.isSecure());
cookieSink.addCookie(cookie);
}
@@ -89,6 +90,7 @@
Cookie cookie = new Cookie(name, value);
cookie.setPath(path);
cookie.setMaxAge(defaultMaxAge);
+ cookie.setSecure(request.isSecure());
cookieSink.addCookie(cookie);
}
@@ -104,6 +106,7 @@
cookie.setPath(request.getContextPath() + "/");
cookie.setDomain(domain);
cookie.setMaxAge(maxAge);
+ cookie.setSecure(request.isSecure());
cookieSink.addCookie(cookie);
}
@@ -114,6 +117,7 @@
cookie.setPath(path);
cookie.setDomain(domain);
cookie.setMaxAge(defaultMaxAge);
+ cookie.setSecure(request.isSecure());
cookieSink.addCookie(cookie);
}
@@ -123,8 +127,8 @@
Cookie cookie = new Cookie(name, null);
cookie.setPath(request.getContextPath() + "/");
cookie.setMaxAge(0);
+ cookie.setSecure(request.isSecure());
cookieSink.addCookie(cookie);
}
-
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java?rev=712218&r1=712217&r2=712218&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Cookies.java
Fri Nov 7 10:16:22 2008
@@ -15,7 +15,9 @@
package org.apache.tapestry5.services;
/**
- * Used by other services to obtain cookie values for the current request.
+ * Used by other services to obtain cookie values for the current request, or
to write cookie values as part of the
+ * request. Note that when writing cookies, the cookie's secure flag will
match [EMAIL PROTECTED]
+ * org.apache.tapestry5.services.Request#isSecure()}.
*/
public interface Cookies
{
@@ -67,6 +69,5 @@
/**
* Removes a previously written cookie, by writing a new cookie with a
maxAge of 0.
*/
-
void removeCookieValue(String name);
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/CookiesImplTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/CookiesImplTest.java?rev=712218&r1=712217&r2=712218&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/CookiesImplTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/CookiesImplTest.java
Fri Nov 7 10:16:22 2008
@@ -24,7 +24,7 @@
import java.util.List;
/**
- * Tests for [EMAIL PROTECTED] org.apache.tapestry5.services.impl.CookiesImpl}.
+ * Tests for [EMAIL PROTECTED]
org.apache.tapestry5.internal.services.CookiesImpl}.
*/
@Test
public class CookiesImplTest extends Assert
@@ -99,12 +99,12 @@
public void test_Match()
{
- attempt("fred", "flintstone", new String[] { "barney", "rubble",
"fred", "flintstone" });
+ attempt("fred", "flintstone", new String[] {"barney", "rubble",
"fred", "flintstone"});
}
public void test_No_Match()
{
- attempt("foo", null, new String[] { "bar", "baz" });
+ attempt("foo", null, new String[] {"bar", "baz"});
}
public void test_Write_Cookie_Domain()
@@ -128,7 +128,6 @@
{
cookies.add(cookie);
}
-
}, 1000l * 1000l);
}