Kentico云中的com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

时间:2019-07-15 14:15:57

标签: kentico-cloud

我已经完成了一个简单的代码来从Kentico云中检索发布的内容,我正在使用Kentico云提供的内置类/代码来进行检索。检索时出现以下异常。

"timestamp": "2019-07-15T14:05:11.645+0000",
    "status": 500,
    "error": "Internal Server Error",

    "message": "com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field \"width\" (class com.kenticocloud.delivery.Image), not marked as ignorable (3 known properties: \"description\", \"image_id\", \"url\"])\n at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.kenticocloud.delivery.ContentItemsListingResponse[\"items\"]->java.util.ArrayList[0]->com.kenticocloud.delivery.ContentItem[\"elements\"]->java.util.LinkedHashMap[\"section\"]->com.kenticocloud.delivery.RichTextElement[\"images\"]->java.util.LinkedHashMap[\"dd2f48ec-252a-41b9-badf-320c8d125c16\"]->com.kenticocloud.delivery.Image[\"width\"])",

这是由于Json Response中无法识别的属性而发生的。这是我收到的意外答复。

"leader_image": {
                    "type": "asset",
                    "name": "Leader Image",
                    "value": [
                        {
                            "name": "KemperKip_Rabobank_header.jpg",
                            "description": null,
                            "type": "image/jpeg",
                            "size": 500407,
                            "url": "https://assets-us-01.kc-usercontent.com:443/c6e7ef22-97ac-008a-8a75-a65bfc508501/4ecbfb36-60a6-49c7-a4a1-e8c5ad964a9a/KemperKip_Rabobank_header.jpg",
                            "width": 3348,
                            "height": 1874
                        }
                    ]
                },

映射类中未提及widthheight参数。

我正在使用来自Kentico云站点DeliveryClient client = new DeliveryClient(“ 975bf280-fd91-488c-994c-2f04416e5ee3”,“”)的以下代码段; ContentItem item = client.getItem(“ on_roasts”)。item;

能否请您提供更新的Maven依赖版本。我正在使用该版本

com.kenticocloud交付2.0.2

1 个答案:

答案 0 :(得分:0)

我假设您正在使用直接调用而不使用SDK。

图像分辨率was added to the delivery response on April 24th, 2019

借助此增强功能,例如,您可以在加载资产本身之前在应用程序中渲染图像的占位符。