File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 31
31
32
32
import org .springframework .core .MethodParameter ;
33
33
import org .springframework .core .ResolvableType ;
34
+ import org .springframework .http .HttpStatusCode ;
35
+ import org .springframework .http .HttpStatus ;
34
36
import org .springframework .http .HttpEntity ;
35
37
import org .springframework .http .HttpHeaders ;
36
38
import org .springframework .http .HttpMethod ;
@@ -237,17 +239,17 @@ else if (returnValue instanceof ProblemDetail detail) {
237
239
}
238
240
239
241
if (httpEntity instanceof ResponseEntity <?> responseEntity ) {
240
- int returnStatus = responseEntity .getStatusCode (). value ();
241
- outputMessage .getServletResponse ().setStatus (returnStatus );
242
- if (returnStatus == 200 ) {
242
+ HttpStatusCode httpStatusCode = responseEntity .getStatusCode ();
243
+ outputMessage .getServletResponse ().setStatus (httpStatusCode . value () );
244
+ if (HttpStatus . OK . value () == httpStatusCode . value () ) {
243
245
HttpMethod method = inputMessage .getMethod ();
244
246
if ((HttpMethod .GET .equals (method ) || HttpMethod .HEAD .equals (method ))
245
247
&& isResourceNotModified (inputMessage , outputMessage )) {
246
248
outputMessage .flush ();
247
249
return ;
248
250
}
249
251
}
250
- else if (returnStatus / 100 == 3 ) {
252
+ else if (httpStatusCode . is3xxRedirection () ) {
251
253
String location = outputHeaders .getFirst ("location" );
252
254
if (location != null ) {
253
255
saveFlashAttributes (mavContainer , webRequest , location );
You can’t perform that action at this time.
0 commit comments