This commit implements the components described in DATAREST-40. The core of it is the ResourceProcessingHandlerMethodReturnValueHandler. It gets ResourceProcessor and ResourcesProcessor instances handed into its constructor and selects the ones that need to be invoked in the calls to handleReturnValue(…). In this process it does a variety of generics checks to ensure only the correct post-processors. To do so it inspects the controller method's return type, the object value type as well as the returned value potentially. Assume we have a specialized Resource type StringResource extends Resource<String>. Beyond that we have a ResourceProcessor<Resource<String>> registered. Here's the decision matrix: Return type Returned type What get's used? Resource<?> Resource<String> object value inspected (Resource.getContent()) Resource<String> Resource<String> method return type Resource<String> StringResource object value type as it's more specialized StringResource StringResource method return type Resource<?> Resource<Long> no invocation, object value doesn't match Resource<? extends Number> Resource<Long> no invocation, object value doesn't match Resource<Long> Resource<Long> no invocation, object value doesn't match This works exactly the same for Resources returned. We peek into the collection returned by getContent() in case return value inspection is needed for type matches. If the collection is empty we don't match. The same applies to null values returned. The second component added is the ResourcePostProcessorInvokingHandlerAdapter which customizes the setup of a RequestMappingHandlerAdapter by fronting the current configuration with the ResourceProcessingHandlerMethodReturnValueHandler to let it intercept the handling and potentially call the post-processors. Upgraded to snapshots of Spring Data Commons until we get to the next release and added Mockito as dependency.
26 lines
540 B
Properties
26 lines
540 B
Properties
# Logging
|
|
slf4jVersion = 1.6.6
|
|
logbackVersion = 1.0.6
|
|
|
|
# Libraries
|
|
springVersion = 3.1.2.RELEASE
|
|
cglibVersion = 2.2.2
|
|
|
|
# Languages
|
|
groovyVersion = 1.8.6
|
|
|
|
# Supporting libraries
|
|
sdCommonsVersion = 1.4.0.BUILD-SNAPSHOT
|
|
sdJpaVersion = 1.2.0.BUILD-SNAPSHOT
|
|
jacksonVersion = 1.9.7
|
|
hibernateVersion = 4.1.4.Final
|
|
|
|
# Testing
|
|
spockVersion = 0.6-groovy-1.8
|
|
|
|
## OSGi ranges
|
|
spring.range = "[3.0.7, 4.0.0)"
|
|
jackson.range = "[1.9, 2.0.0)"
|
|
|
|
sdRestVersion = 1.0.0.BUILD-SNAPSHOT
|