From 05b29a4a17f612dea9cb09c6bc328ecb11b27e72 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 3 May 2016 16:14:09 +0200 Subject: [PATCH] Add convenient getters for force*Encoding attributes Issue: SPR-14240 --- .../web/filter/CharacterEncodingFilter.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java b/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java index 5f8566b9d7..53b6b96654 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java @@ -113,6 +113,13 @@ public class CharacterEncodingFilter extends OncePerRequestFilter { this.encoding = encoding; } + /** + * Return the configured encoding for requests and/or responses + */ + public String getEncoding() { + return encoding; + } + /** * Set whether the configured {@link #setEncoding encoding} of this filter * is supposed to override existing request and response encodings. @@ -143,6 +150,13 @@ public class CharacterEncodingFilter extends OncePerRequestFilter { this.forceRequestEncoding = forceRequestEncoding; } + /** + * Return whether the encoding should be forced on requests + */ + public boolean isForceRequestEncoding() { + return forceRequestEncoding; + } + /** * Set whether the configured {@link #setEncoding encoding} of this filter * is supposed to override existing response encodings. @@ -155,6 +169,13 @@ public class CharacterEncodingFilter extends OncePerRequestFilter { this.forceResponseEncoding = forceResponseEncoding; } + /** + * Return whether the encoding should be forced on responses + */ + public boolean isForceResponseEncoding() { + return forceResponseEncoding; + } + @Override protected void doFilterInternal( HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)