Commit a85e27c7 authored by Stephane Nicoll's avatar Stephane Nicoll

Further replace magic number by HttpStatus

See gh-15130
parent 9ee63038
...@@ -180,18 +180,20 @@ public final class WebMvcTags { ...@@ -180,18 +180,20 @@ public final class WebMvcTags {
*/ */
public static Tag outcome(HttpServletResponse response) { public static Tag outcome(HttpServletResponse response) {
if (response != null) { if (response != null) {
int status = response.getStatus(); HttpStatus status = extractStatus(response);
if (status < 200) { if (status != null) {
return OUTCOME_INFORMATIONAL; if (status.is1xxInformational()) {
} return OUTCOME_INFORMATIONAL;
if (status < 300) { }
return OUTCOME_SUCCESS; if (status.is2xxSuccessful()) {
} return OUTCOME_SUCCESS;
if (status < 400) { }
return OUTCOME_REDIRECTION; if (status.is3xxRedirection()) {
} return OUTCOME_REDIRECTION;
if (status < 500) { }
return OUTCOME_CLIENT_ERROR; if (status.is4xxClientError()) {
return OUTCOME_CLIENT_ERROR;
}
} }
return OUTCOME_SERVER_ERROR; return OUTCOME_SERVER_ERROR;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment