private Builder(final String batchId, final String commandCorrelationId, final DittoRuntimeException dittoRuntimeException) { this(); this.batchId = batchId; this.commandCorrelationId = commandCorrelationId; final String message = MessageFormat.format(MESSAGE_TEMPLATE, batchId); message(message); final String description = MessageFormat.format(DEFAULT_DESCRIPTION_TEMPLATE, commandCorrelationId, dittoRuntimeException.toJsonString()); description(description); }
private HttpResponse buildResponseWithoutHeadersFromDittoRuntimeException(final DittoRuntimeException dre) { final HttpResponse responseWithoutHeaders = HttpResponse.create().withStatus(dre.getStatusCode().toInt()); if (HttpStatusCode.NOT_MODIFIED.equals(dre.getStatusCode())) { return responseWithoutHeaders; } else { return responseWithoutHeaders.withEntity(CONTENT_TYPE_JSON, ByteString.fromString(dre.toJsonString())); } }
); return complete(HttpResponse.create().withStatus(cre.getStatusCode().toInt()) .withEntity(ContentTypes.APPLICATION_JSON, ByteString.fromString(cre.toJsonString()))); }) .match(JsonRuntimeException.class, jre -> {
return HttpResponse.create() .withStatus(statusCode) .withEntity(ContentTypes.APPLICATION_JSON, ByteString.fromString(cre.toJsonString())) .addHeaders(securityResponseHeaders);