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
3 answers

Spring HATEOAS integration example

I am looking to develop a Spring MVC Integration with HATEOAS. I've searched the web and I didn't find any such working example through which I can understand HATEOAS concept. I only found this resource which itself has lots of code and is really…
PAA
  • 1
  • 46
  • 174
  • 282
0
votes
1 answer

How to add links to resources without any entities in Spring Data Rest

I have a very loosely couplet system that takes about any json payload and saves in a mongo colection. There are no entities to expose as resouces, but only controller endpoints eg. @RequestMapping(method = RequestMethod.POST, consumes =…
Preben
  • 63
  • 2
  • 9
0
votes
3 answers

How to display a link on a particular rel as an array even if there is only one link

for (Person person : company.getPersons()) { resource.add(linkTo(methodOn(PersonController.class).view(person.getId())) .withRel("persons")); } I want to return an array of links by "persons" rel. It's all ok if I have multiple persons,…
Vladimir Tsukanov
  • 4,269
  • 8
  • 28
  • 34
0
votes
0 answers

Spring ResourceSupport - return child class resource object based on type of the member

I have a resource called MyResource public class MyResource extends ResourceSupport { protected final Stuff stuff; public EventResource(Stuff stuff) { this.stuff= stuff; } public String getUserId() { return…
Sasanka Panguluri
  • 3,058
  • 4
  • 32
  • 54
0
votes
3 answers

Chage in spring data rest output format in spring-data-rest-webmvc version 2.2.1.RELEASE

I am using spring data rest web mvc 2.2.1.RELEASE. I am expecting out in below format { "content": [ { "price": 499.00, "description": "Apple tablet device", "name": "iPad", "links": [ { "rel":…
S Shukla
  • 77
  • 7
0
votes
0 answers

Is it alright to override MappingJackson2HttpMessageConverter to support HAL+JSON?

In my Spring Boot application, I have assigned the HAL object-mapper to MappingJackson2HttpMessageConverter. This is because my custom media-types end with +json and end up being recognized by the default converter. The custom…
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
0
votes
1 answer

Get Max value of a column from DB in Hal-Json using Spring Data REST

I have a Spring project where I access the database using Spring Data REST (using http://spring.io/guides/gs/accessing-data-rest/) @RepositoryRestResource(collectionResourceRel = "test", path = "test") public interface TestRepository extends…
mona
  • 6,079
  • 12
  • 41
  • 46
0
votes
1 answer

Spring Hateoas Causing an Exception "Cannot subclass final class void"

I have the following controller logic (business garbage removed) that is generating an IllegalArgumentException with the message "Cannot subclass final class void". package org.ghc.services.medicalsystem.controller import…
node42
  • 695
  • 4
  • 10
  • 19
0
votes
1 answer

Exchanging Spring Hypermedia Resources with HAL+JSON CURIEs via RestTemplate

I am using Spring Framework 4.1.0 and Spring HATEOAS 0.16.0 to develop both a Spring web application and a Spring test client for that application. The test client has a statement like: ResponseEntity> response =…
0
votes
1 answer

Spring RestTemplate: GET request causes 400 Bad Request

I am trying to create a client for the following URL: http://florist.herokuapp.com/products/1/categories Application.java public class Application { public static void main(String args[]) { RestTemplate restTemplate = new…
Gaurav Sharma
  • 4,032
  • 14
  • 46
  • 72
0
votes
1 answer

Proper place for setting form fields in ResourceSupport which don't exist in Entity

I have a model for logging in user in my REST API, corresponds to User table (email and password as table columns) @Entity public class User { @Id @GeneratedValues private Long id; private String email; private String password; +GET ,…
fortm
  • 4,066
  • 5
  • 49
  • 79
0
votes
1 answer

Validating a Spring ResourceSupport-ed parent resource as a not empty property in a child resource

I'm looking for guidelines into validating a parent admin resource (AdminResource extending the Spring ResourceSupport class) as not being empty (@NotEmpty) in a child admin module resource (AdminModuleResource extending the Spring ResourceSupport…
Stephane
  • 11,836
  • 25
  • 112
  • 175
0
votes
2 answers

Exposing a paginated search link and its arguments

I'm using the latest of Spring REST and HATEOAS trying to expose a link to a search endpoint. Here is the resource assembler: @Component public class AdminResourceAssembler extends ResourceAssemblerSupport { public…
Stephane
  • 11,836
  • 25
  • 112
  • 175
0
votes
3 answers

Spring hateoas xml serialization for list of resources built with ResourceAssemblerSupport

I am trying to support XML responses for my Spring HATEOAS based application. JSON responses work fine as well as XML for a single resource. The problem starts with the list of the resources. Spring MVC controller cannot serialize the list built…
MrkK
  • 873
  • 3
  • 12
  • 22
0
votes
1 answer

Spring HATEOAS setting href null when linked entity is null

I'm designing a REST api and to be as Restful as it gets I want to implement HATEOAS into the json responses. If the linked entities are not present in database say for example every user has a passport entity but if someone doesn't have then i…
dinesh
  • 465
  • 1
  • 5
  • 14
1 2 3
51
52