Commit Graph

978 Commits

Author SHA1 Message Date
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
4bead6e542 Polish Javadoc for @GetMapping
Issue: SPR-13992
2016-03-07 18:18:46 +01:00
Sam Brannen
cbcc9998f1 Support 'produces' and 'consumes' attributes in @DeleteMapping
Issue: SPR-13992
2016-03-07 18:13:40 +01:00
Sam Brannen
bea26413b4 Support 'produces' attribute in @[Post|Put|Patch]Mapping
Issue: SPR-13992
2016-03-07 18:13:40 +01:00
Sam Brannen
78690a24fb Add headers & name attributes to composed @RequestMapping annotations
Issue: SPR-13992
2016-03-07 18:13:40 +01:00
Sam Brannen
ca8acc8758 Suppress warnings Gradle build 2016-03-07 15:36:46 +01:00
Rossen Stoyanchev
f162256906 Use ContentNegotiationManager for static resources
The ResourceHttpRequestHandler now relies on the conifgured
ContentNegotiationManager to determine the content type for resource
requests rather than implementing that internally.

First we check against the matched resource based on the resource file
extension. Then we expand the check against the request with any
configured content negotiation strategy.

Issue: SPR-13658
2016-03-04 16:06:01 -05: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
Stephane Nicoll
b3b3fc5a7e Polish 2016-03-01 19:10:39 +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
Sebastien Deleuze
c385427397 Allow to specify AbstractHttpMessageConverter default charset
Before this commit, specifying the charset to use with produces or
consumes @RequestMapping attributes resulted in default charset
loss. That was really annoying for JSON for example, where using
UTF-8 charset is mandatory in a lot of use cases.

This commit adds a defaultCharset property to
AbstractHttpMessageConverter in order to avoid losing the
default charset when specifying the charset with these
@RequestMapping attributes.

It changes slightly the default behavior (that's why we have waited
4.3), but it is much more error prone, and will match with most
user's expectations since the charset loss was accidental in most
use cases (users usually just want to limit the media type supported
by a specific handler method).

Issue: SPR-13631
2016-02-29 23:34:32 +01:00
Sam Brannen
61824b1ade Remove trailing whitespace from source code 2016-02-29 18:52:57 +01:00
Sam Brannen
467b5f3f28 Introduce composed annotations for @RequestMapping
This commit introduces the following common composed annotations for
@RequestMapping in Spring MVC and Spring MVC REST.

- @GetMapping
- @PostMapping
- @PutMapping
- @DeleteMapping
- @PatchMapping

Issue: SPR-13992
2016-02-29 18:22:30 +01:00
Sam Brannen
b423596b2e Introduce composed annotations for web scopes
This commit introduces the following common composed annotations for
web scopes.

- @RequestScope
- @SessionScope
- @ApplicationScope

Issue: SPR-13993
2016-02-29 17:38:46 +01:00
Sam Brannen
0c66838268 Polish Javadoc for @RequestMapping 2016-02-26 22:35:51 +01:00
Juergen Hoeller
ca19920d74 Refined ApplicationContextInitializer assignability exception 2016-02-24 17:50:14 +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
Brian Clozel
ac3847bf4a Clarify Javadoc for CacheControl.noCache,noStore
This change makes clear that this is the intent of the CacheControl API
not to provide a way to configure both "no-cache" and "no-store"
directives for the "Cache-Control" header.

Issue: SPR-13780
2016-02-17 16:48:28 +01:00
Juergen Hoeller
5c87afc51d Polishing 2016-02-16 22:28:46 +01:00
Juergen Hoeller
5e5bf7f518 Polishing 2016-02-16 13:57:08 +01:00
Arjen Poutsma
37b32d38bc Use synchonous API for synchonous OkHttp requests
This commit changes the OkHttpClientHttpRequestFactory to use the
synchronous OkHttp API for non-async requests, as opposed to
synchronizing the async API (which it used to do).

Issue: SPR-13942
2016-02-16 12:16:10 +01:00
Juergen Hoeller
27c1280949 Consider negative contentLength() result as not resolvable
Issue: SPR-13571
2016-02-11 22:24:13 +01:00
Juergen Hoeller
8558cbc9bf Polishing 2016-02-10 19:40:47 +01:00
Rossen Stoyanchev
b11d345c0d Common base class for [Unknown]HttpStatusCodeException
Issue: SPR-13928
2016-02-10 11:21:59 -05:00
Juergen Hoeller
901c2d5f74 Consistent API between spring-web and spring-messaging HandlerMethod infrastructure
Issue: SPR-13929
2016-02-10 16:23:11 +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
Juergen Hoeller
e90310612f Polishing 2016-02-04 20:00:00 +01: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
Rossen Stoyanchev
e62ada898b Add @RequestAttribute with servlet-based support
Issue: SPR-13894
2016-01-26 16:37:50 -05:00
Rossen Stoyanchev
698f923fc3 Add @SessionAttribute with Servlet-based support
Issue: SPR-13894
2016-01-26 16:37:44 -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
Rossen Stoyanchev
a5f4aa6824 Add HttpStatus to ModelAndView
Issue: SPR-13560
2016-01-20 16:54:05 -05:00