Commit Graph

920 Commits

Author SHA1 Message Date
Juergen Hoeller
0445ce6c53 Polishing (backported from master)
(cherry picked from commit 92d78c1)
2016-07-06 17:35:30 +02:00
Juergen Hoeller
cd37873971 Avoid stateful MethodParameter nesting level changes in MVC processing
(cherry picked from commit e7a53e3)
2016-07-02 14:07:11 +02:00
Juergen Hoeller
4ddd9572f7 Leniently accept custom DeferredResult etc subclasses for null values
Issue: SPR-14423
(cherry picked from commit cfc560c)
2016-07-02 14:07:04 +02:00
Juergen Hoeller
a63247b281 Polishing 2016-06-29 16:07:03 +02:00
Juergen Hoeller
dd7ddc08ff Polishing 2016-06-29 14:48:09 +02:00
Rossen Stoyanchev
269742589b Improve static resource path check 2016-06-28 16:50:32 -04:00
Juergen Hoeller
e219576414 Defensive catching of any Throwable subclasses instead of just Error
Issue: SPR-14329
Issue: SPR-14323
(cherry picked from commit a9fda3e)
2016-06-04 00:27:24 +02:00
Juergen Hoeller
899131997e Less restrictive CORS origin comparison
UriComponentsBuilder allows more efficient (and less restrictive) CORS
origin comparison.

Also introduces a specifically narrowed cloneBuilder() method for
UriComponentsBuilders.

Cherry-picked from 9a52c8.

Issue: SPR-14080
2016-05-31 12:25:16 -04:00
Juergen Hoeller
07b5763324 SpringTilesContainerFactory uses Tiles 3's createDecoratedContainer
Issue: SPR-14311
(cherry picked from commit 2d85acc)
2016-05-31 13:21:38 +02:00
Juergen Hoeller
7b73f23f43 For attribute is not actually required
Issue: SPR-14287
(cherry picked from commit dacc31e)
2016-05-31 13:21:06 +02:00
Rossen Stoyanchev
6314df367c Update spring-mvc-3.2.xsd
The backport in commit cf39078 changed the spring-mvc-3.2.xsd.
This change updates the same in the 4.2.x branch.

Issue: SPR-14186
2016-04-21 14:07:27 -04:00
Juergen Hoeller
b7890ca28e Consistent license header
(cherry picked from commit 537193a)
2016-04-11 21:14:05 +02:00
Juergen Hoeller
aa5c12c534 Polishing 2016-04-08 22:52:36 +02:00
Juergen Hoeller
756301b7c5 Polishing
(cherry picked from commit 94cb778)
2016-03-25 23:38:23 +01:00
Juergen Hoeller
ccaa504378 Polishing
(cherry picked from commit 775bccc)
2016-03-24 21:47:56 +01:00
Juergen Hoeller
0891fbaf97 Consistent formatting 2016-03-24 19:54:28 +01:00
Juergen Hoeller
2ea7fcde3e Polishing
(cherry picked from commit 9af12d2)
2016-03-24 17:17:58 +01:00
Juergen Hoeller
8994498b44 Revised newline handling tests pass on Windows now
Issue: SPR-13503
(cherry picked from commit 311d4c9)
2016-03-24 17:16:52 +01:00
Brian Clozel
ed34ea4876 Reset Expires HTTP header when caching configured
Just like SPR-13252 addressed this issue for the "Pragma" header, this
issue resets the HTTP 1.0 "Expires" header.
When such a header has been set (by a filter, for example) and HTTP
caching has been configured at the WebContentGenerator, this header
value is reset to "". In this case, "Cache-Control" and "Expires" might
have inconsistent values and we consider that the HTTP caching
configuration should take precedence.

Depending on the servlet container chosen to deploy the application,
this might result in empty "" header values or no header set at all.

