spring data rest: why is all content exposed in general object uri (e.g. /files/), not only in specific uri (e.g. /files/1)

StackOverflow https://stackoverflow.com/questions/13430228

  •  30-11-2021
  •  | 
  •  

Question

I am setting up a project using spring data rest. Exposing my domain model seems to work, but I have some strange behaviour:

According to the wiki/docs if I access a uri like /files/ I should end up with an array of links to the single files. But, I get not only the links to the files, but also the attributs of the files objects when accessing the uri /files/.

This is anoying, because I have the content of the files as byte[] and I end up transmitting all contents of all files when accessing /files/

Does anybody know how to turn this behaviour off?

Was it helpful?

Solution

Ok, I just found the answer myself. I am posting this for others with the same question...

I have to use the header: "Accept: application/x-spring-data-compact+json" in my request to get the compact representation of my repositories...

That's it...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top