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

HATEOAS links are wrong if using JsonSubTypes

I am using spring data rest with Mongo to expose a class with multiple subtypes. When I do this, HATEOAS is compartmentalizing the results based on the actual instantiated type, rather than the common base type. This results in the links being…
clifwlkr
  • 1
  • 1
0
votes
1 answer

How to generate a Hateoas link containing sortBy query parameter(and it's possible values), using Spring Hateoas?

I am having below a controller(just for example) method: @Autowired EntityLinks entityLinks; @GetMapping(value = "{userId}", params = "sortBy") public Resource getUser(@PathVariable Integer userId, @RequestParam String sortBy ){ …
The Coder
  • 3,447
  • 7
  • 46
  • 81
0
votes
1 answer

How to know the name of the resource from an Entity class, to build a Hateoas link to that resource?

Suppose I have two resources Person and Article @Entity @Table(name = "person") public class Person { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long person_id; private String firstName; private String…
The Coder
  • 3,447
  • 7
  • 46
  • 81
0
votes
1 answer

Hibernate makes unnecessary subquery to fetch data

I'm using Spring Boot 2.x, Spring Data REST, Spring HATEOAS. I'm exposing a Repository over REST: @Transactional @PreAuthorize("isAuthenticated()") public interface DocumentRepository extends JpaRepository, JpaSpecificationExecutor…
drenda
  • 5,846
  • 11
  • 68
  • 141
0
votes
1 answer

Odd JSON Property Name With Combination of Spring Data Web Support, Pageables, Projections, and HATEOAS

I'm having an issue with the HAL output that I get when combining Spring Data Web Support, Pageables, Projections, and HATEOAS. I have a JPA entity, with an interface projection. I have a JPA repository with a findAllProjectedBy(Pageable). public…
Jeff Walker
  • 1,656
  • 1
  • 18
  • 36
0
votes
1 answer

How to change Hateoas output format in spring application?

I am currently working on a spring application that offers a REST interface with which CRUD operations on entities of various kinds can be performed. These entities are stored in repositories and thus a major part of the REST interface is…
Javan
  • 189
  • 1
  • 7
0
votes
1 answer

Can I add additional fields to vnd.error?

In Spring HATEOAS, you can return a VndError object that looks like this: [ { "logref" : "some request id", "message" : "your request was incorrect." } ] The mime type specification mentions some optional and required fields, but does…
Titulum
  • 9,928
  • 11
  • 41
  • 79
0
votes
1 answer

How to create custom PersistentEntityResourceAssembler with Spring Data REST

I'm using Spring Boot 2.1, Spring Data REST, Spring HATEOAS, Hibernate 5. I'm looking for a way to filter fields in REST calls. I'm going to use https://github.com/bohnman/squiggly-java but I want to integrate it in Spring resource assembler. I'm…
drenda
  • 5,846
  • 11
  • 68
  • 141
0
votes
0 answers

Is it possible to use spring hateoas with router function?

Is there a way to use spring hateoas with router function ? Right now it seems to me that the only way would be to replace my RouterFunction by RestController.
Xavier Bouclet
  • 922
  • 2
  • 10
  • 23
0
votes
1 answer

ResourceAssembler not returning the right path(created resource path) in response _links

I have a controller to POST jobs of a user. On successful creation, the response should contain the created resource's link. For that I wrote the below ResourceAssembler public class UserJobResourceAssembler implements ResourceAssembler
The Coder
  • 3,447
  • 7
  • 46
  • 81
0
votes
1 answer

Returning different Resource type Lists from one method

I have this method for a GET request with a parameter embedded. The main idea is if the link contains ?embedded=true it returns the entity and if it's not true then it returns a DTO object: @GetMapping("/todos") public List>…
0
votes
0 answers

Sping: @EnableHypermediaSupport gives error "No constructor with 0 arguments defined in class ConverterRegisteringWebMvcConfigurer"

I am following Spring Hateoas documentation where it is mentioned : To enable the ResourceSupport subtypes be rendered according to the specification of various hypermedia representations types, the support for a particular hypermedia…
The Coder
  • 3,447
  • 7
  • 46
  • 81
0
votes
1 answer

How to forward headers when using Zuul, Hystrix (and Feign) with Spring Cloud HATEOAS?

Context My micro-services application is based on spring-cloud: a zuul gateway is configured in front of two micro-services: service-a and service-b. One of my API requires that service-a requests service-b; I use feign for that. Zuul send…
0
votes
1 answer

Maven incorrect dependancy version resolution

When including the latest Spring Hateoas Starter, Maven is downloading the incorrect Spring Hateoas. org.springframework.boot spring-boot-starter-hateoas
Kenneth Clark
  • 356
  • 1
  • 14
0
votes
1 answer

Spring HATEOAS wrong self link with linked resources

I'm using Spring Boot 2.0.3, Spring Data REST, Spring HATEOAS. My domain model is quite structured but lately I found a strange behaviour in self links. I'm going to show part of the model to point out the problem, removing useless…
drenda
  • 5,846
  • 11
  • 68
  • 141