Commit Graph

17594 Commits

Author SHA1 Message Date
Juergen Hoeller 83a54dba7e Avoid stacktrace if root resource is not resolvable in file system
Issue: SPR-17417
2018-10-22 15:13:49 +02:00
Brian Clozel 85262a7932 Fix Map.put contract for HeadersAdapter impl.
This commit fixes the `Map.put` contract for both Reactor Netty and
Tomcat specific `HeadersAdapter` implementations.

Issue: SPR-17415
2018-10-22 14:53:14 +02:00
Rossen Stoyanchev 862dd23975 Server adapters release buffers on error/cancel
Review and update Servlet and Undertow adapters to release any data
buffers they be holding on to at the time of error or cancellation.

Also remove onDiscard hooks from Reactor and Undertow request body.
For Reactor we expect it to be handled. For Undertow there isn't
any Reactor Core upstream for the callback to be useful.

Issue: SPR-17410
2018-10-19 21:45:14 -04:00
Arjen Poutsma 149d416e8e Review DataBufferUtils for error/cancellation memory leaks
Issue: SPR-17408
2018-10-19 12:16:18 +02:00
Rossen Stoyanchev 1621125ccf @ExceptionHandler methods logs at DEBUG level again
Issue: SPR-17383
2018-10-18 22:49:47 -04:00
Juergen Hoeller a0b42a3dfd Upgrade to Hibernate ORM 5.3.7 2018-10-18 18:05:26 +02:00
Juergen Hoeller 5b5f7190bf Declare InvocableHandlerMethod.getMethodArgumentValues as protected
Issue: SPR-17404
2018-10-18 18:05:07 +02:00
Juergen Hoeller 7ff938b3ef LogFormatUtils.formatValue leniently handles toString() exceptions
Issue: SPR-17397
2018-10-18 18:04:32 +02:00
Juergen Hoeller da23505e94 Clarify FactoryBean initialization effect in getBeanNamesForAnnotation
Issue: SPR-17392
2018-10-18 18:04:04 +02:00
Juergen Hoeller 00b7782b5f Clarify destruction order effect in @DependsOn annotation javadoc
Issue: SPR-17384
2018-10-18 18:03:44 +02:00
Arjen Poutsma 6f0c869afe Polishing 2018-10-18 17:16:34 +02:00
Arjen Poutsma 857b600675 Fix memory leak in AbstractJackson2Encoder
Fixes a DataBuffer memory leak where a created buffer was not release
if Jackson threw an exception.
2018-10-18 17:09:53 +02:00
Arjen Poutsma d303c8a20f Store PathPattern instead of String in attributes
This commit changes the attributes stored under
RouterFunctions.MATCHING_PATTERN_ATTRIBUTE and
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE from a String to a
PathPattern, similar to what annotated controllers set.

Issue: SPR-17395
2018-10-18 14:48:45 +02:00
Brian Clozel ab8310b5f3 Fix HeadersAdapters implementations
This commit harmonizes the `HeadersAdapter` implementations across all
supported servers with regards to the `get(Object key)` contract; some
server implementations are not sticking to a `Map`-like contract and
return empty `List` instead of `null` when a header is not present.

This also fixes the `size()` implementations to reflect the number of
header keys, as some implementations consider multiple values for the
same header as different entries.

Issue: SPR-17396
2018-10-18 11:18:29 +02:00
Rossen Stoyanchev fdaceeb6c9 Remove checks and updates to transfer-encoding
Issue: SPR-17393
2018-10-16 16:49:46 -04:00
Sebastien Deleuze 2c5a1af236 Leverage Java reflection for Kotlin enums
As discussed in KT-25165, from a Kotlin POV enum constructors
have no parameter, this is an "implementation detail"
required for running on the JVM, so it seems relevant to skip
Kotlin reflection in that case and just delegate to Java
reflection.

