春季Hateoas / HAL Curies

时间:2020-04-13 01:27:10

标签: spring-hateoas hateoas curie

我正在开发一个新的SpringBoot HAL应用程序。我遇到了一些问题。你能帮忙吗?

  1. 如果启用居里功能,则在返回CollectionModel对象的API调用中,居里名称将以_embedded对象为前缀。如下所示:
{ 
"_embedded": {
   "re:addresses": [
{ .. },
{ .. }
  ]
 },
 "_links": {
   "ex:getinfo": {
     "href": "/person?id="
   },
   "curies": [
    {
       "name": "re",
       "href": "/xx/yyy"
       "templated": true
    }
   ]
 }
}

反正我有re的居里名称作为_embedded集合的前缀吗?

  1. 如果必须使用CollectionModel,并且如果同一API调用未从后端返回任何数据,则我希望有一个空的_embedded对象。我尝试使用EmbeddedWrapper类,但没有成功。

  2. 如果我想对所有API返回的所有link资源使用通用的Person。我假设我可以使用link设置来添加RepresentationModelProcessor。但是,这似乎没有被调用。我在RepresentationModelProcessorEntityModel<Person>上都尝试过CollectionModel<Person>

谢谢

0 个答案:

没有答案