Commit Graph

1043 Commits

Author SHA1 Message Date
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
Juergen Hoeller a02fd7c995 RequestMappingHandlerAdapter properly invokes handler method in case of no session as well
Issue: SPR-13999
2016-02-29 15:05:50 +01:00
Juergen Hoeller 9c0f99c0b5 Polishing 2016-02-29 12:57:09 +01:00
Juergen Hoeller 1815a6a7eb RequestMappingHandlerAdapter properly invokes handler method in synchronizeOnSession mode again
Issue: SPR-13999
2016-02-29 11:12:11 +01:00
Juergen Hoeller ca19920d74 Refined ApplicationContextInitializer assignability exception 2016-02-24 17:50:14 +01:00
Rossen Stoyanchev b3d67b928b Check supported locales in AcceptHeaderLocaleResolver
Issue: SPR-13330
2016-02-22 09:44:06 -05:00
Rossen Stoyanchev f32aded27a Consolidate CORS/OPTIONS request mapping
The CORS pre-flight request matching logic for all request conditions
was added (in 4.2) to RequestMappingInfo. However the logic for
default handling of all HTTP OPTIONS requests for 4.3 unintentionally
overrode some of the pre-flight request handling thus causing issues.

This commit moves CORS pre-flight matching logic into each respective
RequestMethodCondition implementations so each has to consider in one
place what happens for pre-flight and for all other requests.

Issue: SPR-13130
2016-02-19 13:56:52 -05:00
Rossen Stoyanchev 26575148a5 Polish test class 2016-02-19 13:56:52 -05:00
Rossen Stoyanchev 08eb623c41 Fix regression introduced in 4.3 snapshot
Commit ccd17d introduced a regression where a custom HTTP method
would no longer match for an empty @RequestMapping condition.

The previous behavior should now be restored. Effectively
RequestMethodRequestCondition as before will now match to any HTTP
method (even unknown/custom ones) if the methods condition is empty.
The only exception is HTTP OPTIONS for which we provide default
handling as a fallback (i.e. when not mapped explicitly).

Issue: SPR-13130
2016-02-18 14:37:36 -05:00
Sam Brannen c2f704717e Polish Javadoc for DefaultRequestToViewNameTranslator 2016-02-17 17:30:57 +00:00
Rossen Stoyanchev 024bd6e604 Polish 2016-02-17 08:23:18 -05:00
matthew-pearson 57b466fdfc 404 rather than 405 or 200
Check that the path is valid and resolvable before checking that the
http method is supported. For invalid or unresolvable paths, always
respond with a 404.
2016-02-17 08:23:18 -05:00
Juergen Hoeller f6ebc4ce97 Polishing 2016-02-11 22:24:50 +01:00
Rossen Stoyanchev a1e9e6f53e Polish MVC Java config tests 2016-02-10 15:29:56 -05:00
Rossen Stoyanchev d53c04b4df Add option to extend exception resolvers
Issue: SPR-13931
2016-02-10 15:26:40 -05:00
Rossen Stoyanchev c45ad3022b Add "hosts" property to RedirectView
Issue: SPR-13693
2016-02-10 14:21:27 -05:00
Rossen Stoyanchev aba04d576f Polish RedirectViewTests 2016-02-10 14:21:27 -05:00
Brian Clozel 0ab3f6092c Fix failing tests
Issue: SPR-13913
2016-02-10 13:48:49 +01:00
Rossen Stoyanchev cdfcc23b6f Reduce log level for @ExceptionHandler failure
Issue: SPR-13932
2016-02-09 12:57:02 -05:00
Rossen Stoyanchev e4539d9f40 Add protected method for required RequestBody 2016-02-05 02:24:03 -05:00
Rossen Stoyanchev 7756feacd8 Polish 2016-02-05 00:04:59 -05:00
Rossen Stoyanchev 1291d6e1bd Support CharSequence for response body
Issue: SPR-13423
2016-02-04 23:55:48 -05:00
Juergen Hoeller 28e8af2e2e AbstractXlsView does not explicitly flush (for compatibility with WebSphere Liberty)
Issue: SPR-13910
2016-02-04 19:48:05 +01:00
Rossen Stoyanchev aa064d7653 Polish MVC config tests 2016-01-29 14:58:32 -05:00
Rossen Stoyanchev 1cf0fb8174 Shared custom argument resolvers
Custom argument resolvers configured in the MVC Java config or the
MVC namespace are now injected in both the RequestMappingHandlerAdapter
as well as in the ExceptionHandlerExceptionResolver.

