Commit Graph

17103 Commits

Author SHA1 Message Date
Juergen Hoeller 52d124de6f Use supplier-aligned type information for FactoryBean type resolution
Issue: SPR-17063
2018-07-19 13:14:20 +02:00
Juergen Hoeller 0b60447c49 Javadoc update: ConfigurationClassPostProcessor is priority-ordered
Issue: SPR-17062
2018-07-19 11:59:40 +02:00
Juergen Hoeller d0bbbf4cae OrderUtils caches order values (for AnnotationAwareOrderComparator)
Issue: SPR-17064
2018-07-19 11:58:42 +02:00
Juergen Hoeller 1f5d0faf1f HandlerMethod caches interface parameter annotations
Issue: SPR-11055
2018-07-19 11:38:10 +02:00
Stephane Nicoll 999c169b1c Merge pull request #1888 from vpavic:patch-1
* pr/1888:
  Polish WebSession javadoc
2018-07-19 11:27:13 +02:00
Vedran Pavic b1e28a554a Polish WebSession javadoc
Issue: SPR-17051

Closes gh-1888
2018-07-19 11:26:49 +02:00
Rossen Stoyanchev 9498da5910 Clarify behavior of WebSession#save()
+ minor update to the InMemoryWebSession to match the defined behavior.

Issue: SPR-17051
2018-07-18 22:14:02 -04:00
Rossen Stoyanchev 66d73017d5 PathVariable consistently reflects value up to 1st ";"
Given "/{foo}" and "/a=42;c=b", previously that would be treated as a
sequence of matrix vars with an empty path variable. After the change
the path variable "foo" is "a=42".

This should be ok for backawards compatibility since it's unlikely for
anything to rely on an empty path variable.

Issue: SPR-11897
2018-07-18 22:14:02 -04:00
Juergen Hoeller 9c08a482d1 Prefer ArrayList/ArrayDeque over LinkedList for multi-element holders
LinkedList remains in place where a List is likely to remain empty or single-element (in order to avoid unused capacity).

Issue: SPR-17037
2018-07-18 22:17:42 +02:00
Rossen Stoyanchev 833aee9b2d Add SimpLogging and use o.s.messaging.simp classes
Issue: SPR-17012
2018-07-18 15:33:20 -04:00
Rossen Stoyanchev 4d6f2df3cb Add LogUtils and HttpLogging
SPR-17012
2018-07-18 15:32:50 -04:00
Juergen Hoeller 23d4862017 Find annotations on implemented generic interface methods as well
Issue: SPR-16060
2018-07-18 19:44:30 +02:00
Juergen Hoeller c77dbbb1e6 Specific exception for missing request header, cookie, matrix variable
Issue: SPR-14818
2018-07-18 18:56:51 +02:00
Sebastien Deleuze e8034f2f96 Adapt DefaultParameterNameDiscoverer to Graal constraints
When compiling or running as a Graal native image, no
ParameterNameDiscoverer is used.

Issue: SPR-17005
2018-07-18 17:17:47 +02:00
Juergen Hoeller 790d515f8c HandlerMethod exposes interface parameter annotations as well
The HandlerMethodParameter arrangement uses an approach similar to ModelAttributeMethodProcessor's FieldAwareConstructorParameter, merging the local parameter annotations with interface-declared annotations.

Issue: SPR-11055
2018-07-18 17:13:55 +02:00
Juergen Hoeller 28f7b26294 Null-returning instance supplier resolves to NullBean
Issue: SPR-17057
2018-07-18 15:26:06 +02:00
Juergen Hoeller f8553117d0 Polishing
(cherry picked from commit 4341838)
2018-07-18 14:58:43 +02:00
sdeleuze a87764f1fd Add support for Jetty Reactive Streams HTTP client
Leverage https://github.com/jetty-project/jetty-reactive-httpclient
to add support for Jetty in WebClient via JettyClientHttpConnector.

Implemented with buffer copy instead of optimized buffer wrapping
because the latter hangs since Callback#succeeded doesn't allow
releasing the buffer and requesting more data at different times
(required for Mono<DataBuffer> for example).
See https://github.com/eclipse/jetty.project/issues/2429.