Issue: SPR-16931
2018-10-16 16:40:02 +02:00
Rossen Stoyanchev f885910887 Remove unused bom import too 2018-10-15 14:39:20 -04:00
Rossen Stoyanchev e14cf699c8 Remove unused dependencies from spring-messaging
Tomcat and Jetty integration tests were moved out of spring-messaging
a very long time ago (before 4.0), but the dependencies remained
unnoticed until now.
2018-10-15 14:04:15 -04:00
Juergen Hoeller 93bb78ec23 Avoid private bean classes in integration tests (for CGLIB on JDK 11)
Issue: SPR-16391
2018-10-15 12:26:38 +02:00
Spring Buildmaster b2bf5fe0f3 Next Development Version 2018-10-15 07:20:38 +00:00
Rossen Stoyanchev 423aa28ed5 HttpRange validates requested ranges
Issue: SPR-17318
2018-10-14 22:49:25 -04:00
Juergen Hoeller 50949415d7 Upgrade spring-test to Hibernate ORM 5.3.6 (for JDK 11 compatibility)
Issue: SPR-16391
2018-10-15 00:39:25 +02:00
Juergen Hoeller 608fd766cb Upgrade to Checkstyle 8.13, Groovy 2.5.3, Aalto XML 1.1.1 2018-10-15 00:01:45 +02:00
Juergen Hoeller 58b3af9475 Nullability fine-tuning and related polishing
Issue: SPR-17250
2018-10-14 23:29:46 +02:00
Juergen Hoeller 5f2d47a17e MethodValidationInterceptor excludes FactoryBean metadata methods
Issue: SPR-17374
2018-10-14 21:07:56 +02:00
Tomasz Nurkiewicz 2255d222e3 Fix punctuation in reference manual (#1992) 2018-10-13 11:44:49 +03:00
Rossen Stoyanchev ecd0d7f0f6 Complete initialization with bindToRouterFunction
Issue: SPR-17239
2018-10-12 17:11:35 -04:00
Juergen Hoeller 309e70a48e Separate factory method cache for introspection purposes
Issue: SPR-17358
Issue: SPR-8891
2018-10-12 22:53:50 +02:00
Rossen Stoyanchev 658c7f99d7 Lenient date parsing in HeadersResultMatchers
Rather than formatting the expected value, and be susceptible to
minor formatting differences (e.g. 01 vs 1 for day of month), parse the
actual header value leniently with HttpHeaders and compare time values.

Issue: SPR-17330
2018-10-12 15:41:42 -04:00
Rossen Stoyanchev c5ca56bd50 Polish 2018-10-12 12:15:45 -04:00
Stephane Nicoll 05830912a5 Merge pull request #1991 from Cikey
* pr/1991:
  Fix deprecated property in MBeanExporter documentation
2018-10-12 16:15:12 +02:00
Christian Kulpa 864d7eaf11 Fix deprecated property in MBeanExporter documentation
Closes gh-1991
2018-10-12 16:10:02 +02:00
Juergen Hoeller bfc5ad890e MockHttpServletRequest resets InputStream/Reader on setContent
Issue: SPR-17373
2018-10-12 16:00:31 +02:00
Juergen Hoeller b7e4a56e5c Mark PathResourceTests as deprecated (along with PathResource)
Issue: SPR-17320
2018-10-12 13:17:28 +02:00
Juergen Hoeller 0b2c482e29 Upgrade to Selenium HtmlUnit Driver 2.33 2018-10-12 13:17:14 +02:00
Juergen Hoeller dcf2861db5 Upgrade to Objenesis 3.0
Includes jarjar upgrade since jarjar 1.3 fails to properly relocate Objenesis 3.0 classes into org.springframework.objenesis package.

Issue: SPR-17372
2018-10-12 13:17:01 +02:00
Juergen Hoeller 5474995288 Exclude original AsmApi class from CGLIB repack jar
Issue: SPR-17371
2018-10-12 12:14:00 +02:00
Juergen Hoeller a2ae5f6972 Force CGLIB to always specify ASM7 for its visitors
Issue: SPR-17371
2018-10-12 12:01:50 +02:00
陈灵敏 4ee704cedf Supplier for timeout result in DeferredResult
Issue: SPR-17364
2018-10-11 20:26:01 -04:00
Rossen Stoyanchev 8df0bc88d2 Improve access to raw content in WebTestClient
If the content has not been consumed, cause it to be produced, and
wait for a certain amount of time before giving up, so the raw content
can be made available. This can occur when:

1) In a mock server scenario the Flux representing the client request
content is passed directly to the mock server request, but is never
consumed because of an error before the body is read.

