use of org.webpieces.router.api.controller.actions.RenderContent in project webpieces by deanhiller.
the class GrpcJsonCatchAllFilter method createNotFound.
protected Action createNotFound() {
Builder builder = ErrorResponse.newBuilder();
builder.setError("404 This url does not exist. try another url");
builder.setCode(404);
byte[] content = translateJson(builder);
return new RenderContent(content, KnownStatusCode.HTTP_404_NOTFOUND.getCode(), KnownStatusCode.HTTP_404_NOTFOUND.getReason(), MIME_TYPE);
}
use of org.webpieces.router.api.controller.actions.RenderContent 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