Issue: SPR-15092
2018-07-18 14:49:49 +02:00
Sebastien Deleuze 3c9049d530 Leverage Jetty BOM
Issue: SPR-17058
2018-07-18 14:49:49 +02:00
Brian Clozel a7f97a1669 Avoid null signals when resolving handler arguments
Prior to this commit, resolving an argument for a WebFlux controller
that's missing from the request and not required by the handler would
throw a NullPointerException in some cases.

This involves the conversion of the parameter (a `String` parameter type
might not trigger this behavior) and sending a `null` within a reactive
stream, which is illegal per the RS spec.

We now rely on a `Mono.justOrEmpty()` to handle those specific cases.

Issue: SPR-17050
2018-07-18 14:41:43 +02:00
Juergen Hoeller 5fcfe0fa8e Polishing 2018-07-18 14:27:16 +02:00
Juergen Hoeller cab35aa788 StringUtils.parseLocaleString detects variant without country
Includes tests for parsing all available locales on the JVM, checking toString/toLanguageTag equality between parsed and original locale.

Issue: SPR-7598
Issue: SPR-16651
2018-07-18 11:10:26 +02:00
Stephane Nicoll d8ee1f5c83 Merge pull request #1887 from crewmanmud:patch-2
* pr/1887:
  Correct method signature in code example
2018-07-18 09:08:01 +02:00
Andrew McCallum d8878e4513 Correct method signature in code example
Closes gh-1887
2018-07-18 09:07:31 +02:00
Rossen Stoyanchev 6c4289e238 Polish 2018-07-17 17:39:16 -04:00
Rossen Stoyanchev 0bd7a3646c Update URI Encoding section 2018-07-17 15:58:27 -04:00
Juergen Hoeller b3d6283d7d CookieAssertionTests expects language tag compliance by default
Issue: SPR-16700
2018-07-17 18:18:54 +02:00
Juergen Hoeller ef9027e1c1 Polishing 2018-07-17 17:59:16 +02:00
Juergen Hoeller b8d2a16c31 UrlBasedViewResolver exposes redirect/forward prefix as bean name
Issue: SPR-17045
2018-07-17 17:58:19 +02:00
Juergen Hoeller 88e4006790 CookieLocaleResolver is RFC6265 and language tag compliant by default
Like CookieLocaleResolver, LocaleChangeInterceptor parses both locale formats by default now. Since it does not need to render the locale, its languageTagCompliant property is not relevant anymore at all.

The parseLocale method in StringUtils validates the locale value now and turns an empty locale into null, compatible with parseLocaleString behavior and in particular aligned with web locale parsing needs.

Issue: SPR-16700
Issue: SPR-16651
2018-07-17 17:57:59 +02:00
Juergen Hoeller 955665b419 Consistent processing of binding/validation failures for data classes
Includes an extension of SmartValidator for candidate value validation, as well as nullability refinements in Validator and BindingResult.

Issue: SPR-16840
Issue: SPR-16841
Issue: SPR-16854
2018-07-17 17:01:34 +02:00
Rossen Stoyanchev d8a2927dd3 Update URI links section after encoding changes
Issue: SPR-17039
2018-07-16 21:21:37 -04:00
Rossen Stoyanchev a41a1edd93 Switch to TEMPLATE_AND_VALUES as the default mode
DefaultUriBuilderFactory now uses EncodingMode.TEMPLATE_AND_VALUES by
default. However the RestTemplate explicitly sets it to the previous
setting EncodingMode.URI_COMPONENTS, so this affects mainly the
WebClient and any direct use of DefaultUriBuilderFactory to configure
either the RestTemplate or the WebClient.

Issue: SPR-17039
2018-07-16 21:21:37 -04:00
Rossen Stoyanchev 2a0eac47f9 Add TEMPLATE_AND_VALUES mode to DefaultUriBuilderFactory
Issue: SPR-17039
2018-07-16 21:21:37 -04:00
Rossen Stoyanchev 75e45103b5 Polish DefaultUriBuilderFactory 2018-07-16 21:21:34 -04:00
Juergen Hoeller b915e42c38 Resolve target type for GenericHttpMessageConverter.canWrite/write
Issue: SPR-16877
2018-07-16 19:45:35 +02:00
Juergen Hoeller cacd14c805 Never return null from AnnotationMetadata.getMetaAnnotationTypes
Issue: SPR-17046
2018-07-16 18:05:10 +02:00
Rossen Stoyanchev 5fb4982026 Support for encode() in UriComponentsBuilder
The ability to request to encode before `build()`, and more importantly
before expanding, allows stricter encoding to be applied to URI vars
and consequently to neutralize the effect of characters with reserved
meaning in a URI.