2) Test obtains FluxExchangeResult (e.g. for streaming) but instead of
consuming the Flux, it calls getResponseBodyContent() instead.

Issue: SPR-17363
2018-10-11 20:25:56 -04:00
Rossen Stoyanchev c567e65eea WritetapConnector internal refactoring
Extract a common delegate class to share between the request and the
to wiretap a Publisher and record and buffer its data.

Preparation for SPR-17363.
2018-10-11 19:47:37 -04:00
Rossen Stoyanchev 050f44d75b Rename WebTestClientConnectorTests to match class name 2018-10-11 19:47:37 -04:00
Stephane Nicoll 60b5161fbe Upgrade to Reactor Californium-SR1 2018-10-11 20:30:43 +02:00
Brian Clozel 10d5de7d63 Handle special headers in Tomcat and Jetty
This commit adds special processing of some HTTP response headers in
Jetty and Tomcat; they both consider some headers like  "Content-Length"
as specific and require explicit calls on the `HttpServletResponse`
itself on top of setting the HTTP response header.

Issue: SPR-17250
2018-10-11 14:37:14 +02:00
Arjen Poutsma 8de5c05af0 Set BEST_MATCHING_HANDLER_ATTRIBUTE in WebFlux.fn
SPR-17367
2018-10-11 13:44:06 +02:00
Brian Clozel f12c28e402 Avoid copying in DefaultServerHttpRequestBuilder
This commit avoids copying HTTP headers when mutating an HTTP request.
Instead, we're now unwrapping the `ReadOnlyHttpHeaders` (which is most
likely backed by the native request headers).

Issue: SPR-17250
2018-10-11 12:11:47 +02:00
Brian Clozel ce7278aaf4 Optimize HTTP headers management
Several benchmarks underlined a few hotspots for CPU and GC pressure in
the Spring Framework codebase:

1. `org.springframework.util.MimeType.<init>(String, String, Map)`
2. `org.springframework.util.LinkedCaseInsensitiveMap.convertKey(String)`

Both are linked with HTTP request headers parsing and response headers
writin during the exchange processing phase.

1) is linked to repeated calls to `HttpHeaders.getContentType`
within a single request handling. The media type parsing operation
is expensive and the result doesn't change between calls, since
the request headers are immutable at that point.

This commit improves this by caching the parsed `MediaType` for the
`"Content-Type"` request header in the `ReadOnlyHttpHeaders` class.
This change is available for both Spring MVC and Spring WebFlux.

2) is linked to insertions/lookups in the `LinkedCaseInsensitiveMap`,
which is the data structure behind `HttpHeaders`.
Those operations are creating a lot of garbage (including a lot of
`String` created by `toLowerCase`). We could choose a more efficient
data structure for storing HTTP headers data.

As a first step, this commit is focusing on Spring WebFlux and
introduces `MultiValueMap` implementations mapped by native HTTP headers
for the following servers: Tomcat, Jetty, Netty and Undertow.
Such implementations avoid unnecessary copying of the headers
and leverages as much as possible optimized operations provided by the
native implementations.

This change has a few consequences:

* `HttpHeaders` can now wrap a `MultiValueMap` directly
* The default constructor of `HttpHeaders` is still backed by a
`LinkedCaseInsensitiveMap`
* The HTTP request headers for the websocket HTTP handshake now need to
be cloned, because native headers are likely to be pooled/recycled by
the server implementation, hence gone when the initial HTTP exchange is
done

Issue: SPR-17250
2018-10-11 12:11:47 +02:00
volkovandr 61403e3bd3 Updated Javadoc: date format patterns SPR-17366 2018-10-11 10:52:32 +02:00
Brian Clozel cc172bcedc Upgrade to Reactor Californium SNAPSHOTs
Preparing for Californium-SR1
2018-10-11 10:46:01 +02:00
Juergen Hoeller e18149878c Upgrade to Mockito 2.23
Includes JSON-P 1.1.3.
2018-10-10 23:53:33 +02:00