Repository: tapestry-5 Updated Branches: refs/heads/master 25389db3c -> d29d6dc59
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/d29d6dc5 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d29d6dc5 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d29d6dc5 Branch: refs/heads/master Commit: d29d6dc59df407f2f9f1b0adbdcd25bb4a3dc775 Parents: 25389db Author: Howard M. Lewis Ship <[email protected]> Authored: Fri Aug 1 15:29:05 2014 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Fri Aug 1 15:29:05 2014 -0700 ---------------------------------------------------------------------- .../tapestry5/internal/services/RequestImpl.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d29d6dc5/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 c62027a..1219f9b 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 @@ -39,7 +39,7 @@ public class RequestImpl implements Request private final HttpServletRequest request; - private final String requestEncoding; + private final String applicationCharset; private final TapestrySessionFactory sessionFactory; @@ -49,11 +49,11 @@ public class RequestImpl implements Request public RequestImpl( HttpServletRequest request, - String requestEncoding, + String applicationCharset, TapestrySessionFactory sessionFactory) { this.request = request; - this.requestEncoding = requestEncoding; + this.applicationCharset = applicationCharset; this.sessionFactory = sessionFactory; } @@ -147,8 +147,16 @@ public class RequestImpl implements Request private void setupEncoding() { if (encodingSet) + { return; + } + // check if request specifies an encoding + String requestEncoding = + request.getCharacterEncoding() == null + ? applicationCharset + : request.getCharacterEncoding(); + try { request.setCharacterEncoding(requestEncoding);