Issue: SPR-12058
2016-01-29 14:49:25 -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 7df3a327f6 Polishing 2016-01-26 22:29:48 +01:00
Juergen Hoeller 3779fe9bf6 @UsesJava8 declaration on inner class
Issue: SPR-13850
2016-01-26 18:18:27 +01: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
Rossen Stoyanchev 2607a22537 HTTP OPTIONS lists all HTTP methods except TRACE
This is in line with the current behavior of HttpServlet that would
have been in used with dispatchOptionsRequest on the DispatcherSerlvet
set to false (the default prior to 4.3).

Issue: SPR-13130
2016-01-25 16:35:23 -05:00
Rossen Stoyanchev 319e8e2c2f Add allowHeader property to WebContentGenerator
The WebContentGenerator now maintains an additional property that
sub-classes can use for an "Allow" header in response to an HTTP
OPTIONS request. This property is pre-initialized once at startup
and does not have to rely on getSupportedMethods in addition to
adding HTTP OPTIONS if not explicitly listed.

Issue: SPR-13130
2016-01-25 16:35:15 -05:00
Rossen Stoyanchev 135738f9bf AbstractController supports HTTP OPTIONS
Issue: SPR-13130
2016-01-25 08:49:04 -05:00
Rossen Stoyanchev ccd17dfaea Support HTTP OPTIONS
Issue: SPR-13130
2016-01-24 20:18:41 -05:00
Rossen Stoyanchev d70ad765bf Support HTTP HEAD
Issue: SPR-13130
2016-01-24 20:18:41 -05:00
Rossen Stoyanchev fb7dfc4569 Polish 2016-01-24 20:18:35 -05:00
Brian Clozel 2b3ad218e5 Clarify RequestMappingHandlerAdapter javadoc
This commit updates the javadoc of
`RequestMappingHanderAdapter.setCacheSecondsForSessionAttributeHandlers`
to explain how one can disable that feature and prevent "Cache-Control"
directives from being added when `@SessionAttributes` annotations are
used on Controllers.

