Search in sources :

Example 6 with Builder

use of org.webpieces.grpc.ErrorResponse.Builder 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);
}
Also used : Builder(org.webpieces.grpc.ErrorResponse.Builder) MessageOrBuilder(com.google.protobuf.MessageOrBuilder) RenderContent(org.webpieces.router.api.controller.actions.RenderContent) KnownStatusCode(org.webpieces.httpparser.api.dto.KnownStatusCode)

Aggregations

MessageOrBuilder (com.google.protobuf.MessageOrBuilder)6 Builder (org.webpieces.grpc.ErrorResponse.Builder)6 RenderContent (org.webpieces.router.api.controller.actions.RenderContent)5 KnownStatusCode (org.webpieces.httpparser.api.dto.KnownStatusCode)4