Commit Graph

28 Commits

Author SHA1 Message Date
Oliver Gierke
220366b240 Method links. 2012-12-19 10:40:15 +01:00
Oliver Gierke
0e0bf16957 #31 - Introduced LinkDiscoverer to extract Link instances from representations.
LinkDiscoverer exposes an API to find Links by their relation types in representations. Added JSONPath based base class and a DefaultLinkDiscoverer that finds Links based on the default rendering of our Jackson mappings.
2012-12-15 19:07:03 +01:00
Alexander Bätz
7af38348a9 #29 - Added support for HAL-style representation of Links.
Added Jackson 1 and 2 modules to render Link objects in a HAL-compliant way. Introduced custom Jackson mixins to avoid introducing new value objects for the representation model. 

The rendering can be activated by simply registering Jackson1HalModule or Jackson2HalModule with the Jackson ObjectMapper.
2012-11-20 12:39:48 +01:00
Oliver Gierke
c7396c24a9 Cleaned up hashCode() method in PagedResources. 2012-11-18 18:58:07 +01:00
Oliver Gierke
a1b706c21c Added assertions based on EntityLinks interface. 2012-11-18 18:57:43 +01:00
Oliver Gierke
40b486cb43 #27 - Added support for Jackson 2.
Added Jackson 2 dependencies. Doubly annotated representation model classes with both Jackson 1 and Jackson 2 annotations. Added Integration tests for Jackson 2 marshaling provided by Jon. Polished template.mf.
2012-11-16 21:32:47 +01:00
Oliver Gierke
04be1871c3 Introduced EntityLinks abstraction.
EntityLinks allow accessing LinkBuilders or even Link instance based on components exposing REST resources for a particular domain type. The core implementation is ControllerEntityLinks that assumes a particular URI structure so that it can derive the URIs to be asked for per domain type. The domain type managed will be inspected from the @ExposesResourceFor annotation on a controller class. We provide a factory bean to allow configuring instances of ControllerEntityLinks based on a mapping annotation and LinkBuilderFactory.

Added infrastructure to activate automatic discovery of EntityLinks implementations through @EnableEntityLinks. This will automatically register ControllerEntityLinks instances for Spring MVC controllers annotated with @ExposesResourceFor as well as JAX-RS resources if JAX-RS is on the classpath. The mechanism essentially registers a DelegatingEntityLinks instance leveraging the Spring Plugin PluginRegistry mechanism to delegate to the actual EntityLinks instance actually registered for the entity type. It will become the primary EntityLinks bean in the ApplicationContext so that they can be autowired into client components safely.
2012-10-29 15:21:28 +01:00
Oliver Gierke
b8add74fc1 Improvements to LinkBuilder API.
Renamed UriComponentsLinkBuilder to LinkBuilderSupport and moved it from mvc into core package. slash(Object object) now transparently unwraps Identifiables<?>.
2012-10-29 15:02:21 +01:00
Ricardo Gladwell
9e728b4660 #13 - Introduced LinkBuilder implementation inspecting JAX-RS @Path annotation.
Refactored LinkBuilder(Factory) classes to extract reusable code into common superclass for ControllerLinkBuilder and JaxRsLinkBuilder.
2012-09-13 17:42:54 +02:00
Oliver Gierke
acdb0c8a5b #11 - Revert to List for links in ResourceSupport.
The order of the links needs to be stable across different requests. Thus we have to revert to List instead of a Set.
2012-09-12 12:51:28 +02:00
Ricardo Gladwell
fc4eebd128 #12 - Introduced interfaces for LinkBuilder(Factory) to improve testability.
LinkBuilder and LinkBuilderFactory interface extracted from ControllerLinkBuilder for easier mocking and so that alternative implementations (such as for CXF) can be created.
2012-09-12 12:43:02 +02:00
Oliver Gierke
c5ee47cce4 Resources - Make returned content Collection immutable. 2012-08-30 14:19:16 +02:00
Oliver Gierke
dab25f25fc Resources - Switched from Collection to Iterable for source content. 2012-08-30 14:19:16 +02:00
Oliver Gierke
b33231ffaa Polished Javadoc of ControllerLinkBuilder. 2012-08-30 14:19:09 +02:00
Oliver Gierke
91a6e99e3f Renamed ResourceProcessor.{enrich(…) -> process(…)}. 2012-08-27 19:08:11 +02:00
Oliver Gierke
15a2092cf7 Moved back to Resource{Enricher -> Processor} to allow exchanging the Resource. 2012-08-24 21:46:17 +02:00
Oliver Gierke
5bc711ee9b #11 - Moved from List to Set for Links in ResourceSupport. 2012-08-24 21:29:02 +02:00
Oliver Gierke
ee515f6f04 #10 - Renamed fromEntities(…) to wrap(…). 2012-08-23 23:59:29 +02:00
Oliver Gierke
a4bf7fb4bf #9 - Added constructors taking Iterable<Link> to resource abstractions. 2012-08-23 23:57:13 +02:00
Oliver Gierke
7646e11a26 #7 - Added @JsonIgnore to ResourceSupport.getId().
Added integration tests for the JSON marshaling.
2012-08-23 23:56:25 +02:00
Oliver Gierke
1bb4669828 Polished Resources abstraction.
Added correct equals(…)/hashCode() methods to PagedResource, PageMetadata. Polished toString() methods of ResourceSupport, Resource, Resources and PagedResources. Added factory method to PagedResources to easily create a plain instance from a set of entities.
2012-08-23 18:34:21 +02:00
Oliver Gierke
2c5dfc12f6 Replaced Resource(s)Processor with ResourceEnricher. 2012-08-23 00:08:51 +02:00
Oliver Gierke
6c368faa0e #5 - Added equals(…) / hashCode() to Resource/Resources. 2012-08-22 18:37:52 +02:00
Oliver Gierke
bc09140769 #3 - Added PageableResources value object 2012-08-17 18:39:41 +02:00
Oliver Gierke
ca57ed440d Enhancements of Resource abstraction.
Introduced Resource and Resources value objects. The former captures single entity instances but adds links to it. The latter does the same for a collection of entities. Added SPI interfaces ResourcePostProcessor and ResourcesPostProcessor to allow manipulating Resource and Resources instances.
2012-08-07 19:17:51 +02:00
Oliver Gierke
cd3e433d98 Incorporate feedback from @rstoyanchev.
Improve ResourceAssemblerSupport by introducing a dedicated method instead of an overload. Got rid of EntityId in the course. ControllerLinkBuilder now inspects type hierarchy for @RequestMapping annotations instead of the class only. Made links list in ResourceSupport final. Polished variable names and JavaDoc.
2012-07-19 13:32:02 +02:00
Oliver Gierke
0b15928dd6 Javadoc polishing. 2012-07-19 13:17:12 +02:00
Oliver Gierke
21b1a4ec8c Initial commit. 2012-05-10 20:25:31 +02:00