Issue: SPR-13598
2016-01-22 21:17:58 +01:00
Brian Clozel 84fe46cd43 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
2016-01-22 18:30:39 +01:00
Brian Clozel 8f1d06f19c 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
2016-01-22 16:04:03 +01:00
Rossen Stoyanchev ebccfd023a MVC Java config protected factory methods
This change exposes protected methods for instantiating sub-classes of
RequestMappingHandlerAdapter and ExceptonHandlerExceptionResolver
similar to the existing method for RequestMappingHandlerMapping.
2016-01-22 09:48:50 -05:00
Brian Clozel 2f6d86b7aa Fix OutOfBoundsExceptio 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
2016-01-21 17:28:29 +01: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
Rossen Stoyanchev 73a794336c Support @ResponseStatus on controller type level
Issue: SPR-13547
2016-01-15 17:15:34 -05:00
Juergen Hoeller 9761af9ad8 Validate @RequestMapping methods on AOP proxies
Issue: SPR-13842
2016-01-15 17:01:58 +01:00
Stephane Nicoll 2fc2c29e9a Update copyright header 2016-01-15 10:51:11 +01:00
Rossen Stoyanchev 24fdf64d91 Fix javadoc issue in ResponseEntityExceptionHandler
Issue: SPR-13869
2016-01-14 14:25:30 -05:00
Juergen Hoeller 773d175681 Polishing 2016-01-13 12:52:05 +01: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
Brian Clozel d681f77d62 Polish
Issue: SPR-13817
2016-01-05 17:31:30 +01:00
Brian Clozel 473cf9c40e 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
2016-01-05 14:55:14 +01:00
Rossen Stoyanchev 74b77e0d74 Fix warnings 2015-12-22 16:16:51 -05:00
Rossen Stoyanchev 12b73caa84 Add @RestControllerAdvice
Issue: SPR-13673
2015-12-22 16:11:34 -05:00
Juergen Hoeller 41ee25b1e7 Convenience constructors for common view prefix/suffix scenarios
Issue: SPR-13813
2015-12-22 12:00:49 +01:00
Juergen Hoeller 57b3ee324f Tiles 2 support back for Spring 4.3 (to be eventually removed for 5.0 now)
Issue: SPR-13229
2015-12-21 22:15:22 +01:00
Juergen Hoeller 4668aa775d Language tag methods declared as @UsesJava7
Issue: SPR-13274
2015-12-21 19:08:37 +01:00
Juergen Hoeller 0dd320f92e Support for BCP 47 language tags
Issue: SPR-13032
2015-12-21 18:40:26 +01: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 3d87718fc6 DispatcherServlet and ServletWrapping/ForwardingController accept any HTTP method by default
Issue: SPR-4799
2015-12-18 12:57:18 +01:00
Sam Brannen 5b3edcd9f9 Spring Cleaning in December
- Delete unused imports
- Delete unused code
- Clean up warnings
2015-12-17 20:27:33 +01:00
Juergen Hoeller 0e68d2e951 Explicit references to spring-mvc-4.2.xsd for Velocity declarations
Issue: SPR-13235
2015-12-17 18:30:11 +01:00
Juergen Hoeller a2a9c47e59 Deprecate Velocity support
Issue: SPR-13235
2015-12-17 17:15:57 +01:00
Juergen Hoeller 8ce5e88c66 Require Jackson 2.6+, FreeMarker 2.3.21+, XStream 1.4.5+
Issue: SPR-13062
2015-12-17 17:14:50 +01:00
Stephane Nicoll 752d3c715a Initiate structure for 4.3 XSDs 2015-12-17 15:43:23 +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
Juergen Hoeller 4261f34b63 Consistent and lenient HttpMethod resolution across all web modules
Issue: SPR-13776
2015-12-09 12:26:44 +01:00
Rossen Stoyanchev 153a23dbf9 Configure view controllers with ApplicationContext
Issue: SPR-13762
2015-12-04 13:09:37 -05:00
Juergen Hoeller 08ff3a85bf Integration test for proper re-resolution of Optional @RequestPart argument
Includes a trivial refinement of RestTemplate's ResourceAccessException message.

Issue: SPR-13755
2015-12-03 12:55:32 +01:00
Juergen Hoeller a9e5e9ecc8 Polishing 2015-12-02 15:35:42 +01:00
Brian Clozel c226753985 Do not rewrite relative links with FixedVersionStrategy
Prior to this change, the resource handling FixedVersionStrategy would
be applied on all links that match the configured pattern. This is
problematic for relative links and can lead to rewritten links such as
"/fixedversion/../css/main.css" which breaks.

This commit prevents that Strategy from being applied to such links.
Of course, one should avoid to use that VersionStrategy with relative
links, but this change aims at not breaking existing links even if it
means not prefixing the version as expected.

Issue: SPR-13727
2015-12-01 14:47:23 +01:00
Juergen Hoeller a0747c2148 Consistent bean type checking for endpoint handlers
Issue: SPR-13725
2015-11-25 21:26:03 +01:00
Brian Clozel b35d44bd4c Fix inputstream reading for HTTP range requests
Prior to this commit, range requests would be served by
ResourceHttpRequestHandler by partially reading the inputstream of
static resources. In case of resources contained in ZIP/JAR containers,
InputStreams may not fill the entire read buffer when calling
`inputStream.read(byte[])`. This was the case when using Spring Boot's
ZipInflaterInputStream - this would then not read the entire file
content and would close the response without writing the expected body
length indicated in the "Content-Length" header.

This commit makes sure that the whole resource is read.

