Comments (2)
I found a "kind of working thing". If I set the header of the rest template request to prs.hal-forms+json
via headers.add("Accept", MediaTypes.HAL_FORMS_JSON_VALUE);
, then it works so long as I don't explicitly set what the endpoint produces.
If I set produces
in the GetMapping
to hal+json like so: @GetMapping(produces = MediaTypes.HAL_JSON_VALUE)
, and update the Accept header to also accept hal+json: headers.add("Accept", MediaTypes.HAL_JSON_VALUE);
, then the mapping from the response breaks and I get empty content.
from spring-data-commons.
I've updated my comment above. It still looks a bit weird to me and feels like something is broken here (probably my code :D but who knows)
Would really appreciate some help on this.
It does make sense in a way that setting Accept to hal-forms actually produces
{
"links": [...],
"content": [...]
}
which has exactly same structure as CollectionModel, so no wonder object mapper is able to handle it automatically
The question is there an automatic way to process CollectionModel as hal+json ? Or do I need to write my own object mapper logic?
Because the controller returns CollectionModel and produces hal+json by default unless explicitly changed via @GetMapper(produces = ...)
.
But consuming it via ParameterizedTypeReference<CollectionModel<EntityModel<>>>
doesn't seem to work in the same way.
from spring-data-commons.
Related Issues (20)
- Cache result of `RepositoryInformationSupport.getQueryMethods()` HOT 5
- Aligning internal caches with core framework patterns.
- Bug in AbstractPageRequest::hashCode
- Window.positionAt should always return exact position of element HOT 1
- Investigate potential solution to pass in additional options for scroll behaviour.
- More precise type information of factory bean definitions
- Release 3.1.12 (2023.0.12)
- Release 3.2.6 (2023.1.6)
- Release 3.3 GA (2024.0.0)
- Refine null-safety with NullAway build-time checks
- Allow custom bean name generator for repository HOT 2
- Unresolved self-recursive generics comparison causes `StackOverflowError` HOT 1
- Why is PersistentEntity created for types defined in CustomConversions? HOT 7
- members of Interface TypeInformation are null when AOP and Data Rest are enabled and a bean is marked @Lazy
- Apply Kotlin Value Class unboxing to generated Property Accessors
- Introduce `Parameter.getRequiredName()` and `Parameter.hasName()`
- `RepositoryConfigurationDelegate.getRepositoryInterface(…)` constructs `ResolvableType` with improper generics size
- Add SPI mechanism for ahead-of-time repository fragment registration
- Repository projections not working when projection type is part of entity object hierarchy HOT 1
- `PageableHandlerMethodArgumentResolver` should fall back to unpaged `Pageable` if necessary HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-commons.