You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Michael Wyraz <mi...@evermind.de> on 2012/05/22 13:27:58 UTC

Patch: TAP51858 (Branch 5.3)

 From 38db152c669ccbf88703adf35d90f12d3f22a2f4 Tue, 22 May 2012 13:26:22 
+0200
From: Michael Wyraz <mi...@evermind.de>
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:     michael.wyraz@evermind.de

HRB: 21586
Amtsgericht Leipzig

Geschäftsführer:
Christoph Klemm
Thomas Grünert
Michael Wyraz


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Patch: TAP51858 (Branch 5.3)

Posted by Ulrich Stärk <ul...@spielviel.de>.
On 22.05.2012 17:43, Howard Lewis Ship wrote:
> Thanks for these patches, I look forward to applying them.  Two notes:
>
> 1) Patches MUST come through JIRA, not the mailing list.  This is
> requirement at Apache, and supports legal protections for the
> committers.
I'll need to double-check but I believe that isn't entirely true. It needs to be established that
the contribution was made for inclusion in an Apache-licensed product but that's basically it. JIRA
makes this easy as it has the checkboxes when uploading, but sending a patch to the mailing list
with a note "licensed to the ASF for inclusion under the AL 2.0" should suffice.

>
> 2) Patches with tests are even better!
+1
>
> On Tue, May 22, 2012 at 4:27 AM, Michael Wyraz
> <mi...@evermind.de> wrote:

Uli

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Patch: TAP51858 (Branch 5.3)

Posted by Howard Lewis Ship <hl...@gmail.com>.
Thanks for these patches, I look forward to applying them.  Two notes:

1) Patches MUST come through JIRA, not the mailing list.  This is
requirement at Apache, and supports legal protections for the
committers.

2) Patches with tests are even better!

On Tue, May 22, 2012 at 4:27 AM, Michael Wyraz
<mi...@evermind.de> wrote:
> From 38db152c669ccbf88703adf35d90f12d3f22a2f4 Tue, 22 May 2012 13:26:22
> +0200
> From: Michael Wyraz <mi...@evermind.de>
> 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:     michael.wyraz@evermind.de
>
> HRB: 21586
> Amtsgericht Leipzig
>
> Geschäftsführer:
> Christoph Klemm
> Thomas Grünert
> Michael Wyraz
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org