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

Infinite recursion on nested objects Spring REST

I'd like to know how to handle serialization with Spring REST with bidirectional relationships. I'm currently using Spring Boot the 1.3.0.BUILD-SNAPSHOT Currently I'm receiving and internal Server Error stating an infinite recursion on a GET request…
Baiteman
  • 535
  • 1
  • 4
  • 14
0
votes
0 answers

NullPointerException when using PersistentEntityResourceAssembler.getResource on existing Obj instance

I'm trying to build a restful controller with HAL links and custom methods. When I'm using a getResources from PersistentEntityResourceAssembler (HAL links) and this cause NullPointer. StackTrace java.lang.NullPointerException: null at…
0
votes
1 answer

Is there anything like spring-hateoas' AnnotationMappingDiscoverer for RESTEasy?

When using Spring's HATEOAS support, I really like the AnnotationMappingDiscoverer which helps avoid hard-coding REST resource paths in tests. With it, I can do things like discoverer = new AnnotationMappingDiscoverer(RequestMapping.class); Method…
E-Riz
  • 31,431
  • 9
  • 97
  • 134
0
votes
2 answers

With Spring Data REST, how to make custom queries use the HATEOAS output format?

I'm learning the Spring 4 stuff by converting an existing Spring 3 project. In that project I have a custom query. That query fetches data in a straightforward way, after which some heavy editing is done to the query results. Now the data is sent to…
Jerome P Mrozak
  • 1,907
  • 4
  • 21
  • 33
0
votes
1 answer

How to document a POST (HTTP method) using ControllerLinkBuilder?

I use ControllerLinkBuilder to create an index of links pointing to a list of Spring MVC controllers. For example: ResourceSupport resource = new ResourceSupport(); …
Rudy Vissers
  • 5,267
  • 4
  • 35
  • 37
0
votes
1 answer

REST HATEOAS: How to serialize nested resources (with Spring HATEOAS)?

I use Spring HATEOAS for creating a REST HATEOAS API in my application. It works well so far, but I'm stuck when it comes to nested resources. What is the right approach for mapping a class hierarchy like this to a REST HATEOAS resource: public…
krinklesaurus
  • 1,606
  • 3
  • 21
  • 38
0
votes
0 answers

_embedded is not coming in the Json response of Spring

I am new to spring. I have Customer.java import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import…
useranon
  • 29,318
  • 31
  • 98
  • 146
0
votes
1 answer

Why RestTemplate drops links from HAL+JSON response?

I am using RestTemplate for testing APIs exposed through Spring DATA REST and I cannot get links when parsing the response. The rest template is configured with Jackson2HalModule backed HttpConverter, and Entity requested has links to associations…
Anadi Misra
  • 1,925
  • 4
  • 39
  • 68
0
votes
1 answer

Add property to entity in spring data REST

I am trying out the ResourceProcessor interface in Spring Data REST. I don't think my Processor ever gets called. No error message either. Here is my processor (in Groovy): @Autowired PersonService personService @Override public Resource
Tracy Xia
  • 371
  • 9
  • 22
0
votes
0 answers

How to change Content-Location header in SDR association resource?

In my Spring project I'm using neo4j as the database layer, and as it's own GraphId is not entirely reliable, I am using textual ids (e.g. email address for users) for my nodes. I can change the HATEOAS links in my response resources, and they work…
0
votes
1 answer

Spring HATEOAS. Embedded resource + ability to CRUD it?

In typical situation with embedded resources: @Entity @Data class Item { id, name ... @ManyToOne @JoinColumn(name="status", referencedColumnName="ID") private Status status; } @Entity @Data class Status { id, name ... …
Dmitry
  • 557
  • 5
  • 12
0
votes
0 answers

Use a different column as path for resource

I have an entity that represents a table using Spring data. @Entity @Table(name="User") public class User { @Id @GeneratedValue @Column(name="user_id") private Long userId; @Column(name="username", unique=true, nullable=false) …
mrks_
  • 359
  • 4
  • 20
0
votes
1 answer

Error consuming subresources link with RestTemplate

We are developing a server that exposes an API, and a webapp that consumes this. The server uses spring-boot (1.2.4.RELEASE) and spring-data-rest. The webapp uses spring-hateoas to consume the API. We don't have problems consuming PagedResources,…
0
votes
0 answers

Spring HATEOAS + JPA links

I have a few JPA entities, Container and Thing. Container has a Thing field. Asking for /container/123 will return the object container with id 123, and two links: _self = localhost/container/123 and thing = localhost/container/123/thing However,…
Edu Garcia
  • 453
  • 7
  • 21
0
votes
1 answer

Spring Expose Controller Methods as Links

I have a Group entity that represents Groups (of users) in a database. The GroupRepository class has some methods that allow me to query the Group table, like, for example: List findByGroupName(String name); This method has a URL that's…
mrks_
  • 359
  • 4
  • 20