File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
spring-test/src/main/java/org/springframework/mock/web
spring-web/src/test/java/org/springframework/mock/web/test Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,10 @@ public class MockServletContext implements ServletContext {
132132
133133 private int sessionTimeout ;
134134
135+ private String requestCharacterEncoding ;
136+
137+ private String responseCharacterEncoding ;
138+
135139
136140 /**
137141 * Create a new {@code MockServletContext}, using no base path and a
@@ -563,6 +567,26 @@ public int getSessionTimeout() {
563567 return this .sessionTimeout ;
564568 }
565569
570+ // @Override - but only against Servlet 4.0
571+ public void setRequestCharacterEncoding (String requestCharacterEncoding ) {
572+ this .requestCharacterEncoding = requestCharacterEncoding ;
573+ }
574+
575+ // @Override - but only against Servlet 4.0
576+ public String getRequestCharacterEncoding () {
577+ return this .requestCharacterEncoding ;
578+ }
579+
580+ // @Override - but only against Servlet 4.0
581+ public void setResponseCharacterEncoding (String responseCharacterEncoding ) {
582+ this .responseCharacterEncoding = responseCharacterEncoding ;
583+ }
584+
585+ // @Override - but only against Servlet 4.0
586+ public String getResponseCharacterEncoding () {
587+ return this .responseCharacterEncoding ;
588+ }
589+
566590
567591 //---------------------------------------------------------------------
568592 // Unsupported Servlet 3.0 registration methods
Original file line number Diff line number Diff line change @@ -132,6 +132,10 @@ public class MockServletContext implements ServletContext {
132132
133133 private int sessionTimeout ;
134134
135+ private String requestCharacterEncoding ;
136+
137+ private String responseCharacterEncoding ;
138+
135139
136140 /**
137141 * Create a new {@code MockServletContext}, using no base path and a
@@ -563,6 +567,26 @@ public int getSessionTimeout() {
563567 return this .sessionTimeout ;
564568 }
565569
570+ // @Override - but only against Servlet 4.0
571+ public void setRequestCharacterEncoding (String requestCharacterEncoding ) {
572+ this .requestCharacterEncoding = requestCharacterEncoding ;
573+ }
574+
575+ // @Override - but only against Servlet 4.0
576+ public String getRequestCharacterEncoding () {
577+ return this .requestCharacterEncoding ;
578+ }
579+
580+ // @Override - but only against Servlet 4.0
581+ public void setResponseCharacterEncoding (String responseCharacterEncoding ) {
582+ this .responseCharacterEncoding = responseCharacterEncoding ;
583+ }
584+
585+ // @Override - but only against Servlet 4.0
586+ public String getResponseCharacterEncoding () {
587+ return this .responseCharacterEncoding ;
588+ }
589+
566590
567591 //---------------------------------------------------------------------
568592 // Unsupported Servlet 3.0 registration methods
You can’t perform that action at this time.
0 commit comments