Browse Source

Add convenient getters for force*Encoding attributes

Issue: SPR-14240
pull/1050/head
Brian Clozel 9 years ago
parent
commit
05b29a4a17
  1. 21
      spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java

21
spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java

@ -113,6 +113,13 @@ public class CharacterEncodingFilter extends OncePerRequestFilter { @@ -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 { @@ -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 { @@ -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)

Loading…
Cancel
Save