Issue: SPR-14053
Cherry picked from 15fe8279e6
2016-03-23 16:35:53 +01:00
Kazuki Shimizu
2267b14055 Add newline at the beginning of textarea macro for FreeMarker and Velocity
Issue: SPR-13503
Cherry-picked from 9b2023111d
2016-03-23 11:56:28 +01:00
Rossen Stoyanchev
d7062f6291 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:04:58 -04:00
Brian Clozel
f76b38c506 Fix SpringUrl Velocity macro URI encoding
Prior to this commit, the springUrl Velocity macro would only prepend
the context to the given URL; this means that the
ServletHttpResponse.encodeUri method is not called and neither the
ResourceUrlProvider.

This commit changes this macro to use RequestContext.getContextUrl which
prepends the context and encodes the URI.

Issue: SPR-14027
Cherry-picked from 0a56667093
2016-03-08 18:01:29 +01:00
Brian Clozel
b88c39955b Add newline at the beginning of textarea JSP tags
This commit adds a newline char at the beginning of textarea tags
values. As per the HTML 4.01 spec (and browsers behavior), a line break
following a start tag is ignored.

This can lead to Spring's textarea tag to ignore a line break char at
the beginning of a tag value.

See https://www.w3.org/TR/html401/appendix/notes.html#notes-line-breaks

Issue: SPR-13503
Cherry picked from 44c32128
2016-03-03 16:52:16 +01:00
Brian Clozel
0ef90df120 Relax SPR-13867 changes for ResourceHttpRequestHandler
Prior to this change, SPR-13867 made sure that any class extending
WebContentGenerator would not overwrite existing HTTP "Cache-Control"
response headers - set by a filter, a Controller handler, etc.

This caused issues with resource handling, since specifying a cache
configuration there would not overwrite default headers set by filters,
for example by Spring Security.

This commit restricts the previous changes to the
RequestMappingHandlerAdapter, in order to avoid overwriting header set
by a filter or a Controller handler in those cases.

Issue: SPR-14005
Cherry-picked from 50bcd67fb6
2016-03-02 17:45:50 +01:00
Juergen Hoeller
8a44560d82 RequestMappingHandlerAdapter properly invokes handler method in case of no session as well
Issue: SPR-13999
(cherry picked from commit a02fd7c)
2016-02-29 15:08:00 +01:00
Juergen Hoeller
0349abc565 RequestMappingHandlerAdapter properly invokes handler method in synchronizeOnSession mode again
Issue: SPR-13999
(cherry picked from commit 1815a6a)
2016-02-29 11:46:16 +01:00
Juergen Hoeller
9c5cabf4ba Refined ApplicationContextInitializer assignability exception
(cherry picked from commit ca19920)
2016-02-24 17:58:29 +01:00
Juergen Hoeller
a620770470 Polishing 2016-02-19 16:02:25 +01:00
Rossen Stoyanchev
6ef2d827c6 Reduce log level for @ExceptionHandler failure
Issue: SPR-13932
2016-02-09 12:58:08 -05:00
Juergen Hoeller
e48315549e AbstractXlsView does not explicitly flush (for compatibility with WebSphere Liberty)
Issue: SPR-13910
(cherry picked from commit 28e8af2)
2016-02-04 20:49:48 +01:00
Juergen Hoeller
30ef893c28 Polishing 2016-01-26 22:23:56 +01:00
Juergen Hoeller
a58eee6ad1 RequestParamMethodArgumentResolver defensively handles MethodParameter nesting level and java.util.Optional access
Issue: SPR-13850
2016-01-26 22:07:27 +01:00
Brian Clozel
bcebc9db7e Register prefixed path patterns with FixedVersionStrategy
Prior to this change, configuring a `FixedVersionStrategy` like so
would configure a single "/js/**" path pattern:

```
versionResourceResolver.addFixedVersionStrategy("v1.0.0","/js/**");
```

This commit makes sure that for each path pattern, its prefixed version
is added to the map. For example, the previous configuration also
adds "/v1.0.0/js/**".

Issue: SPR-13883
cherry-picked from 84fe46cd
2016-01-22 19:03:52 +01:00
Brian Clozel
fc34b0c592 Reorder HTTP headers processing in RequestMappingHandlerAdapter
Prior to this change, the `RequestMappingHandlerAdapter` would first add
a "Cache-Control" HTTP header to the response (depending on its
`WebContentGenerator` configuration and `@SessionAttributes` on the
handler class); then, the Adapter would delegate the actual handler the
processing of the request.
This leads to issues, as the handler does not have full control to the
response and has to deal with pre-existing headers in the response. This
means that the Adapter and the handler can add incompatible
Cache-Control directives without knowing it, since one cannot see the
headers added by the other until the response is committed.

