Commit Graph

473 Commits

Author SHA1 Message Date
Juergen Hoeller
cb9549655c AbstractApplicationContext registers default embedded value resolver
Issue: SPR-14140
2016-04-09 20:49:22 +02:00
Juergen Hoeller
4ae065996b Polishing
(cherry picked from commit aa5c12c)
2016-04-08 23:06:25 +02:00
Sam Brannen
8213df817e Clean up warnings in spring-web 2016-04-06 15:21:07 +02:00
Sebastien Deleuze
1f9a9cf404 Auto-detect Kotlin Jackson module
Issue: SPR-14108
2016-04-04 16:49:40 +02:00
Roy Clarkson
f35ec5353a Add support for OkHttp3
OkHttp3 introduces a new package and API that is incompatible with
previous versions. This commit adds a new
OkHttp3ClientHttpRequestFactory and supporting classes.
2016-03-29 18:15:04 +02:00
Brian Clozel
b947bfe8e9 Support of HTTP persistent connections for JDK client
Prior to this commit, HTTP clients relying on the JDK HTTP client would
not properly reuse existing TCP connections (i.e. HTTP 1.1 persisten
connection). The SimpleClientHttpResponse would close the actual connection once the
response is handled.

As explained in the JDK documentation
(http://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html)
HTTP clients should do the following to allow resource reuse:

* consume the whole HTTP response content
* close the response inputstream once done

This commit makes sure that the response content is
totally drained and then the stream closed (and not the connection).

Issue: SPR-14040
2016-03-29 17:31:42 +02:00
Juergen Hoeller
6298292523 AsyncRestTemplate triggers no-output HTTP requests immediately as well
Issue: SPR-14093
2016-03-29 15:22:32 +02:00
Brian Clozel
862d10c128 Support new default values in WebDataBinder
Prior to this commit, binding a `@ModelAttribute` object as a Controller
handler paramater would instantiate the object and set all its
properties, fetching data from the request. When no data is available,
the WebDataBinder tries to bind default "empty" values:
* Boolean.FALSE for boolean types
* empty arrays for array types
* null by default

This commit adds the new default empty values:
* empty Collections for Collection types
* empty Maps for Map types

Rather than using empty implementations provided by `Collections.empty`
(which are not mutable), we're using the closest possible target type
and real implementations, provided by the `CollectionFactory`.

Issue: SPR-13502
2016-03-25 21:37:08 +01:00
Juergen Hoeller
517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +01:00
Juergen Hoeller
06db5aa43f Polishing 2016-03-24 15:34:17 +01:00
Brian Clozel
c7bd3b8440 Support HTTP range requests in Controllers
Prior to this commit, HTTP Range requests were only supported by the
ResourceHttpRequestHandler when serving static resources.

This commit improves the ResourceHttpMessageConverter that
now supports partial writes of Resources.
For this, the `HttpEntityMethodProcessor` and
`RequestResponseBodyMethodProcessor` now wrap resources with HTTP
range information in a `HttpRangeResource`, if necessary. The
message converter handle those types and knows how to handle partial
writes.

Controller methods can now handle Range requests for
return types that extend Resource or HttpEntity:

    @RequestMapping("/example/video.mp4")
    public Resource handler() { }

    @RequestMapping("/example/video.mp4")
    public HttpEntity<Resource> handler() { }

Issue: SPR-13834
2016-03-23 16:40:12 +01:00
Rossen Stoyanchev
582864802e Ensure RedirectModel is initialized
This commit fixes an old bug in ModelAndViewContainer where getModel
returns a new ModelMap instance that isn't saved and re-used.

Issue: SPR-14045
2016-03-14 23:00:19 -04:00
Juergen Hoeller
d124a13eb4 Consistent use of empty enumerations 2016-03-11 15:07:59 +01:00
Sam Brannen
ca8acc8758 Suppress warnings Gradle build 2016-03-07 15:36:46 +01:00
Rossen Stoyanchev
6f2c968925 Support strict URI variable encoding
The DefaulUriTemplateHandler now provides a strictEncoding property
which if turned on encodes everything outside the reserved char set.

This is in contrast to the default policy of encoding only illegal
charaters depending on the URI component type.

Issue: SPR-11652
2016-03-03 14:37:48 -05:00
Rossen Stoyanchev
e98738d8ba Polish UriTemplateHandler related classes 2016-03-03 13:33:45 -05:00
Rossen Stoyanchev
36e2dd90a7 Support contextPath override in ForwardedHeaderFilter
Issue: SPR-13614
2016-03-02 18:38:25 -05:00
Rossen Stoyanchev
6fcc869338 Polish ForwardedHeaderFilter
Issue: SPR-13614
2016-03-02 18:38:25 -05:00
Rossen Stoyanchev
4cf0b59e00 Add ForwardedHeaderFilter
The new Filter is simply a new way of packaging the ability to extract
X-Forwarded-* headers already available via UriComponentsBuilder.

The Filter wraps the request and the effect is that anything using the
request will see the original schem, host, and port.

Issue: SPR-13614
2016-03-01 23:33:36 -05:00
Sebastien Deleuze
7b861c9a8a Add defaultUseWrapper support to Jackson builder
Issue: SPR-13975
2016-03-02 00:03:25 +01:00
Brian Clozel
0d6f80052d Support conditional updates in ServletWebRequest
Prior to this commit, `ServletWebRequest.checkNotModified` would only
support conditional GET/HEAD requests with "If-Modified-Since" and/or
"If-None-Match" request headers. In those cases, the server would return
"HTTP 304 Not Modified" responses if the resource didn't change.

This commit adds support for conditional update requests, such as
POST/PUT/DELETE requests with "If-Unmodified-Since" request headers.
If the underlying resource has been modified since the specified date,
the server will return a "409 Precondition failed" response status
to prevent concurrent updates.

Even if the modification status of the resource is reversed here
(modified vs. not modified), we're keeping here the same intent for the
return value, which signals if the response requires more processing or
if the handler method can return immediately:

```
if (request.checkNotModified(lastModified)) {
  // shortcut exit - no further processing necessary
  return null;
}
```

Issue: SPR-13863
2016-03-01 14:37:29 +01:00
Sam Brannen
61824b1ade Remove trailing whitespace from source code 2016-02-29 18:52:57 +01:00
Sebastien Deleuze
3329abffc8 Allow to specify request body type in RestTemplate
This commit allows to specify the request body type in order to
serialize generic types with a GenericHttpMessageConverter if
needed.

Issue: SPR-13154
2016-02-23 16:15:38 +01:00
Brian Clozel
1c2ac49f2a Add weak ETag support in ShallowEtagHeaderFilter
This commit adds weak ETag support in ShallowEtagHeaderFilter.
This improves the behavior of the filter in tow ways:

* weak ETags in request headers such as `W/"0badc0ffee"` will be
compared with a "weak comparison" (matching both weak and strong ETags
of the same value)
* when enabled with the "writeWeakETag" init param, the filter will
write weak Etags in its HTTP responses

Issue: SPR-13778
2016-02-18 18:05:48 +01:00
Juergen Hoeller
8495fcf109 Avoid accessing the session if no session attributes need to be updated
Issue: SPR-13950
2016-02-18 17:33:39 +01:00
Juergen Hoeller
e0d7c6be00 Name attributes in method argument annotations allow for placeholders and expressions
Issue: SPR-13952
2016-02-17 22:59:12 +01:00
Rossen Stoyanchev
902a7287f7 Fix NPE in InvocableHandlerMethod
Issue: SPR-13917
2016-02-04 23:32:22 -05:00
Rossen Stoyanchev
b49235ac59 BufferedImage converter writes Content-Type again
Issue: SPR-13906
2016-02-04 14:59:13 -05:00
Rossen Stoyanchev
bedf1a9bd0 Polish UriTemplateTests 2016-01-29 15:39:02 -05:00
Rossen Stoyanchev
f5aa011722 UriComponents support for array query params
Issue: SPR-9712
2016-01-29 15:32:42 -05:00
Rossen Stoyanchev
2e7470b27f Allow binding=false on @ModelAttribute
Issue: SPR-13402
2016-01-26 23:51:18 -05:00
Rossen Stoyanchev
806e79b14b Polish 2016-01-26 23:20:58 -05:00
Juergen Hoeller
b4f33adf48 Consistent java.util.Optional resolution, lenient handling of optional multipart files, correct Servlet 3.0 Part list/array selection
Issue: SPR-13418
Issue: SPR-13849
Issue: SPR-13850
Issue: SPR-13893
2016-01-26 18:06:15 +01:00
Sebastien Deleuze
a730e55d92 Add support for Jackson 2.7
AbstractJackson2HttpMessageConverter now implements its own
TypeVariable resolution algorithm since in Jackson 2.7 it is now
deprecated and has not the same behavior .
See https://github.com/FasterXML/jackson-databind/issues/1087
for more details.

The dependency on jackson-datatype-jdk7 has been removed since
it is now provided by default in the jackson-databind module.

Issues: SPR-13483, SPR-13728
2016-01-25 09:38:16 +01:00
Rossen Stoyanchev
d70ad765bf Support HTTP HEAD
Issue: SPR-13130
2016-01-24 20:18:41 -05:00
Rossen Stoyanchev
9cc518d167 Polish StringHttpMessageConverterTests 2016-01-22 09:40:33 -05:00
Rossen Stoyanchev
9e16cbda4c Polish ServletServerHttpRequest change 2016-01-20 17:50:36 -05:00
Sammy Chu
5185953f29 Avoid double encoding URI in ServletServerHttpRequest
Issue: SPR-13876
2016-01-20 17:42:40 -05:00
Stephane Nicoll
2fc2c29e9a Update copyright header 2016-01-15 10:51:11 +01:00
Rossen Stoyanchev
f3c2bb6557 Fix error message in RestTemplate
Issue: SPR-13860
2016-01-14 14:52:10 -05:00
Brian Clozel
cdda839426 XML configuration support for RFC 5861
This commit adds the XML+XSD configuration part of the RFC 5861
Cache-Control directives added in Spring's `CacheControl`.

Issue: SPR-13841
2016-01-07 18:13:34 +01:00
madorb
6c282096c6 Add RFC-5681 support to CacheControl
This commit adds the "stale-while-revalidate" and "stale-if-error"
Cache-Control directives in the `CacheControl` support class.

Issue: SPR-13841
2016-01-07 18:13:26 +01:00
Brian Clozel
9e4cf85af7 Add HTTP Status 451 UNavailable for legal reasons
Issue: SPR-13632
2015-12-29 20:51:42 +01:00
Rossen Stoyanchev
63958ac0ff Fix concurrent test failure
Since ListenableFuture callbacks are invoked after the future is set,
we cannot rely on callbacks having taken place right after a call
to future.get(). This change adds a CountdownLatch to detect when
the callbacks were invoked.

Issue: SPR-12538
2015-12-22 22:07:55 -05:00
Rossen Stoyanchev
bc671f05d6 Fix test warnings 2015-12-22 17:52:56 -05:00
Rossen Stoyanchev
258cc7b27f Update AsyncRestTemplate interception
AsyncRequestExecution now properly supports decoration of the
request (URI, HTTP method, and headers).

Removed a no-op IdentityListenableFutureAdapter.

Use Spring Framework coding style.

Issue: SPR-12538
2015-12-22 17:36:24 -05:00
Jakub Narloch
12969f6268 SPR-12538 AsyncRestTemplate interceptors 2015-12-22 16:21:47 -05:00
Juergen Hoeller
2e6eb614b5 Avoid scoped destruction callbacks in case of no post-processor actually applying
Issue: SPR-13744
2015-12-18 17:14:57 +01:00
Juergen Hoeller
4261f34b63 Consistent and lenient HttpMethod resolution across all web modules
Issue: SPR-13776
2015-12-09 12:26:44 +01:00
Juergen Hoeller
a9e5e9ecc8 Polishing 2015-12-02 15:35:42 +01:00