use of org.webpieces.httpparser.api.dto.KnownStatusCode in project webpieces by deanhiller.
the class GrpcJsonCatchAllFilter method translate.
protected RenderContent translate(BadRequestException t) {
Builder builder = ErrorResponse.newBuilder();
builder.setError(t.getHttpCode() + " " + t.getStatusMessage() + ": " + t.getMessage());
builder.setCode(t.getHttpCode());
byte[] content = translateJson(builder);
KnownStatusCode status = KnownStatusCode.HTTP_400_BADREQUEST;
return new RenderContent(content, status.getCode(), status.getReason(), MIME_TYPE);
}
use of org.webpieces.httpparser.api.dto.KnownStatusCode in project webpieces by deanhiller.
the class GrpcJsonCatchAllFilter method translate.
protected Action translate(UnauthorizedException t) {
Builder builder = ErrorResponse.newBuilder();
builder.setError(t.getHttpCode() + " " + t.getStatusMessage() + ": " + t.getMessage());
builder.setCode(t.getHttpCode());
byte[] content = translateJson(builder);
KnownStatusCode status = KnownStatusCode.HTTP_403_FORBIDDEN;
return new RenderContent(content, status.getCode(), status.getReason(), MIME_TYPE);
}
Aggregations