hal-json

Bookmark AngularJS frontend (direct access) - Spring Data Rest backend

。_饼干妹妹 提交于 2019-12-13 00:34:03
问题 I've started to implement a web-front end to manipulate a RESTful service served by Spring Data Rest over a traditional relational DB. This is done with AngularJS and the angular-hal library that I found fits very well the HATEOAS philosophy and formalism of Spring Data Rest . For example, I just need to know the first API endpoint ('/'), and then all of my queries are done through the relations without caring for the urls. The problem I have is to be able to directly access the page

Why is the HTTP location header only set for POST requests/201 (Created) responses?

我只是一个虾纸丫 提交于 2019-12-07 09:11:52
问题 Ignoring 3xx responses for a moment, I wonder why the HTTP location header is only used in conjunction with POST requests/201 (Created) responses. From the RFC 2616 spec: For 201 (Created) responses, the Location is that of the new resource which was created by the request. This is a widely supported behavior, but why shouldn't it be used with other HTTP methods? Take the JSON API spec as an example: It defines a self referencing link for the current resource inside the JSON payload (not

Spring returns Resource in pure JSON not in HAL Format when including spring data rest

三世轮回 提交于 2019-12-06 05:18:38
问题 When I use the default controller for my Entities, provided by Spring Data Rest everything works like it should. The output looks like this: { "_links" : { "search" : { "href" : "http://localhost:8080/users/search" } }, "_embedded" : { "users" : [ { "firstName" : "Max", "lastName" : "Mustermann", "email" : "mail@max-mustermann.de", "_links" : { "self" : { "href" : "http://localhost:8080/users/myadmin" } } } ] } } But if I use my own Controller the output looks like this: [ { "firstName" :

Why is the HTTP location header only set for POST requests/201 (Created) responses?

青春壹個敷衍的年華 提交于 2019-12-05 12:44:59
Ignoring 3xx responses for a moment, I wonder why the HTTP location header is only used in conjunction with POST requests/201 (Created) responses. From the RFC 2616 spec : For 201 (Created) responses, the Location is that of the new resource which was created by the request. This is a widely supported behavior, but why shouldn't it be used with other HTTP methods? Take the JSON API spec as an example: It defines a self referencing link for the current resource inside the JSON payload ( not uncommon for RESTful APIs ). This link is included in every payload. The spec says that you MUST include