简体   繁体   English

需要将Spring的默认HAL格式转换为JSON API,或使Ember Data接受HAL json格式

[英]In need to either convert Spring's default HAL format to JSON API, or make Ember Data accept HAL json format

My Ember.js front-end application is to consume REST API created in Spring (Boot). 我的Ember.js前端应用程序将使用在Spring(启动)中创建的REST API。 The problem is: - Spring returns json response in HAL format - Ember Data expect the response to be fully compliant with JSON API specs 问题是:-Spring以HAL格式返回json响应-Ember Data期望响应完全符合JSON API规范

So far I have found that there are at least two "adapters" for each side. 到目前为止,我发现每侧至少有两个“适配器”。

This one is supposed to convince Ember Data to use the Spring's response as it is: ember-data-hal-9000 这个程序应该说服Ember Data使用Spring的响应: ember-data-hal-9000

This one makes Spring's response compliant with JSON API specs: Katharsis - HATEOAS for Java based on JSON API standard 这使Spring的响应符合JSON API规范: Katharsis-基于JSON API标准的Java HATEOAS

I've read that both have its own problems but has anyone successfully employed either of them? 我读过,两者都有自己的问题,但是有没有人成功地雇用了他们中的任何一个? Ideally both of them, so a comparison can be made? 理想情况下,两者都可以进行比较吗?

I worked for a client for a while who had gone with Katharsis. 我为与Katharsis在一起的客户工作了一段时间。 The backend developers disliked Katharsis (as it had made some non-spec compliant "decisions" that had to be worked around), but part of that may also have been due to a fairly messy backend data model. 后端开发人员不喜欢Katharsis(因为它已经做出了一些不符合规范的“决定”,因此必须解决),但是其中的部分原因可能还在于后端数据模型相当混乱。

It worked great on the Ember side of things 😉 它在Ember方面效果很好😉

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM