Commit Graph

2388 Commits

Author SHA1 Message Date
Brian Clozel 709b185177 Clear global resources reference from HttpResources
When used as global Netty resources, ReactorResourceFactory creates and
sets those resources on Reactor's HttpResources directly.

When that ReactorResourceFactory bean is destroyed, those resources are
disposed but HttpResources still holds a reference to those and may try
to use them again.

This commit uses HttpResources to clear those resources and its
references to it, when the ReactorResourceFactory is treating those as
global.

Issue: SPR-17199
2018-08-21 16:16:28 +02:00
Sam Brannen a8fbac8472 Polish JavaDoc
Issue: SPR-17174
2018-08-18 18:15:05 +02:00
Juergen Hoeller a6a6cf7d97 Upgrade to Java Activation Framework 1.2 as API dependency
Includes XMLUnit 2.6.1 and Undertow 2.0.13.

Issue: SPR-16115
2018-08-17 16:01:15 +02:00
Sebastien Deleuze 0dd9e8ce02 Polish JettyResourceFactory
Issue: SPR-17179
2018-08-16 21:47:02 +02:00
Juergen Hoeller 6bcb454a0d Polishing 2018-08-16 19:31:10 +02:00
Juergen Hoeller 84300b796c Fix recent javadoc errors
Issue: SPR-17174
2018-08-16 18:51:31 +02:00
Sebastien Deleuze 1eb06fcd90 Introduce JettyResourceFactory
JettyResourceFactory, similar to ReactorResourceFactory, allows
to share resources (Executor, ByteBufferPool, Scheduler) between
Jetty clients and servers.

Issue: SPR-17179
2018-08-16 18:17:07 +02:00
Juergen Hoeller 2ec8fa9cac SmartLifecycle default methods for auto-startup in default phase
Issue: SPR-17188
2018-08-16 12:08:02 +02:00
Brian Clozel cd403f4180 Polish 2018-08-15 20:56:27 +02:00
Brian Clozel 23fc6f6b1d Drain JDK HTTP client response body in all cases
Prior to this commit, when using the `SimpleClientHttpRequestFactory`
as a driver for `RestTemplate`, the HTTP response body would only be
drained if there was an attempt to read it in the first place.

This commit ensures that, even if there's no attempt at reading the
response body, it is properly drained when the response is closed to
make sure that the connection is released in a proper state and can be
put back in the connection pool for reuse.

Issue: SPR-17181
2018-08-15 20:52:40 +02:00
Brian Clozel 432cdd7802 Add ResponseEntity.of(Optional) variant
When dealing with `Optional` values in a Controller handler (for
example, values coming from a Spring Data repository), developers might
reuse this code snippet quite often:

```
@GetMapping("/user")
public ResponseEntity<Optional<User>> fetchUser() {
  Optional<User> user = //...
  return user.map(ResponseEntity::ok).orElse(notFound().build());
}
```

This commit adds a new static method on `ResponseEntity` for that,
simplifying the previous snippet with `return ResponseEntity.of(user);`

Note that in case more specific HTTP response headers are required by
the application, developers should use other static methods to
explicitly tell  which headers should be used in each case.

Issue: SPR-17187
2018-08-15 20:24:14 +02:00
Rossen Stoyanchev 04141dee65 Consistent logging of resolved exceptions
Issue: SPR-17178
2018-08-15 10:57:51 +03:00
Juergen Hoeller 6027cf2255 Polishing 2018-08-14 20:42:40 +02:00
Rossen Stoyanchev 3e4d305291 Polish ReactorResourceFactory 2018-08-14 17:34:17 +03:00
Rossen Stoyanchev 7a0c03e05e Update section in reference on WebClient
Rename "Builder" sub-section to "Configuration" and move it in the
beginning before all others since it explains how to create a client
in the first place.

Update content on Reactor Netty connector based on the API in 0.8 and
specifically address Reactor Netty resources and lifecycle.

Issue: SPR-16963
2018-08-14 15:48:46 +03:00
Rossen Stoyanchev 2f732a8dea Fix checkstyle errors 2018-08-14 13:01:09 +03:00
Rossen Stoyanchev 1bc08c61e1 Add ReactorResourceFactory
Issue: SPR-16963
2018-08-14 12:29:31 +03:00
Sam Brannen 8126ffbc8c Fix broken links in JavaDoc
Issue: SPR-17174
2018-08-13 12:22:52 +02:00
Sam Brannen 1dcb6236a6 Fix broken links in JavaDoc
First step (as proof of concept) toward addressing SPR-17174.

Issue: SPR-17174
2018-08-13 11:54:05 +02:00
Rossen Stoyanchev 99f0129711 Fix URI var encoding issue with '$'
When expanding and strictly encoding URI variables, there is no need to
quote `/` and `$` which will be encoded anyway.

Issue: SPR-17168
2018-08-13 11:56:34 +03:00
Sam Brannen cfb1ed1009 Clean up warnings and delete dead code 2018-08-12 15:55:11 +02:00
Sebastien Deleuze 6b6384a09e Improve WebFlux Protobuf support
- Update javadoc for decoding default instances
 - Refactor and simplify tests
 - Add missing tests
 - Refactor decoding with flatMapIterable instead of
   concatMap and avoid recursive call

