本文整理汇总了Java中javax.ws.rs.core.Response.Status.Family.CLIENT_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java Family.CLIENT_ERROR属性的具体用法?Java Family.CLIENT_ERROR怎么用?Java Family.CLIENT_ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.ws.rs.core.Response.Status.Family
的用法示例。
在下文中一共展示了Family.CLIENT_ERROR属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toResponse
@Override
public Response toResponse(@NonNull Exception exception) {
ResponseBuilder builder;
StatusType statusInfo;
if (exception instanceof WebApplicationException) {
Response response = ((WebApplicationException) exception).getResponse();
builder = Response.fromResponse(response);
statusInfo = response.getStatusInfo();
} else {
builder = Response.serverError();
statusInfo = Status.INTERNAL_SERVER_ERROR;
}
SimpleExceptionJson simpleExceptionJson = new SimpleExceptionJson(statusInfo.getReasonPhrase(),
statusInfo.getStatusCode(), exception.getMessage());
builder.entity(simpleExceptionJson);
builder.type("application/problem+json");
if (statusInfo.getFamily() == Family.CLIENT_ERROR) {
log.debug("Got client Exception", exception);
} else {
log.error("Sending error to client", exception);
}
return builder.build();
}
示例2: convert
public <T> EndpointResponse<T> convert(Response response, EndpointRequest request) {
Family statusFamily = response.getStatusInfo().getFamily();
if (statusFamily == Family.SERVER_ERROR || statusFamily == Family.CLIENT_ERROR) {
return endpointResponseErrorFallback.onError(ErrorHttpResponseMessage.from(response, request), request.responseType());
} else {
return doConvert(response, request.responseType());
}
}
示例3: getFamily
public Family getFamily() {
return Family.CLIENT_ERROR;
}