Questions tagged [spring-hateoas]

Spring HATEOAS provides some APIs to ease creating REST representations that follow the HATEOAS principle when working with Spring and especially Spring MVC. The core problem it tries to address is link creation and representation assembly.

HATEOAS (Hypertext As The Engine of Application State)

Resources

Clarification by Roy Fielding that HATEOAS is required for REST.

Building REST services with Spring explains what HATEOAS is, why it is required for REST and how to implement it using Spring MVC and Spring HATEOAS.

779 questions
0
votes
1 answer

Spring Hateoas Ignoring Query Parameters

Spring Hateoas is not creating the appropriate link for the following request mapping: @GetMapping("/member/{id}") public MemberResource getMemberById(@RequestParam String id){ Member member = MemberService.getMemberById(id); return new…
user1870035
0
votes
1 answer

How to use HATEOAS with a custom page

I'm using spring boot to create a web service. I'm trying to introduce HATEOAS to an endpoint. Here's the model(DTO): public class MovieResponse { private Long id; private String name; private Date releaseDate; private Time runtime; …
Ayoub k
  • 7,788
  • 9
  • 34
  • 57
0
votes
1 answer

Override link path for subclasses in Spring Boot

I have a Spring Boot 2.x application backed by MongoDB. I'm trying to add some simple inheritance to my domain model along the lines of: Parent: Person.java // JSON annotations to assist in serializing requests to the right class @JsonTypeInfo(use =…
Bill
  • 347
  • 4
  • 13
0
votes
1 answer

Spring hateoas renders _links as link

So, first of all, apologies if this is a little light on details, but I've been tearing my hair out over this for a whole day, and have not been able to reproduce the issue outside of this project with no luck, and really hope the community can help…
vruum
  • 455
  • 1
  • 5
  • 14
0
votes
5 answers

Spring Rest URL /rest/v1 is beeing added

I am working on a existing project where the restControllers has a restmapping @RequestMapping(value = "/test"). There is no base URL added. I have checked all the option where the baseURL gets added but i dont find any in my application. When i run…
Learner
  • 237
  • 4
  • 15
0
votes
1 answer

Duplicate _links key in Projection REST responcse

to add my links in the Json frame of a projection I added the following class: @Component public class ResumeEntityProjectionResourceProcessor implements ResourceProcessor> { @Override public Resource
Dali
  • 135
  • 2
  • 13
0
votes
1 answer

Is there a way to generate links for entity associations like in Spring Data REST?

I'm using Spring Data REST to build my application. It's been working very well so far, but I'd like to add some customizations to returned entity while still keeping the automatically generated links. I'd like to do something like…
SHTJ
  • 13
  • 4
0
votes
1 answer

How to fill Spring Cloud Sleuth Trace ID into logRef field of VndError in spring-hateoas?

I have a @ControllerAdvice which is returning VndError from spring-hateoas. VndError specifies a logRef field which is where I should be putting the Trace ID from Spring Cloud Sleuth. Is there an official way to do this, or should I just retrieve…
0
votes
0 answers

ResourceSupport behaves different when Swagger is present

I have a class UserMetasource extending ResourceSupport (from Spring Hateoas): public class UserMetasource extends ResourceSupport { public UserMetasource() { this.add(linkTo(methodOn(UserController.class).getRoles("roles"))); …
Héctor
  • 24,444
  • 35
  • 132
  • 243
0
votes
1 answer

Removing _embedded from a collection of REST resources

Maybe this goes against REST/HAL principles but I thought that if I was viewing a list of items they should not be contained in an _embedded tag. Below is the details returned when I navigate to /characters in my spring boot application. I had…
LiamRyan
  • 1,892
  • 4
  • 32
  • 61
0
votes
1 answer

Custom Spring Data Rest Controller with HATEOAS Support

I am implementing Spring Data REST in one of my project. I have to write a few custom Repository in order to write custom queries. I am using a Controller in front of my REST Repository. In order to get a HATEOAS response, I am using…
Avinash Sagar
  • 527
  • 4
  • 10
0
votes
1 answer

Spring Data Projection size()

Is there a way to return the size of a collection via rest api projection? Consider this example: The data: @Entity @Table public class MyData { // id // ... @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval =…
sotix
  • 822
  • 1
  • 8
  • 23
0
votes
2 answers

Why spring create tow identical links for self and rel?

I cannot get why spring create the same links for self and rel? Is there a way how to disable it? I think that this only my issue because I didn't meet such problem in docs I read. Here is my entity mapping: @Getter @Setter @Document public class…
slesh
  • 1,902
  • 1
  • 18
  • 29
0
votes
2 answers

Can Spring-Data-Rest handle associations to Resources on other Microservices?

For a new project i'm building a rest api that references resources from a second service. For the sake of client convenience i want to add this association to be serialized as an _embedded entry. Is this possible at all? i thought about building a…
Laures
  • 5,389
  • 11
  • 50
  • 76
0
votes
1 answer

How can I force @AutoConfigureJsonTesters to use HAL format from spring-hateoas?

I have a small module that should only contain the resource model of my REST service. I want to create a test in this module to ensure that the resource model serializes and deserializes appropriate HAL format. I have a single test and this is the…