You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2014/08/02 01:35:00 UTC

[1/2] git commit: Remove unused variable

Repository: tapestry-5
Updated Branches:
  refs/heads/master 5649174f0 -> a29d1ea93


Remove unused variable


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/5b6e7c14
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/5b6e7c14
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/5b6e7c14

Branch: refs/heads/master
Commit: 5b6e7c14f5102aa8fee2c06318fa5eacb6c93b59
Parents: 5649174
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Aug 1 16:28:04 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Aug 1 16:28:04 2014 -0700

----------------------------------------------------------------------
 .../org/apache/tapestry5/internal/services/RequestImplTest.java   | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5b6e7c14/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
index 4ec0551..6613d7d 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
@@ -1,5 +1,3 @@
-// Copyright 2006-2013 The Apache Software Foundation
-//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
@@ -51,7 +49,6 @@ public class RequestImplTest extends InternalBaseTestCase
     public void force_session_create()
     {
         HttpServletRequest sr = mockHttpServletRequest();
-        HttpSession ss = mockHttpSession();
         TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
         Session session = mockSession();
 


[2/2] git commit: TAP5-1900: Provide better control over Response character set, using value specified in Request if possible

Posted by hl...@apache.org.
TAP5-1900: Provide better control over Response character set, using value specified in Request if possible


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a29d1ea9
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a29d1ea9
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a29d1ea9

Branch: refs/heads/master
Commit: a29d1ea936802ec2f7a0494afbc2ac63fc0ae8c7
Parents: 5b6e7c1
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Aug 1 16:35:03 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Aug 1 16:35:03 2014 -0700

----------------------------------------------------------------------
 .../internal/services/RequestImpl.java          | 15 ++++++--------
 .../internal/services/RequestImplTest.java      | 21 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a29d1ea9/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
index 1219f9b..6226e86 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
@@ -1,5 +1,3 @@
-// Copyright 2006-2013 The Apache Software Foundation
-//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
@@ -151,15 +149,14 @@ public class RequestImpl implements Request
             return;
         }
 
-        // check if request specifies an encoding
-        String requestEncoding =
-                request.getCharacterEncoding() == null
-                        ? applicationCharset
-                        : request.getCharacterEncoding();
-        
+        // The request may specify an encoding, which is better than the application, which can only
+        // guess at what the client is doing!
+
+        String requestEncoding = request.getCharacterEncoding();
+
         try
         {
-            request.setCharacterEncoding(requestEncoding);
+            request.setCharacterEncoding(requestEncoding != null ? requestEncoding : applicationCharset);
         } catch (UnsupportedEncodingException ex)
         {
             throw new RuntimeException(ex);

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a29d1ea9/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
index 6613d7d..bc9b925 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
@@ -64,6 +64,23 @@ public class RequestImplTest extends InternalBaseTestCase
     }
 
     @Test
+    public void used_encoding_from_request() throws Exception {
+        HttpServletRequest sr = mockHttpServletRequest();
+
+        expect(sr.getCharacterEncoding()).andReturn("request-encoding");
+
+        sr.setCharacterEncoding("request-encoding");
+
+        expect(sr.getParameterNames()).andReturn(Collections.enumeration(Collections.EMPTY_LIST));
+
+        replay();
+
+        new RequestImpl(sr, "app-encoding-is-ignored", null).getParameterNames();
+
+        verify();
+    }
+
+    @Test
     public void set_encoding_success() throws Exception
     {
         HttpServletRequest sr = mockHttpServletRequest();
@@ -72,6 +89,8 @@ public class RequestImplTest extends InternalBaseTestCase
 
         sr.setCharacterEncoding(encoding);
 
+        expect(sr.getCharacterEncoding()).andReturn(null);
+
         expect(sr.getParameterNames()).andReturn(Collections.enumeration(Collections.EMPTY_LIST));
 
         replay();
@@ -92,6 +111,8 @@ public class RequestImplTest extends InternalBaseTestCase
         sr.setCharacterEncoding(encoding);
         setThrowable(exception);
 
+        expect(sr.getCharacterEncoding()).andReturn(null);
+
         replay();
 
         try


[2/2] git commit: TAP5-1900: Provide better control over Response character set, using value specified in Request if possible

Posted by hl...@apache.org.
TAP5-1900: Provide better control over Response character set, using value specified in Request if possible


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a29d1ea9
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a29d1ea9
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a29d1ea9

Branch: refs/heads/master
Commit: a29d1ea936802ec2f7a0494afbc2ac63fc0ae8c7
Parents: 5b6e7c1
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Aug 1 16:35:03 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Aug 1 16:35:03 2014 -0700

----------------------------------------------------------------------
 .../internal/services/RequestImpl.java          | 15 ++++++--------
 .../internal/services/RequestImplTest.java      | 21 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a29d1ea9/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
index 1219f9b..6226e86 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestImpl.java
@@ -1,5 +1,3 @@
-// Copyright 2006-2013 The Apache Software Foundation
-//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
@@ -151,15 +149,14 @@ public class RequestImpl implements Request
             return;
         }
 
-        // check if request specifies an encoding
-        String requestEncoding =
-                request.getCharacterEncoding() == null
-                        ? applicationCharset
-                        : request.getCharacterEncoding();
-        
+        // The request may specify an encoding, which is better than the application, which can only
+        // guess at what the client is doing!
+
+        String requestEncoding = request.getCharacterEncoding();
+
         try
         {
-            request.setCharacterEncoding(requestEncoding);
+            request.setCharacterEncoding(requestEncoding != null ? requestEncoding : applicationCharset);
         } catch (UnsupportedEncodingException ex)
         {
             throw new RuntimeException(ex);

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a29d1ea9/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
index 6613d7d..bc9b925 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
@@ -64,6 +64,23 @@ public class RequestImplTest extends InternalBaseTestCase
     }
 
     @Test
+    public void used_encoding_from_request() throws Exception {
+        HttpServletRequest sr = mockHttpServletRequest();
+
+        expect(sr.getCharacterEncoding()).andReturn("request-encoding");
+
+        sr.setCharacterEncoding("request-encoding");
+
+        expect(sr.getParameterNames()).andReturn(Collections.enumeration(Collections.EMPTY_LIST));
+
+        replay();
+
+        new RequestImpl(sr, "app-encoding-is-ignored", null).getParameterNames();
+
+        verify();
+    }
+
+    @Test
     public void set_encoding_success() throws Exception
     {
         HttpServletRequest sr = mockHttpServletRequest();
@@ -72,6 +89,8 @@ public class RequestImplTest extends InternalBaseTestCase
 
         sr.setCharacterEncoding(encoding);
 
+        expect(sr.getCharacterEncoding()).andReturn(null);
+
         expect(sr.getParameterNames()).andReturn(Collections.enumeration(Collections.EMPTY_LIST));
 
         replay();
@@ -92,6 +111,8 @@ public class RequestImplTest extends InternalBaseTestCase
         sr.setCharacterEncoding(encoding);
         setThrowable(exception);
 
+        expect(sr.getCharacterEncoding()).andReturn(null);
+
         replay();
 
         try