Issue: SPR-15776
2018-08-09 15:47:45 +02:00
Juergen Hoeller 247ec572b2 Consistent hasAnnotation check for findMergedAnnotation lookup
Issue: SPR-16933
2018-08-08 23:54:56 +02:00
Sebastien Deleuze 1c628293a2 Add doc & tests to Jaxb2XmlEncoder for collections
Issue: SPR-16363
2018-08-08 17:16:23 +02:00
Rossen Stoyanchev eacf1d35ee Proper use of setComplete in ContextPathCompositeHandler
Issue: SPR-17144
2018-08-08 16:35:47 +03:00
Rossen Stoyanchev c90ab5fb0a Polish Http[Client|Server]ErrorException hierarchy 2018-08-08 15:34:08 +03:00
Kazuhiro Sera be211ceead Fix typos detected by github.com/client9/misspell 2018-08-08 12:50:46 +02:00
Sebastien Deleuze 896eb5687a Check scheme in (WebUtils|CorsUtils)#isSameOrigin
Issue: SPR-16362
2018-08-08 12:19:42 +02:00
Juergen Hoeller 2b051b8b32 Deprecate support classes for Sun's JDK HTTP server
Issue: SPR-17143
2018-08-07 20:35:53 +02:00
Juergen Hoeller a4c750e94c Upgrade to OpenPDF 1.2 and Apache HttpAsyncClient 4.1.4 2018-08-07 11:24:20 +02:00
Rossen Stoyanchev 4a18488f30 Update deprecated basic auth client filters.
1. Update ExchangeFilterFunctions to delegate internally to
HttpHeaders.setBasicAuth(user, password).

2. Remove deprecation from
ExchangeFilterFunctions.basicAuthentication(String user, String password)
It is still useful as a filter to insert the header.

3. Update deprecation notes.

Issue: SPR-17099
2018-08-07 10:10:27 +03:00
Juergen Hoeller 943b394992 Polishing 2018-08-06 18:34:00 +02:00
Rossen Stoyanchev a9a38fe67e Consistent initialiazation of Forwarded header set 2018-08-06 14:32:18 +03:00
Rossen Stoyanchev 2216964b54 Polish RestTemplate exception hierarchy
Issue: SPR-15404
2018-08-06 14:29:10 +03:00
jerzykrlk 7f0e3481a5 Fine-grained RestTemplate exception hierarchy
Issue: SPR-15404
2018-08-06 14:29:10 +03:00
Sebastien Deleuze 2054fa2191 Upgrade to Jetty reactive HTTP client 1.0.1
Issue: SPR-17124
2018-08-06 12:01:29 +02:00
Juergen Hoeller 821ab62492 Upgrade to RxJava 2.2 and Kotlin 1.2.60
Includes latest dependency updates (Mockito 2.21, Log4J 2.11.1, Hibernate ORM 5.3.4, Protobuf 3.6.1, JRuby 9.2, HtmlUnit 2.32, Selenium 3.14) for Spring Framework 5.1.

Issue: SPR-16388
Issue: SPR-16239
2018-08-03 23:18:10 +02:00
Rossen Stoyanchev c55c9eb029 Polish 2018-08-03 17:41:38 +03:00
Vedran Pavic bb2db87c2f Add support for adding cookies as headers in MockHttpServletResponse
Issue: SPR-17110
2018-08-03 16:44:14 +03:00
Rossen Stoyanchev a8a1fc6de5 Earlier processing of forwarded headers
Forwarded headers are now processed before ServerWebExchange is created
through ForwardedHeaderTransformer which has the same logic as the
ForwardedHeaderFilter but works on the request only.

ForwardedHeaderFilter is deprecated as of 5.1 but if registered it is
removed from the list of filters and ForwardedHeaderTransformer is used
instead.

Issue: SPR-17072
2018-08-03 15:16:09 +03:00
Juergen Hoeller 217aa38cbb Polishing 2018-08-02 18:00:42 +02:00
Juergen Hoeller 2474c48749 Polishing 2018-08-02 16:55:53 +02:00
stsypanov b5c691bdac SPR-17074 Replace pointless wrapping with Arrays.asList with iteration over array 2018-08-02 12:07:00 +02:00
Juergen Hoeller 78eda961f2 Polishing 2018-08-01 13:11:35 +02:00
Vedran Pavic 70dbaf9751 Publish binding event for replaced attributes in MockHttpSession
Issue: SPR-17109
2018-08-01 13:07:41 +02:00
Juergen Hoeller 92eaf99067 Polishing 2018-07-31 21:04:36 +02:00
Сергей Цыпанов f8340838b3 Use lambda expressions for lazy instantiation (#1911)
Issue: SPR-17074
2018-07-31 13:03:18 +02:00
Juergen Hoeller 4a147d26fc Initialize pre-filled HashMaps with large enough capacity
Empty Maps are preferably initialized without capacity (not initializing them at all or lazily initializing with default capacity when needed).

Issue: SPR-17105
2018-07-30 22:07:31 +02:00
stsypanov 457d586859 SPR-17074 pass argument of addAll/putAll into constructor 2018-07-30 21:27:55 +02:00
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