Optimize WebUtils.java
This commit is contained in:
@@ -75,13 +75,13 @@ public class ApiDocAuthPluginFilter implements FizzPluginFilter {
|
||||
response.getHeaders().setExpires(0);
|
||||
String respJson = WebUtils.jsonRespBody(HttpStatus.UNAUTHORIZED.value(),
|
||||
HttpStatus.UNAUTHORIZED.getReasonPhrase(), WebUtils.getTraceId(exchange));
|
||||
return WebUtils.buildDirectResponse(exchange, HttpStatus.UNAUTHORIZED, null, respJson);
|
||||
return WebUtils.response(exchange, HttpStatus.UNAUTHORIZED, null, respJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("{} exception", API_DOC_AUTH_PLUGIN_FILTER, e);
|
||||
String respJson = WebUtils.jsonRespBody(HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
||||
HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), WebUtils.getTraceId(exchange));
|
||||
return WebUtils.buildDirectResponse(exchange, HttpStatus.INTERNAL_SERVER_ERROR, null, respJson);
|
||||
return WebUtils.response(exchange, HttpStatus.INTERNAL_SERVER_ERROR, null, respJson);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,11 +103,11 @@ public class BasicAuthPluginFilter implements FizzPluginFilter {
|
||||
response.getHeaders().setCacheControl("no-store");
|
||||
response.getHeaders().setExpires(0);
|
||||
response.getHeaders().add("WWW-authenticate", "Basic Realm=\"input username and password\"");
|
||||
return WebUtils.buildDirectResponse(exchange, HttpStatus.UNAUTHORIZED, null, null);
|
||||
return WebUtils.response(exchange, HttpStatus.UNAUTHORIZED, null, null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Basic Auth plugin Exception", e);
|
||||
return WebUtils.buildDirectResponse(exchange, HttpStatus.INTERNAL_SERVER_ERROR, null, null);
|
||||
return WebUtils.response(exchange, HttpStatus.INTERNAL_SERVER_ERROR, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,13 +80,13 @@ public class ApiPairingPluginFilter implements FizzPluginFilter {
|
||||
response.getHeaders().setExpires(0);
|
||||
String respJson = WebUtils.jsonRespBody(HttpStatus.UNAUTHORIZED.value(),
|
||||
HttpStatus.UNAUTHORIZED.getReasonPhrase(), WebUtils.getTraceId(exchange));
|
||||
return WebUtils.buildDirectResponse(exchange, HttpStatus.UNAUTHORIZED, null, respJson);
|
||||
return WebUtils.response(exchange, HttpStatus.UNAUTHORIZED, null, respJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("{} Exception", API_PAIRING_PLUGIN_FILTER, e);
|
||||
String respJson = WebUtils.jsonRespBody(HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
||||
HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), WebUtils.getTraceId(exchange));
|
||||
return WebUtils.buildDirectResponse(exchange, HttpStatus.INTERNAL_SERVER_ERROR, null, respJson);
|
||||
return WebUtils.response(exchange, HttpStatus.INTERNAL_SERVER_ERROR, null, respJson);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user