Issue: SPR-13661
2015-11-24 21:36:22 +01:00
Johnny Lim 2defb6555e Fix broken Javadoc related to `<` and `>` 2015-11-12 11:22:08 +01:00
Rossen Stoyanchev e707347474 Fix failing tests 2015-11-11 18:02:50 -05:00
Rossen Stoyanchev 3a919a48d6 Switch "attachment" to "inline" on Content-Disposition
Issue: SPR-13587, SPR-13643
2015-11-11 17:14:29 -05:00
Juergen Hoeller 760bc719f2 Polishing 2015-11-09 15:03:14 +01:00
Juergen Hoeller bc7bcab578 Consistent method selection for listeners and endpoint mappings
Issue: SPR-13654
2015-11-09 14:57:45 +01:00
Rossen Stoyanchev a3168fde18 Expand range of whitelisted extensions by media type
This commit expands the range of whitelisted extensions by checking
if an extension can be resolved to image/*, audo/*, video/*, as well
as any content type that ends with +xml.

Issue: SPR-13643
2015-11-06 16:45:41 -05:00
Rossen Stoyanchev 237439ef97 Whitelist extension if present in the request mapping
We know skip the Content-Disposition header for any extension if the
chosen request mapping explicitly contains the URl extension.

Issue: SPR-13629
2015-11-06 12:37:13 -05:00
Brian Clozel 889366320d Do not process undefined conditional HTTP requests
Prior to this change, the HttpEntityMethodProcessor would try to process
conditional requests that are undefined by the spec, such as:

* an HTTP GET request with "If-None-Match:*"
* a request with both "If-None-Match" and "If-Match"
* a request with both "If-None-Match" and "If-Unmodified-Since"

This commit skips the processing of those requests as conditional
requests and continues with normal request handling.

Issue: SPR-13626
2015-11-06 17:59:41 +01:00
Rossen Stoyanchev ac975df448 Fix javadoc ambiguity
Issue: SPR-13642
2015-11-05 20:02:37 -05:00
Rossen Stoyanchev f0464e8176 Add section on RFD + whitelist yml/properties/csv
Issue: SPR-13643
2015-11-05 19:31:29 -05:00
Rossen Stoyanchev bdb71e91ad No Content-Disposition if HTML in the request mapping
Issue: SPR-13629
2015-11-02 13:07:48 -05:00
Juergen Hoeller cca037a74d Polishing 2015-11-02 14:42:46 +01:00
Juergen Hoeller ce20268597 Consistent warn logging without stacktrace in Portlet HandlerExceptionResolver
Issue: SPR-13611
2015-11-02 14:19:58 +01:00
Sebastien Deleuze 76d7f4527a Revert most SPR-13100 changes since SPR-13267 was a better fix
Issue: SPR-13596
2015-11-02 10:40:53 +01:00
Rossen Stoyanchev 598fafd957 Fix failing test 2015-10-29 21:02:45 -04:00
Rossen Stoyanchev c5995149b3 Further improve detecttion of custom CNVR
Refine the approach of having <mvc:view-resolvers> detect and use the
ContentNegotiationManager instance registered with
<mvc:annotation-driven> introduced in the last commit.

Issue: SPR-13559
2015-10-29 20:58:31 -04:00
Rossen Stoyanchev f84a0c914a Detect custom ContentNegotiationViewResolver
The <mvc:annotation-driven> element now adds an alias when a
ContentNegotiationManager bean is registered with a custom name.
This helps <mvc:view-resolvers> to more reliably find such a custom
ContentNegotiationManager.

Issue: SPR-13559
2015-10-29 18:01:00 -04:00
Brian Clozel 9334fabe26 Don't throw NPE when serving webjar directories
Prior to this change, serving resources with ResourceHttpRequestHandler
could result in NPE when requesting an existing folder located in a JAR.

This commit swallows those exceptions, as it is not possible to foresee
those cases without reading the actual resource. This result in a HTTP
200 response with a zero Content-Length instead of a HTTP 500 internal
exception.

Issue: SPR-13620
2015-10-29 16:10:27 +01:00
Juergen Hoeller a778468771 Consistent JSP tag documentation
Issue: SPR-13520
2015-10-28 18:31:17 +01:00
Juergen Hoeller a268cdb913 Fixed javadoc links to setCacheSeconds 2015-10-28 16:06:59 +01:00
Juergen Hoeller 6d369308cc Improved SessionLocaleResolver documentation
Issue: SPR-13505
2015-10-28 14:30:08 +01:00
Juergen Hoeller c1c07bbeb2 AbstractDispatcherServletInitializer allows for registering any FrameworkServlet subclass
Issue: SPR-13616
2015-10-28 14:00:20 +01:00
Juergen Hoeller 400749667a Polishing 2015-10-26 23:10:33 +01:00
Rossen Stoyanchev 1c382be00e Expose build method in SseEventBuilder
Issue: SPR-13591
2015-10-26 16:19:10 -04:00
Rossen Stoyanchev 050e79e45e Skip Content-Disposition header if status != 2xx
Issue: SPR-13588
2015-10-26 16:01:32 -04:00
Rossen Stoyanchev 2bd1daa75e Protect against RFD exploits
Issue: SPR-13548
2015-10-15 10:33:27 +02:00
Juergen Hoeller 6256586047 Polishing 2015-10-12 18:12:31 +02:00
Juergen Hoeller 1d59c5fd41 StandardScriptEvaluator uses same eval exception exposure as ScriptTemplateView
Issue: SPR-13557
2015-10-09 22:55:01 +02:00
Juergen Hoeller 44b76d39a4 ExceptionHandlerExceptionResolver allows for Model parameter
Issue: SPR-13546
2015-10-07 20:06:06 +02:00
Sam Brannen 28c07a6d38 Polish Javadoc for MVC exception handling classes 2015-10-06 17:30:45 +02:00
Sam Brannen 7ac6af0fb0 Polish Javadoc for AsyncHandlerInterceptor & RequestBodyAdvice 2015-10-06 09:35:24 +02:00
Rossen Stoyanchev 42e5ad4111 Polish 2015-09-30 14:05:08 -04:00
Rossen Stoyanchev 24a91b43cc Polish content negotiation 2015-09-29 17:08:37 -04:00
Sam Brannen 452b124ff6 Polish FreeMarker tests and suppress warnings 2015-09-28 19:33:49 +02:00
Sam Brannen 58c2990794 Reinstate and modernize Jasper Reports tests 2015-09-28 19:22:23 +02:00
Sam Brannen d5ee787e1e Migrate JUnit 3 tests to JUnit 4
This commit migrates all remaining tests from JUnit 3 to JUnit 4, with
the exception of Spring's legacy JUnit 3.8 based testing framework that
is still in use in the spring-orm module.

Issue: SPR-13514
2015-09-27 21:17:51 +02:00
Sebastien Deleuze 1580288815 Improve error reporting in ScriptTemplateView
This commit introduces a new ScriptRenderException in order to:
 - Print in the resulting error page the reason of the script failure
 - Not print the whole stacktrace in the logs

The ScriptRenderException thrown in ScriptTemplateView#renderMergedOutputModel()
is wrapped into a ServletException in order to avoid printing 2 times the messages in
the logs (throwing directly a ScriptRenderException would make it wrapped in a
NestedServletException that contains a getMessage() override not needed in this
context)

Issue: SPR-13488
2015-09-26 10:30:48 +02:00
Rossen Stoyanchev fdbe8dc4c1 ResponseBodyEmitter detects timeout/completion
ResponseBodyEmitter now registers by default to receive callbacks
on timeout/completion and sets its internal "complete" flag to true
in order to prevent proactively further use of the emitter.

Issue: SPR-13498
2015-09-25 14:06:33 -04:00
Juergen Hoeller 11b4e3be2c Consistent HttpMethod resolution against underlying HttpServletRequest 2015-09-24 20:53:22 +02:00
Brian Clozel 7f700cc63e Polish 2015-09-24 19:58:58 +02:00
Brian Clozel 583a48ab75 Do not process conditional requests for non-GET
Prior to this commit, HttpEntityMethodProcessor would process
conditional requests even if those aren't GET requests.
This is an issue for POST requests with "If-None-Match: *" headers and
many other use cases, which should not receive an HTTP 304 Not Modified
status in response.

This commit only triggers ETag/Last-Modified conditional requests bits
for GET requests.

Issue: SPR-13496
2015-09-24 17:49:20 +02:00
Juergen Hoeller c34a62e141 LocaleChangeInterceptor allows for ignoring invalid locale values
Issue: SPR-9456
2015-09-24 00:32:45 +02:00
Rossen Stoyanchev ffd9c62fc8 Translate IOException to HttpMessageNotReadableEx
Some converters (Jackson, Gson, Protobuf) already do this. It is now
also done in AbstractMessageConverterMethodArgumentResolver which
enforces a consistent behavior across controller method arguments.

Issue: SPR-12745
2015-09-23 17:22:37 -04:00
Juergen Hoeller 54d3d782a9 Polishing 2015-09-23 22:44:52 +02:00
Juergen Hoeller c7fd4ccf48 StandardScriptUtils.retrieveEngineByName for lookup with descriptive exception message
Also revised StandardScriptFactory for finer-grained template methods, added further configuration variants to StandardScriptEvaluator, and identified thread-local ScriptEngine instances in ScriptTemplateView by appropriate key.

Issue: SPR-13491
Issue: SPR-13487
2015-09-23 22:37:35 +02:00
Juergen Hoeller fe3aad4ab2 Latest dependency updates (H2 1.4.189, Underscore.js 1.8.3) 2015-09-23 22:03:08 +02:00
Sebastien Deleuze cffad9d4b1 Limit the number of ScriptEngine instances to the number of threads
This commit makes ThreadLocal<ScriptEngine> engineHolder ScriptTemplateView
field static in order to limit the maximum number of ScriptEngine instances
to the number of threads, regardless of the number of view instances.

Issue: SPR-13487
2015-09-23 13:17:37 +02:00
Nicolas Labrot e4c0859d41 Support @CrossOrigin as a merged composed annotation
Issue: SPR-13468
2015-09-22 14:55:42 -04:00
Sam Brannen 74b05118eb Polish RequestMappingHandlerMappingTests 2015-09-22 14:35:19 -04:00
Sam Brannen e2bfbdcfd1 Support attribute overrides with @ResponseStatus
This commit introduces support for attribute overrides for
@ResponseStatus when @ResponseStatus is used as a meta-annotation on
a custom composed annotation.

Specifically, this commit migrates all code that looks up
@ResponseStatus from using AnnotationUtils.findAnnotation() to using
AnnotatedElementUtils.findMergedAnnotation().

Issue: SPR-13441
2015-09-11 21:05:30 +02:00
Sebastien Deleuze f3b7e9ff2d Expose view url to render function in ScriptTemplateView
After this change, with Nashorn it is possible to use either
render(template, model) or render(template, model, url).
With JRuby or Jython, specifying the 3 parameters is mandatory.

Issue: SPR-13453
2015-09-09 18:05:04 +02:00
Sebastien Deleuze ff02ad47e0 Close properly the InputStream in ScriptTemplateView#getTemplate()
Issue: SPR-13445
2015-09-09 12:15:48 +02:00
Juergen Hoeller 99f72ce3db Polishing 2015-09-09 11:45:12 +02:00
Juergen Hoeller 5f598586ea SseEmitter exposes super constructor with timeout value
Issue: SPR-13446
2015-09-09 11:43:52 +02:00
Juergen Hoeller 52fdfd59ab Polishing 2015-09-08 18:11:30 +02:00
Juergen Hoeller 667fc7e4a9 Polishing 2015-09-04 14:38:47 +02:00
Brian Clozel e81a430e61 Fix @RequestBody(required=false) support
Prior to this commit, requests with an empty body and no Content-Type
header set would fail with a HttpMediaTypeNotSupportedException when
mapped to a Controller method argument annotated with
@RequestBody(required=false).
In those cases, the server implementation considers with an
"application/octet-stream" content type and polls messageconverters for
conversion. If no messageconverter is able to process this request, a
HttpMediaTypeNotSupportedException is thrown.

This change makes sure that such exceptions are not thrown if the
incoming request has:
* no body
* no content-type header

In this case, a null value is returned.

Issue: SPR-13147
2015-09-03 14:53:43 +02:00
Juergen Hoeller eaba794823 Removed misleading note on readonly and disabled flags in spring-form.tld
Issue: SPR-13397
2015-08-27 11:50:10 +02:00
Rossen Stoyanchev 1a9e42b49d Support multipart filename with charset
StandardMultipartHttpServletRequest now supports filenames with
charset information.

Issue: SPR-13319
2015-08-25 20:54:43 -04:00
Juergen Hoeller 4314da922a RedirectView and RequestContext use RequestContextUtils.findWebApplicationContext
Issue: SPR-13346
2015-08-25 22:16:27 +02:00
Juergen Hoeller 6aa9e0caf9 mvc:tiles-configurer supports preparer-factory and definitions-factory
Issue: SPR-13363
2015-08-25 18:10:27 +02:00
Brian Clozel 190eb6ace1 Set ETag header with VersionResourceResolver
Prior to this change, VersionResourceResolver and VersionStrategy would
resolve static resources using version strings. They assist
ResourceHttpRequestHandler with serving static resources. The
RequestHandler itself can be configured with HTTP caching strategies to
set Cache-Control headers.

In order to have a complete strategy with Cache-Control and ETag
response headers, developers can't reuse that version string information
and have to rely on other mechanisms (like ShallowEtagHeaderFilter).

This commit makes VersionResourceResolver use that version string to set
it as a request attribute, which will be used by the
ResourceHttpRequestHandler to write an ETag response header.

Issue: SPR-13382
2015-08-25 16:49:10 +02:00
Brian Clozel 0b9c3de320 Sanitize request URL in ResourceUrlEncodingFilter
Prior to this change, ResourceUrlEncodingFilter and ResourceUrlProvider
would try to resolve the resource path using the full request URL (i.e.
request path and request parameters), whereas the request path is the
only information to consider.
This would lead to StringIndexOutOfBoundsExceptions when the path +
request params information was given to the AntPathMatcher.

This commit makes the appropriate change to both
ResourceUrlEncodingFilter and ResourceUrlProvider, in order to only
select the request path.

Issue: SPR-13374
2015-08-25 14:12:03 +02:00
Sebastien Deleuze 04cff89eb7 Update ScriptTemplateView to manage content type
This commit introduces the following changes:
 - Content type can now be properly configured
 - Default content type is "text/html"
 - Content type and charset are now properly set in the response

Issue: SPR-13379
2015-08-25 01:02:12 +02:00
Sam Brannen 2df3646e90 Let Jetty pick its own available port
In an attempt to make our Jetty-based integration tests more robust,
this commit discontinues use of SocketUtils for picking a random,
available port and instead lets the Jetty Server pick its own port.
2015-08-22 18:58:55 +02:00
Juergen Hoeller c685fd7c23 Polishing 2015-08-21 17:03:53 +02:00
Sebastien Deleuze d4c74ad346 Add an ObjectMapper constructor to MappingJackson2(Json|Xml)View
Instead of having to use the default constructor then calling
setObjectMapper(ObjectMapper), these constructors allow
MappingJackson2JsonView and MappingJackson2XmlView to be created and
configured with the desired object mapper in one step.
2015-08-19 14:04:15 +02:00
Sebastien Deleuze 4338719d98 Serialize with type only collections in Jackson HttpMessageConverter
Issue: SPR-13318
2015-08-17 17:17:51 +02:00
Rossen Stoyanchev f5210ce0c8 Ensure headers committed immediately for SseEmitter
Issue: SPR-13341
2015-08-12 15:05:29 -04:00
Juergen Hoeller e0f012f32d Removal of redundant JdkVersion checks in the test suite
Issue: SPR-13312
2015-08-12 18:42:36 +02:00