1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -51,8 +51,6 @@ public class ContentCachingResponseWrapper extends HttpServletResponseWrapper {
51
51
@ Nullable
52
52
private PrintWriter writer ;
53
53
54
- private int statusCode = HttpServletResponse .SC_OK ;
55
-
56
54
@ Nullable
57
55
private Integer contentLength ;
58
56
@@ -66,19 +64,6 @@ public ContentCachingResponseWrapper(HttpServletResponse response) {
66
64
}
67
65
68
66
69
- @ Override
70
- public void setStatus (int sc ) {
71
- super .setStatus (sc );
72
- this .statusCode = sc ;
73
- }
74
-
75
- @ SuppressWarnings ("deprecation" )
76
- @ Override
77
- public void setStatus (int sc , String sm ) {
78
- super .setStatus (sc , sm );
79
- this .statusCode = sc ;
80
- }
81
-
82
67
@ Override
83
68
public void sendError (int sc ) throws IOException {
84
69
copyBodyToResponse (false );
@@ -89,7 +74,6 @@ public void sendError(int sc) throws IOException {
89
74
// Possibly on Tomcat when called too late: fall back to silent setStatus
90
75
super .setStatus (sc );
91
76
}
92
- this .statusCode = sc ;
93
77
}
94
78
95
79
@ Override
@@ -103,7 +87,6 @@ public void sendError(int sc, String msg) throws IOException {
103
87
// Possibly on Tomcat when called too late: fall back to silent setStatus
104
88
super .setStatus (sc , msg );
105
89
}
106
- this .statusCode = sc ;
107
90
}
108
91
109
92
@ Override
@@ -176,9 +159,11 @@ public void reset() {
176
159
177
160
/**
178
161
* Return the status code as specified on the response.
162
+ * @deprecated as of 5.2 in favor of {@link HttpServletResponse#getStatus()}
179
163
*/
164
+ @ Deprecated
180
165
public int getStatusCode () {
181
- return this . statusCode ;
166
+ return getStatus () ;
182
167
}
183
168
184
169
/**
0 commit comments