Additional methods are easy, and not incompatible.  I say just stick with the 
original Cookie interface.

On Nov 13, 2012, at 9:59 AM, Ulrich Stärk wrote:

> The Cookies interface and implementation can use some love. I'll take care of 
> that. Do we want to
> simply add a new method to the interface or should we create Cookies2 for 
> backward compatibility?
> 
> I tend to Cookies2.
> 
> Uli
> 
> On 13.11.2012 14:51, Michael Wyraz wrote:
>> From a54fdc541054a4fad654f31b0467b315812effd9 Tue, 13 Nov 2012 14:51:08 +0100
>> From: Michael Wyraz <[email protected]>
>> Date: Tue, 13 Nov 2012 14:40:22 +0100
>> 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..adc26e4 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,19 @@
>> 
>>         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);
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to