spring-hateoas

Consuming Spring Hateoas Pageable

烂漫一生 提交于 2020-02-20 08:21:47
问题 I have a Rest-Service using HAteoas, what worked before without pageing. Now I am producing pageable Json. I did it with out-of-the box features from Spring-Hateoas. But now I am stucking consuming it and I guess it is really not well documented, if it is. My JSON looks like follows: { "_embedded": { "vertragResourceList": [ { "identifier": 728, "auszubildender": "Rumm", "beruf": "Landwirt/in", "betrieb": "Mitterbauer Johann", "betriebsNummer": "e12d0949-67ae-4134-9dc2-fb67758b6b16",

Consuming Spring Hateoas Pageable

有些话、适合烂在心里 提交于 2020-02-20 08:19:08
问题 I have a Rest-Service using HAteoas, what worked before without pageing. Now I am producing pageable Json. I did it with out-of-the box features from Spring-Hateoas. But now I am stucking consuming it and I guess it is really not well documented, if it is. My JSON looks like follows: { "_embedded": { "vertragResourceList": [ { "identifier": 728, "auszubildender": "Rumm", "beruf": "Landwirt/in", "betrieb": "Mitterbauer Johann", "betriebsNummer": "e12d0949-67ae-4134-9dc2-fb67758b6b16",

Spring HATEOAS - two same links

橙三吉。 提交于 2020-01-24 20:41:11
问题 lately I've been doing some projekt with Spring Data and Rest with HATEOAS. My question is, is it normal, that in entity links secion, I have 2 same links? Here is repository: Repository 回答1: Yes it is. But it's not always the case: the 'user' link is actually a templated link that gets enriched in certain cases. For instance, should you define the following projection: @Projection(name = "summary", types = { User.class }) interface Summary { String getUsername(); String getEmail(); } then

Spring Data REST will export all its attributes (except the id).

若如初见. 提交于 2020-01-16 12:35:08
问题 I am currently in learning phase of Spring Data Rest. I developed one app in which I was able to succesfully expose the Rest Respoitory but with out the "ID". I searched over the internet to check if I am doing any thing wrong. However, one of the officially links (Official Doc) says, "Spring Data REST will export all its attributes (except the id). You can offer the consumer of your REST service an alternative by defining one or more projections." So if have more than ten entities. I have to

Spring Boot: Add Non-Repository REST Controller to HAL Links

為{幸葍}努か 提交于 2020-01-16 08:33:20
问题 The problem: I have a simple Spring Boot app, using Spring Data REST and HATEOAS, with a JPA Entity class which calls a MySql Function (not a table). The rest of my repos are displayed in a nice HAL set of hyperlinks, but this one function is not discoverable (not in the list). How do I add it into the HAL links? @Entity(name = "GetOptionsForStyle") @Table(name = "get_options_for_style") @NamedNativeQueries({ @NamedNativeQuery(name = "getOptionsByStyleId", query = "SELECT `f1`.`get_options

Why do I get warnings when using Spring HATEOAS Jackson serializers

对着背影说爱祢 提交于 2020-01-15 18:49:44
问题 Spring HATEOAS defines and registers a HttpMessageConverter with a Jackson module that contains serializers to transform its ResourceSupport and Resources types to HAL JSON representations. The modules uses Jackson mixins to bind the serializers to types like so: package org.springframework.hateoas.hal; // Imports omitted public abstract class ResourcesMixin<T> extends Resources<T> { @Override @XmlElement(name = "embedded") @JsonProperty("_embedded") @JsonSerialize(include = JsonSerialize

$addToSet implementation for array update on PATCH request

╄→гoц情女王★ 提交于 2020-01-15 09:46:06
问题 Is there a way to tell MongoRepository to implement $addToSet when updating an array value during PATCH request? I am using Spring data rest with HATEOAS and Mongodb, and the current implementation replaces the old array with the new array, where the desired functionality is to perform a union of both arrays and have that array stored in the Mongodb document. While it should be possible to do that with custom implementation, Spring won't generate a rest url for the implementation and hence

How to add custom links to non repository rest controller in spring data rest hal?

本秂侑毒 提交于 2020-01-13 22:40:02
问题 I would like to add custom rest controller to be added to the json/hal response of the entry point, together with all the respositories that are added by spring. I'm struggling with this by two problems: How can I add my custom controller so it appears on the entry point together with the links to my repository? How can I decorate with a link to my custom controller on a representation of an entity produced by the repository so I can link to my custom controller? I have struggled for a while

HATEOAS paths are invalid when using an API Gateway in a Spring Boot app

微笑、不失礼 提交于 2020-01-09 20:33:42
问题 I have two spring boot applications where one of them is acting as an API Gateway (as discussed here Spring Example). The other which is wired into the first one is exposing a profile service using spring-data-rest (spring-data-neo4j-rest). The first application is starting on port 8080 and is using zuul to route requests to the second as follows: zuul: routes: profiles: path: /profiles/** url: http://localhost:8083/profiles/ This all works fine and requests to http://localhost:8080/profiles

Spring Data-Rest POST to sub-resource

☆樱花仙子☆ 提交于 2020-01-04 23:06:23
问题 Lets say I have the following structure: @Entity class Person extends AbstractPersistable<Long> { String name String surname } @Entity class Task extends AbstractPersistable<Long> { String description @ManyToOne Person person } If I follow proper HAL guidelines I'm not supposed to expose entity id's. Since I don't have a bi-directional relationship I cant PUT or PATCH to http://localhost:8080/persons . Even if I did create the relation, I probably wouldn't want to first POST the Task to