Commit Graph

2339 Commits

Author SHA1 Message Date
Pascal Schumacher aa656c47b8 Fix typo in notes on future deprecation of the RestTemplate
Issue: SPR-16993

Obvious Fix
2018-07-27 14:13:19 -04:00
Rossen Stoyanchev 91d17cf628 Add notes on future deprecation of the RestTemplate
Issue: SPR-16993
2018-07-27 08:41:20 -04:00
Rossen Stoyanchev bcb485b5ed bindToApplicatonContext uses WebSessionManager bean
Issue: SPR-17094
2018-07-26 15:53:41 -04:00
Rossen Stoyanchev 14d0fee86c Improve context-related logging on web startup
Sample output at TRACE:
```
DispatcherServlet - Initializing Servlet 'org.springframework.web.servlet.DispatcherServlet-7a8c8dcf'
AnnotationConfigWebApplicationContext - Refreshing WebApplicationContext for namespace 'org.springframework.web.servlet.DispatcherServlet-7a8c8dcf-servlet', started on Wed Jul 25 17:46:38 EDT 2018
AnnotationConfigWebApplicationContext - Registering [org.springframework.web.servlet.mvc.method.annotation.RequestPartIntegrationTests$CommonsMultipartResolverTestConfig]
AnnotationConfigWebApplicationContext - No 'messageSource' bean, using [Empty MessageSource]
AnnotationConfigWebApplicationContext - No 'applicationEventMulticaster' bean, using [SimpleApplicationEventMulticaster]
AnnotationConfigWebApplicationContext - No 'lifecycleProcessor' bean, using [DefaultLifecycleProcessor]
...
DispatcherServlet - Initialization completed in 3361 ms
```

Issue: SPR-16946
2018-07-25 17:50:03 -04:00
Juergen Hoeller 2b2bf27933 Polishing 2018-07-25 15:26:52 +02:00
Juergen Hoeller 3881a4aded Polishing 2018-07-25 14:16:02 +02:00
Juergen Hoeller 3899b7a909 Refactor DefaultCodecs.protobufWriter into protobufEncoder
Includes nullability declarations for the protobuf package.

Issue: SPR-15776
2018-07-25 14:15:50 +02:00
Juergen Hoeller fd8e4abe5d Introduce ResolvableType.toClass() shortcut
Issue: SPR-17086
2018-07-25 14:15:19 +02:00
Sebastien Deleuze d3b244a81b Optimize class detection by sharing the ClassLoader
Issue: SPR-17083
2018-07-25 11:09:42 +02:00
sdeleuze 36a07aa897 Support Protobuf serialization in WebFlux
This commit introduces Protobuf support in WebFlux via dedicated
codecs.

Flux<Message> are serialized/deserialized using delimited Protobuf
messages with the size of each message specified before the message
itself. In that case, a "delimited=true" parameter is added to the
content type.

Mono<Message> are expected to use regular Protobuf message
format (without the size prepended before the message).

Related HttpMessageReader/Writer are automatically registered when the
"com.google.protobuf:protobuf-java" library is detected in the classpath,
and can be customized easily if needed via CodecConfigurer, for example
to specify protocol extensions via the ExtensionRegistry based
constructors.

Both "application/x-protobuf" and "application/octet-stream" mime types
are supported.

Issue: SPR-15776
2018-07-25 01:17:06 +02:00
Juergen Hoeller 4475c67ba8 Fix checkstyle violation 2018-07-24 22:44:54 +02:00
Rossen Stoyanchev 2e4f5a7923 Consistently remove forwarded headers in WebFlux
Preparation for SPR-17072
2018-07-24 16:05:47 -04:00
Rossen Stoyanchev 41aa4218af Polish WebFlux ForwardedHeaderFilter and tests
Preparation for SPR-17072
2018-07-24 16:05:47 -04:00
Sebastien Deleuze 36bbbab02d Deprecate ExtensionRegistryInitializer in protobuf support
In order to be consistent with SPR-15776, and since it does not
provide clear added value, this commit deprecates
ExtensionRegistryInitializer and uses ExtensionRegistry
parameter instead in ProtobufHttpMessageConverter and
ProtobufJsonFormatHttpMessageConverter constructors.