This commit switches the order of execution: first, the handler is
called (possibly adding HTTP headers), then the RMHA processes the
response and adds "Cache-Control" directives *only if there's no
Cache-Control header already defined*.

Issue: SPR-13867
cherry-picked from 8f1d06f19
2016-01-22 16:36:48 +01:00
Brian Clozel
a4cb3cf900 Fix OutOfBoundsException in ResourceUrlEncodingFilter
Prior to this change, the `ResourceUrlEncodingFilter` would try to
lookup resources URLs as soon as the given URL would be longer than the
expected context+servlet prefix path. This can lead to
OutOfBoundsExceptions when the provided URL does not start with that
prefix and still has the required length.

This commit makes sure that all candidate URLs for resources lookup are
prefixed with the cached servlet and context path. This underlines the
fact that the `ResourceUrlEncodingFilter` does not support relative URLs
for now and delegates to the native servlet implementation in that case.

Issue: SPR-13861
cherry-picked from 2f6d86b7
2016-01-21 17:39:37 +01:00
Rossen Stoyanchev
e159086201 Fix failing test 2016-01-20 21:39:41 -05:00
Rossen Stoyanchev
73df50db3c Fix javadoc issue in ResponseEntityExceptionHandler
Issue: SPR-13869
2016-01-14 14:28:15 -05:00
Brian Clozel
3af62bd0dd Polish
Issue: SPR-13817
(cherry picked from d681f77d)
2016-01-05 17:33:04 +01:00
Brian Clozel
1581597092 Preserve ETag HTTP header for versioned resources
Prior to this change, a resource handler chain configured with a
`VersionResourceResolver` would add the resource version to the request
attributes when serving that resource. This approach would not work when
a `CachingResourceResolver` is configured and the resource is already
cached. Indeed, that code path is not executed when the resource is
resolved from the cache.

This commit adds a new `VersionedResource` interface that's used by the
`VersionResourceResolver`, adding a `getVersion()` method that returns
the version string for that resource. This way, the version information
is cached with the resource itself and the request attributes are no
longer used for this.

Issue: SPR-13817
(cherry picked from commit 473cf9c)
2016-01-05 15:04:05 +01:00
Juergen Hoeller
36940e003d Polishing 2015-12-21 22:38:25 +01:00
Juergen Hoeller
6f2f3595e9 Backported import and declaration cleanup 2015-12-18 00:18:09 +01:00
Juergen Hoeller
d59a97c101 Polishing 2015-12-18 00:02:48 +01:00
Juergen Hoeller
997278e3ed Polishing 2015-12-16 20:19:41 +01:00
Juergen Hoeller
5626384812 Consistent trace log messages and general polishing 2015-12-16 15:59:02 +01:00
Brian Clozel
3be35c053d Use LinkedHashmap to preserve insert order
In several places in the spring-webmvc module, URL patterns / objects
relationships are kept in `HashMap`s. When matching with actual URLs,
the algorithm uses a pattern comparator to sort the matching patterns
and select the most specific. But the underlying collection
implementation does not keep the original order which can lead to
inconsistencies.

This commit changes the underlying collection implementation to
`LinkedHashmap`s, in order to keep the insert order if the comparator
does not reorder entries.

Issue: SPR-13798
2015-12-16 15:24:35 +01:00
Juergen Hoeller
9e03e0e73d Polishing 2015-12-15 11:53:40 +01:00
Juergen Hoeller
ef1e17fd15 Polishing 2015-12-13 01:14:38 +01:00
Juergen Hoeller
0968e47b04 Polishing 2015-12-11 21:56:26 +01:00
Rossen Stoyanchev
dc7ed57c67 Support resource URL encoding at context path
Issue: SPR-13757
2015-12-10 12:24:04 -05:00
Juergen Hoeller
11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +01:00