Issue: SPR-17039
2018-07-16 09:16:11 -04:00
Juergen Hoeller fe2eeb43f1 Upgrade to Groovy 2.5.1 2018-07-16 14:50:43 +02:00
Juergen Hoeller 77d72f1e01 Injected Map/Collection does not include null bean entries
Issue: SPR-17034
2018-07-16 13:04:38 +02:00
Juergen Hoeller faef363e85 Evaluate @Cacheable(condition) once per method invocation only
Issue: SPR-17024
2018-07-16 13:04:14 +02:00
Juergen Hoeller 93d91219fd Support for "cacheRegionFactory" injection with Hibernate 5
Issue: SPR-17043
2018-07-16 13:03:46 +02:00
Stephane Nicoll 333ec7400e Fix typo
Issue: SPR-17042
2018-07-15 16:17:48 +02:00
Juergen Hoeller f6fdffd663 Lazily retrieve delegate beans in AsyncConfigurer and CachingConfigurer
Introduces a configure method pattern for Supplier-style configuration and a common SingletonSupplier decorator for method reference suppliers. Also declares jcache.config and jcache.interceptor for non-null conventions.

Issue: SPR-17021
2018-07-14 19:29:32 +02:00
Juergen Hoeller 680afa75d8 ListableBeanFactory.getBeansOfType does not include null bean entries
Issue: SPR-17034
2018-07-14 01:02:39 +02:00
Rossen Stoyanchev 24a30baa2a Typos in InMemoryWebSessionStore 2018-07-13 17:51:23 -04:00
Rossen Stoyanchev 43fbd63254 Add maxSessions, getSessions, removeExpiredSessions
This commit removes the session threshold check added recently which
is not effective since maxIdleTime is usually much longer than the
frequency of checks. The lazy triggering of expiration checks during
create or retreive are simple and the most effective

This commit also adds a maxSessions limit on the total number of
sessions that can be created at any one time, a getSessions method
for management purposes, and a removeExpiredSessions public API
for manual triggering of expiration checks.

Issue: SPR-17020, SPR-16713
2018-07-12 16:12:19 -04:00
Brian Clozel 75fa9c4266 Fix checkstyle issues 2018-07-12 21:54:32 +02:00
Brian Clozel 038af9a303 Improve unknown status codes handling by WebClient
Prior to this commit, `WebClient` would throw `IllegalArgumentException`
when receiving an HTTP response with an unknown HTTP status code.

This commit is a follow up of SPR-16748 (supporting non-standard HTTP
status codes on the reactive `ClientHttpResponse`), and is mirroring
SPR-15978 (supporting non-standard HTTP status codes in `RestTemplate`).

With this change, `WebClient` now tolerates unknown status codes in some
cases, while not offering that choice as a first class citizen:
`HttpStatus` is still the preferred way to deal with HTTP status codes.

Here's how `WebClient` will behave when fetching the full response:

```
// Given a remote endpoint returning a "123" HTTP status code
Mono<ClientResponse> result = this.webClient.get()
				.uri("/status/123")
				.exchange();

// will still throw an IllegalArgumentException
HttpStatus status = result.block().statusCode();

// is safe and will return 123
int statusCode = result.block().rawStatusCode();
```

Resolving directly the response body with `retrieve()` is different.

```
// will send an error signal with a UnknownHttpStatusCodeException
Mono<String> result = this.webClient.get()
				.uri("/status/123")
				.retrieve()
				.bodyToMono(String.class);
```

In general, `WebClient` will provide high-level support
for well-known HTTP status codes, like error handling with
`WebClient.ResponseSpec#onStatus`.

For such support with unknown status codes, it is better to rely
on lower level constructs such as `ExchangeFilterFunction`.

Issue: SPR-16819
2018-07-12 19:08:08 +02:00
Juergen Hoeller f123d6c3bc Upgrade to Netty 4.1.27 and Commons Pool 2.6 2018-07-12 16:53:37 +02:00