-
Notifications
You must be signed in to change notification settings - Fork 470
links vs _links #690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Show me a controller. |
|
Some suggestions:
Let me know if this helps with your results. |
Wrapped these collections. (Also moved bean definitions to
Now I get this stacktrace. I don't understand the cause at this moment. I'm not using any kind of XML serialization in this project.
|
UPD: If I add |
In a browser it will try XML before JSON. curl will go straight to JSON. This is classic Spring MVC. You can either use produces as you have done. Or simply append ".json" to the route. Regarding the output I'm confused. _links is HAL. links is not HAL, but instead a non standard representation. |
I've already figured out how to get rid of this exception (I've set produces attribute in
This is sample json+hal generated by it. It has "links" instead of "_links". I assumed that spring library will generate 100% pedantic json+hal and tried to mimic it.
|
You are referring to a Spring Data repository. If this is Spring Data REST, you'll find that all the REST controllers leveraging scanned repositories return ResourceSupport-compatible types. When you don't, you get non-HAL stuff. Please read the spec if you don't believe me when I say that fragment up above isn't HAL. |
How to make Spring Data repository return valid HAL then? Did I overlook something in spring data repositories' initialization? |
After giving it some thought, I've discovered this fragment.
Removing default media type did the job. I don't remember exactly under which circumstances I've added this. Maybe I had to explicitly say ;charset=utf8 in each response to deal with russian strings. You can close this issue. |
Uh oh!
There was an error while loading. Please reload this page.
(spring 1.5.9)
I'm using both
@RepositoryRestResource
and regular@RestControllers
returning instances of entities extendingResouceSupport
. I've noticed that CRUD methods provided by repositories are exposing links as 'links' field while former ones expose them as '_links'. How to make then expose links in more consistent way?UPD: If i return my entities via Collections.singletonList(),
links
field seem to have correct name.The text was updated successfully, but these errors were encountered: