use of org.webpieces.httpparser.api.dto.KnownStatusCode in project webpieces by deanhiller.
the class Http2Translations method fillStatus.
private static void fillStatus(Http2Header statusHeader, HttpResponseStatus status) {
int code = Integer.parseInt(statusHeader.getValue());
KnownStatusCode knownStatusCode = KnownStatusCode.lookup(code);
if (knownStatusCode != null) {
status.setKnownStatus(knownStatusCode);
} else {
status.setCode(code);
}
}
use of org.webpieces.httpparser.api.dto.KnownStatusCode in project webpieces by deanhiller.
the class JacksonCatchAllFilter method translateError.
protected RenderContent translateError(Throwable t) {
byte[] content = translateServerError(t);
KnownStatusCode status = KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR;
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 translateError.
protected RenderContent translateError(Throwable t) {
Builder builder = ErrorResponse.newBuilder();
builder.setError("Server ran into a bug, please report");
builder.setCode(500);
byte[] content = translateJson(builder);
KnownStatusCode status = KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR;
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 Http2ToHttp11 method fillStatus.
private static void fillStatus(Http2Header statusHeader, HttpResponseStatus status) {
int code = Integer.parseInt(statusHeader.getValue());
KnownStatusCode knownStatusCode = KnownStatusCode.lookup(code);
if (knownStatusCode != null) {
status.setKnownStatus(knownStatusCode);
} else {
status.setCode(code);
}
}
use of org.webpieces.httpparser.api.dto.KnownStatusCode in project webpieces by deanhiller.
the class GrpcJsonCatchAllFilter method translate.
protected Action translate(ForbiddenException 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_401_UNAUTHORIZED;
return new RenderContent(content, status.getCode(), status.getReason(), MIME_TYPE);
}
Aggregations