We're now caching meta information about controller methods and their parameters more aggressively to avoid repeated lookups of such information via reflection. We're also keeping reference to proxy classes generated through CGlib around to avoid costly regeneration.
Note that the main culprit causing the drastic numbers reported in the original ticket stem from a problem in Spring's TypeDescriptor which triggers costly equals(…) comparisons on synthesized annotations [0].
Removed conditional reflective lookup of DefaultParameterNameDiscoverer as it's now present by definition.
[0] https://jira.spring.io/browse/SPR-14926
We now support composed annotations using @AliasFor such as @GetMapping that are mixed with @RequestMapping on type and method level.
@RequestMapping("type")
class MyController {
@GetMapping("method")
String method() {
…
}
}
Original pull request: #497.
ResourceProcessorInvoker suffered from Spring's ResolvableType.fromClass(…) using strong assignability checks between raw types and wildcarded right hand side types (i.e. Collection VS. Collection<?>). This has been reported [0] and fixed already but we have to switch to ResolvableType.fromRawClass(…) to get the desired assignment check behavior.
Tightened unit tests to verify the calls to the delegate handler, which had been disabled by accident and thus prevented us from detecting the issue with ResolvableType beforehand.
[0] https://jira.spring.io/browse/SPR-14648
Added a Spring 5 specific build profile and removed the references to AnnotationMethodHandlerAdapter which already had been deprecated in the latest Spring 3 in favor of RequestMappingHandlerAdapter.
Updated Spring build profiles in general.
The HalHandlerInstantiator now accepts an AutowireCapableBeanFactory to delegate component creation requests to for non pre-build serializers. This allows other serializers to benefit from Spring instantiation but at the same time use the dedicated serializers created as singletons.
Switched to a regular expression based split of links to make sure URIs that contain commas do not interfere with the rather simplified splitting algorithm we used before.
Changed invocations of constructors of the super class in Jackson Serializers to use JavaType instead of Class<?> as the constructor has been removed in some of the base classes in Jackson 2.7.
Upgraded to Jackson 2.5.5 along the way.
ControllerLinkBuilderFactory now forwards the source UriComponents to the ControllerLinkBuilder instead of turning it into a URI and a UriComponentsBuilder in turn.
Original pull request: #422.
DefaultCurieProvider now automatically adds the application URI (servlet mapping) in case the UriTemplate configured does not contain an absolute URI in the first place.
Re-introduced the simple isEmpty(…) methods in custom Jackson serializers as the more complex ones were introduced in Jackson 2.5 only. Removed the @Override annotations so that we could even compile against 2.4 if needed.
We now avoid calling URI.toString() to early to prevent the need to re-parse it and thus accidentally cause a double-encoding.
Original pull request: #382.
HalLinkListSerializer now tries to obtain a link title by looking up key _links.$rel.title for both the namespaced (curied) and local link relation if the former doesn't resolve into a message.
The curie rendering has been improved in the following ways:
- Resources now get their embeds inspected for namespaced keys and curies are added if at least one is found. This makes sure curies are also rendered if no namespaced link is registered.
- Nested resources skip curies entirely, assuming they have been added to the root correctly.
Had to change the order of _embedded and _links to make sure the embedded elements are processed first to tweak the links to indicate the need for curies.
DefaultCurieProvider now also takes a Map<String, UriTemplate> to expose multiple curies. The default curie to be used to expand unprefixed, non-IANA link relations has to be defined explicitly in case more than one curie is if given. If there's only one, that becomes the default, too.
Added missing override for isEmpty(…) that gets used by Jackson 2.6+ to prevent { templated : false } get rendered in HAL link representations.
Polished Javadoc on the way.
Switched from overrides of the deprecated (and removed in 2.6) isEmpty(T) to isEmpty(SerializerProvider, T). Switched from deprecated @JsonSerialize(include = …) to the dedicated @JsonInclude annotation.
We now locally resolve the generic type using Jackson's JavaType in canRead(Type, Class, MediaType) to avoid having to call the non-generic method as this caused us having to tweak it's implementation to avoid the super.canRead(Class, MediaType) check as this in turn forwards to the generic method (which then would've caused a stack overflow.
Turned hop into a real value object by making it immutable. Added unit tests for Hop. use verbose concept names instead of abbreviations (e.g. parameters instead of params). Additional assertions and the documentation of such in JavaDoc. @since tag in new Hop class.
Original pull request: #350
Introduced a dedicated value object to abstract a Hop within a relation traversal. The Hop consists of a relation name and optional local template parameters that are applied to this particular hop when traversing it.
Changed the implementation of Traverson to work with Hops instead of plain rels and merges the global template parameters with the hop-local ones before expanding the templates found.
Original pull request: #350.
Extracted exception message into a constant. Added author where necessary and extended copyright headers. Fixed import order. Moved unit test into ControllerLinkBuilderUnitTest. Tweaked it to use JUnit rule.
Original pull request: #344.
We now explicitly check whether we could look up request attributes and throw an exception with a message indicating the cause of the failure.
Original pull request: #344.
We now explicitly disable the "fail on unknown properties" deserialization feature for the ObjectMapper instance used with our default HAL setup to be able to use it with a RestTemplate out of the box.
ControllerLinkBuilderFactory now checks the default value of an @RequestParam annotated handler method parameter before triggering strict validation.
Original pull request: #332.
Relation names can be fully qualified URIs. HalLinkDiscoverer now quotes the relation name handed into the constructor so that the expression parsing works as expected.
We now reflectively invoke the JSONPath.compile(…) method as the method signature has changed but we need to stay compatible with 0.9 to allow the Spring Data Evans release train to upgrade to 0.17 without a major third-party dependency upgrade.
Copied the reflective method lookup from Spring's JsonPathExpectationsHelper.
Related ticket: #297, #305.
Renamed the Resource, Resources and PagedResources types in TypeReferences to *Type so that new TypeReferences.Resources<User>() {} now becomes new ResourcesType<User>() {}.
Prior to this change a static import of TypeReferences would've cause the actual Resource types to be fully qualified.
673f82d introduced a glitch in a delegation within ControllerLinkBuilder.linkTo(Class<?> controller, Method method, Object... parameters) which is fixed by this commit.
Original pull request: #300.
Fixed imports in production code and test cases. Extended copyright range. Extracted request parameter handling into dedicated method. Added missing ticket reference.
Original pull request: #210.
Introduced Traverson.getDefaultMessageConverters(…) to be able to obtain the list of default HttpMessageConverters depending on the given media types. Added overloads for varargs as well as a List for consistency.