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.
748
questions
0
votes
0
answers
19
views
Spring HATEOAS: suppress null references [duplicate]
I'm using Spring Data Rest and wonder how to properly deal with optional references (i.e. which may be null) - for example:
@Entity
public class Student {
// ... @Id, getters, setters omitted
...
0
votes
1
answer
50
views
When extending the RepresentationModel<T> class of HATEOAS in the model using mongodb the application no longer works - spring boot
I'm studying spring building an API using spring-boot,mongodb,lombok, mongock... this
project.
When putting HATEOAS I had problems, I noticed that it was related the moment I inherit the ...
0
votes
2
answers
31
views
Springboot HATEOAS for PDF, Image and Zip Files
This is my first time working with HATEOAS everyone and I have come to a screeching halt. Here is my problem, I have an app that converts text from a text area to a pdf and a pdf to images. My issue ...
0
votes
1
answer
55
views
Spring Hateoas error from EntityModel : Content is not a Map
I am upgrading spring-hateoas from 0.20.0.RELEASE to 1.3.7
I replaced ResourceSupport with RepresentationModel and Resource with RepresentationModel.
While deserialising the JSON of the DTO I am ...
0
votes
1
answer
36
views
Migrate ResourceSupport to RepresentationModel
I have this code which I would like to migrate to latest Spring hateoas version. I tried this:
@JsonInclude(Include.NON_NULL)
public class TransactionResource extends RepresentationModel {
@...
2
votes
1
answer
63
views
Replace deprecated InvocationRecordingMethodInterceptor
I have this old hateos code which I would like to migrate to latest Spring hateos version
import org.springframework.hateoas.core.DummyInvocationUtils;
public LinkBuilder linkTo(Object ...
2
votes
1
answer
97
views
Migrate builder to Spring hateoas 2.6.7
I have this old code implemented in hateoas:1.0
public class StaticPathLinkBuilder extends LinkBuilderSupport<StaticPathLinkBuilder> {
@Override
protected StaticPathLinkBuilder ...
0
votes
0
answers
78
views
Spring HATEOAS with OpenAPI Generator
I have an OpenAPI specification and generating code for my spring boot application. The RequestMapping contains a variable with a default value after generating the code.
@Generated(value = "org....
1
vote
1
answer
62
views
Concise HAL+JSON and JSON endpoint implementation?
Is it possible to concisely implement a single HAL-JSON & JSON endpoints in Spring Boot 2? The goal is to have:
curl -v http://localhost:8091/books
return this application/hal+json result:
{
&...
-7
votes
1
answer
132
views
Return link from Hateos
I have this old Spring Hateos code which I want to migrate to the latest version:
Map<String, Link> links = new HashMap<>();
links.put(Link.REL_NEXT, response.getLink(Link....
0
votes
1
answer
31
views
Replace ControllerLinkBuilder in latest Spring HateOAS
I have a old project with the following Spring hateoas import dependency:
import org.springframework.hateoas.mvc.ControllerLinkBuilder;
Do you know into the latest version how I can replace this ...
0
votes
0
answers
66
views
openapi scheme generated does not contains "content" of EntityModel spring-hateoas entities
I'm using :
springdoc-openapi-ui : 1.6.6
springdoc-openapi-hateoas: 1.6.8
swagger-models: 2.1.12
spring-hateoas: 1.4.1
When i retrieve the generated openapi scheme from my rest services i get ...
1
vote
1
answer
82
views
Hateoas - No suitable constructor found for Link(java.lang.String)
For a REST API, in the controller I'm applying hateoas. When adding the part of Link in the methods, I get the follow error:
Cannot resolve constructor 'Link(String)'
In the pom.xml:
<dependency&...
0
votes
0
answers
93
views
Spring MVC with HATEOAS
I use Spring MVC (no Spring Boot) with HATEOAS in order to get HAL-FORMS with Affordance response like this:
"_links": {
"index": {
"href": "/...
1
vote
0
answers
61
views
Representing a request body on HATEOAS link
I have a simple question regarding how do I link an endpoint through HATEOAS if that endpoint requires a valid @RequestBody? I've seen another question regarding this but with no straight answers and ...
0
votes
0
answers
45
views
Trouble adding Spring hateoas to Spring Boot Project
First post here so sorry if format is off.
Currently I am trying to follow this Spring Java tutorial: https://spring.io/guides/tutorials/rest/
I am just to the part of adding the hateoas dependency to ...
0
votes
2
answers
50
views
Should using Traverson for consuming Spring HATEOAS HAL response result in duplicate invocations of the service?
I have a REST endpoint (like http://myapi.rest.com/someEndpoint?offset=40&limit=20) that vends out HAL JSON response like the following
{
"_embedded": {
"listOfObjects&...
0
votes
1
answer
63
views
Is it possible to get a list of all streams using the spring cloud dataflow java rest client?
I'm using the spring cloud dataflow java rest client (https://docs.spring.io/spring-cloud-dataflow/docs/current/api/) and want to use it to retrieve all currently deployed streams.
It's easy enough to ...
0
votes
0
answers
145
views
Issue regarding jackson- Redis Serialization Exception
Im getting this exception while implementing Redis cache , i have downstream api which i m consuming , its using spring hateoas , it is returning some data but i got exception , looks some kind of ...
0
votes
0
answers
101
views
How to change Spring HATEOAS PagedResourcesAssembler default self, prev, next, last links format
I'm working with PagedModel and PagedResourcesAssembler and everything is great!
Everything is working except for its default link generation that is adding a peace of wrong information.
When ...
0
votes
1
answer
87
views
FeignClient with Hateoas PagedModel: Content is always empty
I have an endpoint which produces Hateoas:
@GetMapping()
public ResponseEntity<PagedModel<ContentModel>> getContent(
@RequestParam(required = false) final String sortBy,
@...
0
votes
0
answers
21
views
I cannot find "SimpleIdentifiableRepresentationModelAssembler" in Spring Hateos dependency
I am trying to add (by extending my class) SimpleIdentifiableRepresentationModelAssembler in my project and it seems even importing the hateos starter dependency in my build.gradle it still cannot ...
1
vote
1
answer
439
views
Migrate Spring hateos ResourceAssembler to RepresentationModelAssembler
According to this post ResourceAssembler is changed to RepresentationModelAssembler
I have this code which is using Spring HATEOAS 1.0:
import org.springframework.hateoas.ResourceAssembler;
public ...
0
votes
0
answers
37
views
OpenAPI 3.0 Error-ModelName for third party object
I am exposing my API using OpenAPI 3.0. One of the models that I created was extended from org.springframework.hateoas.RepresentationModel. The model can be seen under the /components/schemas/ ...
0
votes
0
answers
85
views
Testing Spring Hateoas Application with RepresentationModelAssembler
I'm trying to test my Spring Hateoas application, more specifically the controllers, using Springs @WebMvcTest. But I'm having problems injecting my custom RepresentationModelAssembler into the test.
...
0
votes
0
answers
101
views
Is there a way to incorporate other classes into a RepresentationModelAssembler in Spring HATEOAS?
I'm trying to server a Course object with all its objects into HAL + JSON content.
Each course has an additional object called a RoleManager, and each RoleManager is effectively a map between a Role ...
0
votes
0
answers
45
views
Auto generate hal links for in spring boot
Is it possible to have Spring Boot automatically generate hal links for rest controller just like it does for repository?
Lets assume that I have @Entity class named MyEntity.
If I create rest ...
0
votes
0
answers
31
views
Hateoas possibly adding "type" class to my json rseponse
I'm using spring-hateoas (i know i am using an old version, have to use this one to maintain spring4 dependencies in check) paired with MapStruct and for some reason when i generate the GenericEntity ...
0
votes
1
answer
127
views
Spring Hateoas: EntityModel _links rendered before content
This is a weird problem to describe since it's no actually a problem in the technical sense but still makes me curious enough to ask about it:
I created a @RestController that returns ResponseEntity&...
1
vote
0
answers
44
views
Spring Data Rest - Custom LinkRelationProvider is never used
I am creating a service based on spring-boot-starter-parent 2.6.1 and use spring data rest to expose my JPA repository:
public interface PointRepo extends CrudRepository<Point<?>, String> {...
0
votes
0
answers
51
views
Link to resource with mutually exclusive request parameters
I am trying to expose a REST resource with Spring HATEOAS that has mutually exclusive request parameters (when one parameter is present, the other should not be present), but I don't know how to get a ...
0
votes
0
answers
55
views
How to get only HAL-FORMS templates for a paged resource (page size=0 doesn't work)
We have a number of paged resources which also provide the client with HAL-FORMS templates for creating new instances of that resource. For example see the createShoppingList template below.
We tried ...
0
votes
0
answers
72
views
Spring HATEOAS not showing absolute URL for suspend functions
When adding a link to a resource, provided by a suspend function, it does not show the complete URL. For instance, having two entities A and B, which are returned by normal and suspend functions ...
0
votes
1
answer
194
views
Simplest path for custom media type in Spring HATEOAS?
I currently have a HAL output that looks like this:
{
"id": "00023687-7a6d-429f-a9d5-a900b1af4d27",
"property1": "value",
"property2": &...
0
votes
0
answers
90
views
Spring HATEOAS EntityModel: How to serialize nested objects
I have an entity like that:
@Entity
public class Content {
@EmbeddedId
private IdVersionPK key;
@Column
private String type;
@ManyToOne
private Contact contact;
@ManyToOne
private ...
0
votes
1
answer
256
views
Spring Hateoas: When consuming with RESTTemplate then content is always empty
I have an endpoint which produces hateoas resources:
@GetMapping()
public ResponseEntity<PagedModel<EntityModel<Content>>> getContent(
@RequestParam(defaultValue = "0") ...
0
votes
0
answers
72
views
Customize Hal link serialization
For api backward compatibility sake, I need to render _links without "{?projection}" param in href.
Each entity has an excerpt projection.
Each entity has relations/associations.
How do I do ...
0
votes
1
answer
82
views
Hal+json Model Mapping Error Unrecognized field "_embedded" Java Spring boot
I have gone through all the answers in stack overflow to find a propper solution for this. I am not able to deserialize the response to my class because of the field _embedded. And also I have a ...
0
votes
0
answers
29
views
Hateoas linkbuilder not working for object
I'm trying to create a link using hateoas for an object without @requestparam annotation in a GET request
My Controller :
@RequestMapping("/employees")
public class ...
0
votes
0
answers
127
views
Spring HATEOAS: Request Parameters show up as Path Variable in the link
In my Spring HATEOAS project, I'm sending the following URI for a GET request,
http://localhost:8080/emp_db/api/v4/employees/?firstName=Tom
But, the link in the response shows up as follows,
_links&...
0
votes
0
answers
45
views
Spring's HATEOAS CollectionModelAssembler does not parse property injected RequestMapping values
I'm learning Spring Boot's HATEOAS module and on line 4 of the recent() method below the call to toCollectionModel(recentTacos) is producing an IllegalArgumentException with the message:
Not enough ...
0
votes
1
answer
129
views
HATEOAS API Flutter client recommendations
I am working on a Flutter project that frequently accesses a Spring HATEOAS API. Up until now I have been accessing it with basic http calls, but I feel like I am wasting most of the potential of this ...
0
votes
0
answers
69
views
Spring boot HATEOAS with swagger model object
I am trying to implement HATEOAS on a current Rest endpoint in a Spring boot project. The project utilizes swagger model for Request and Response object.
/order/findAllOrders:
get:
tags:
...
0
votes
0
answers
106
views
Not getting hal+json response with Spring Boot 2.0
I have an application that I am trying to upgrade from Spring Boot 1.5 to Spring Boot 2.0. I have an API that is returning a response containing HAL Links.
Before the upgrade (HATEOAS v0.23.0.RELEASE) ...
0
votes
0
answers
282
views
Spring HATEOAS Hal Forms does not add current GET endpoint to the template section
I am trying to build a template part of the Hal Forms (application/prs.hal-forms+json) and expect to have current GET endpoint being visible in a template part of this response. But it ignores any ...
0
votes
0
answers
365
views
Spring WebFlux HATEOAS No Encoder for EntityModel with preset Content-Type 'null'
I'm trying to expose and consume an endpoint which produces application/x-ndjson and returns a HAL JSON:
(...)
<parent>
<groupId>org.springframework.boot</groupId>
...
0
votes
1
answer
286
views
When to use @EnableHypermediaSupport?
According to the Spring HATEOAS API,
Activates hypermedia support in the ApplicationContext. Will register infrastructure beans to support all appropriate web stacks based on selected ...
0
votes
1
answer
47
views
How do you replace sub entities with HATEOAS links?
I am trying to figure out how to process a series of results in my controller, yet still return links for inline sub resources.
when I hit the exposed repository endpoint, I get responses that look ...
0
votes
0
answers
58
views
We don't have a generic method to create rel link all controller endpoints in Spring hateoas 1.1.x
I am looking to create a rel link for all controller endpoints I expose in my application in a generic way using Java Reflection. Not by individually referring the controller and its respective method ...
12
votes
1
answer
9k
views
Spring server.forward-headers-strategy NATIVE vs FRAMEWORK
I recently upgraded spring boot from 1.x to 2.y and was facing this issue where hateoas links were generated with http scheme instead of https.
Later I discovered that with spring boot 2.2+, it is ...