Issue: SPR-17081
2018-07-24 17:25:55 +02:00
Juergen Hoeller 47d8fe83df Upgrade to Interceptor API 1.2.2, Moneta 1.3, Rome 1.11 2018-07-24 14:44:56 +02:00
Juergen Hoeller fac2e35f96 Refactor util.log.LogUtils into core.log.LogDelegateFactory
Issue: SPR-17012
2018-07-24 14:44:34 +02:00
Juergen Hoeller 1b09718104 Polishing 2018-07-24 00:45:21 +02:00
Vedran Pavic 82194f4ee0 Set SameSite default to Lax
Issue: SPR-16418
2018-07-23 18:23:05 +02:00
Sebastien Deleuze b09fad13a1 Catch errors when adding SourceHttpMessageConverter
This commit ignores errors like TransformerFactoryConfigurationError
that can be thrown when instantiating SourceHttpMessageConverter on
platforms where no TransformerFactory implementation is available,
like when compiling/running as GraalVM native images.

Issue: SPR-17007
2018-07-23 10:39:26 +02:00
Brian Clozel 390bb871d8 Switch order of multipart Content-Type directives
Since SPR-15205, the `FormHttpMessageConverter` is adding a `charset`
directive to the `Content-Type` request header in order to help servers
understand which charset is being used to encode headers of each part.

As reported in SPR-17030 and others, some servers are not parsing
properly such header values and assume that `boundary` is the last
directive in the `Content-Type` header.

This commit reorders the charset information right before the boundary
declaration to get around those issues.

Issue: SPR-17030
2018-07-20 18:11:05 +02:00
Juergen Hoeller 9a43d2ec20 Revised log levels: less WARN and INFO, fine-tuned DEBUG vs TRACE
Issue: SPR-16946
2018-07-20 15:05:16 +02:00
Rossen Stoyanchev 93b7a4838e UriComponentsBuilder method to configure URI variables
See Javadoc on UriComponentsBuilder#uriVariables for details.

This helps to prepare for SPR-17027 where the MvcUriComponentsBuilder
already does a partial expand but was forced to build UriComonents
and then create a new UriComponentsBuilder from it to continue. This
change makes it possible to stay with the same builder instance.

Issue: SPR-17027
2018-07-19 19:07:42 -04:00
Rossen Stoyanchev 28cd6978b5 Minor fixes: UriComponentsBuilder, UriComponents, docs
After the latest changes, two small fixes in the clone method to copy
the encode flag, and in the encodeUriTemplate method to account for
possible null query params.

Improvements in the URI encoding section.

Issue: SPR-17039, SPR-17027
2018-07-19 19:07:42 -04:00
Juergen Hoeller 51c7ceb95d Polishing 2018-07-20 00:17:37 +02:00
Juergen Hoeller 867b3d233d Upgrade to OkHttp 3.11, Apache HttpClient 4.5.6, Hibernate Validator 6.0.11 2018-07-19 17:52:08 +02:00
Juergen Hoeller 1f5d0faf1f HandlerMethod caches interface parameter annotations
Issue: SPR-11055
2018-07-19 11:38:10 +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
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 4d6f2df3cb Add LogUtils and HttpLogging
SPR-17012
2018-07-18 15:32:50 -04:00
Juergen Hoeller c77dbbb1e6 Specific exception for missing request header, cookie, matrix variable
Issue: SPR-14818
2018-07-18 18:56:51 +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
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
Juergen Hoeller 5fcfe0fa8e Polishing 2018-07-18 14:27:16 +02:00
Rossen Stoyanchev 6c4289e238 Polish 2018-07-17 17:39:16 -04:00
Juergen Hoeller ef9027e1c1 Polishing 2018-07-17 17:59:16 +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 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
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
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
Rossen Stoyanchev 32b75221b3 Improve expired session check algorithm
1. Add session count threshold as am extra pre-condition.
2. Check pre-conditions for expiration checks on every request.

Effectively an upper bound on how many sessions can be created before
expiration checks are performed.

Issue: SPR-17020
2018-07-11 15:59:18 -04:00
Rossen Stoyanchev e9ed45ee3b Fix code completion typo 2018-07-11 11:13:57 -04:00
Rossen Stoyanchev 7b3a72f483 Warn when SimpleAsyncTaskExecutor is used
Issue: SPR-16203
2018-07-11 11:10:03 -04:00
Rossen Stoyanchev 1b1bc7f5b5 Switch defaults and model for logging sensitive data
Issue: SPR-17029
2018-07-11 11:10:03 -04:00
Brian Clozel d00f6f09a5 Polish ContentCachingRequestWrapper
Issue: SPR-15762
2018-07-09 19:15:29 +02:00
zilong6 4d0800f392 Improve ContentCachingRequestWrapper performance
This commit improves the performance of `read` method variants
to write to the cache in an optimized way.

Issue: SPR-15762
2018-07-09 19:15:21 +02:00