Commit Graph

1558 Commits

Author SHA1 Message Date
Rossen Stoyanchev bb684ce60b Improve decoding support for multipart filename
StandardMultipartHttpServletRequest now properly decodes RFC-5987
encoded filenames (i.e. filename*) by delegating to ContentDisposition
and also support RFC-2047 syntax through javax.mail MimeUtility.

Issue: SPR-15205
2017-07-20 14:26:20 +02:00
Sebastien Deleuze fa4d139684 Support instantiating Kotlin classes with optional parameters
This commit updates BeanUtils class in order to add Kotlin optional
parameters with default values support to the immutable data classes
support introduced by SPR-15199.

Issue: SPR-15673
2017-07-20 10:44:06 +02:00
Juergen Hoeller ac1d3b22c9 Polishing 2017-07-19 22:22:27 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Juergen Hoeller 9fc4fb10b0 Nullability fine-tuning around bean properties
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 11:43:58 +02:00
Sebastien Deleuze fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Juergen Hoeller c292a89b24 Http(Async)Client not actually nullable, plus MethodInterceptor nullability
Issue: SPR-15720
2017-07-19 00:15:37 +02:00
Rossen Stoyanchev 70252a7335 Add tests for SPR-15777 2017-07-17 08:35:58 +02:00
Rossen Stoyanchev b0fc83ee05 Polish CssLinkResourceTransformer 2017-07-17 08:16:25 +02:00
Rossen Stoyanchev e37af83459 Improve docs on on use of urlDecode=false
Issue: SPR-15643
2017-07-14 16:52:02 +02:00
Rossen Stoyanchev 134ceac58e Set all strategies in CNM factory bean
ContentNegotiationManagerFactoryBean now provides an option to
explicitly set the strategies to use vs customizing a fixed
list of default strategies.

Issue: SPR-11114
2017-07-11 21:00:57 +02:00
Juergen Hoeller 00f4c36d7a Nullability fine-tuning (RequestContext, LocaleResolver)
Includes page-level JSTL time zone support for JSP tags.

Issue: SPR-15720
Issue: SPR-15746
2017-07-07 18:46:19 +02:00
Sebastien Deleuze 1fa8410995 Leverage RFC_1123_DATE_TIME formatter in tests
Issue: SPR-15661
2017-07-02 22:33:43 +02:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Rossen Stoyanchev 67330dfc23 Expose mapped handler as an exchange attribute
Issue: SPR-15564
2017-06-29 13:18:39 -04:00
Juergen Hoeller 98642c7e29 Consistent ScriptTemplateView locale resolution via request
Issue: SPR-15064
2017-06-26 23:28:49 +02:00
Rossen Stoyanchev 5b8f7f503f Deprecate adapter classes for async interceptors 2017-06-26 15:34:51 -04:00
Rossen Stoyanchev eb0479dee8 Polish 2017-06-26 14:50:11 -04:00
Violeta Georgieva e0678ba583 Add onError callback to DeferredResult
Issue: SPR-15614
2017-06-26 14:12:56 -04:00
Juergen Hoeller 098ff6f0f8 Compatibility with JDK 9 release candidate build (175)
Includes upgrade to Objenesis 2.6, Gradle 3.5.1, RxJava 2.1.1, JSON Binding API 1.0 final.

Issue: SPR-15686
Issue: SPR-15600
2017-06-26 18:58:59 +02:00
Juergen Hoeller 155a1c6c71 AsyncHandlerInterceptor.afterConcurrentHandlingStarted declared as default method
Issue: SPR-15702
2017-06-26 18:58:39 +02:00
Rossen Stoyanchev 782c595cf7 Polish 2017-06-22 18:33:27 -04:00
Eko Kurniawan Khannedy ac68cc35c2 Ordered WebMvcConfigurer interceptor registrations
Issue: SPR-15620
2017-06-22 18:33:27 -04:00
Sebastien Deleuze d5f9ad03a7 Support ScriptEngine#eval(String, Bindings) in ScriptTemplateView
Supporting ScriptEngine#eval(String, Bindings) when no render function
is specified allows to support use cases where script templates are
simply evaluating a script expression with an even more simplified
configuration.

This improvement also makes it possible to use script engines that
do not implement Invocable.

Issue: SPR-15115
2017-06-16 10:38:59 +02:00
Rossen Stoyanchev ef3e309c12 Adjust timeout in Spring MVC for reactive streaming
Issue: SPR-15669
2017-06-15 13:11:59 -04:00
Juergen Hoeller 72a8868f84 FreeMarker macros based on HTML output format (requires FreeMarker 2.3.24+)
Issue: SPR-14740
2017-06-13 14:21:09 +02:00
Juergen Hoeller 779deb0fa7 Cleanup of duplicate semicolons
Issue: SPR-15654
2017-06-13 11:38:05 +02:00
Juergen Hoeller 7dd8dc62a5 Fixes for ignored tests after last week's nullability commit
Issue: SPR-15540
2017-06-13 11:37:58 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Juergen Hoeller 14161d1dbf Protected applyLifecycleMethods in UrlBasedViewResolver
Issue: SPR-15219
2017-06-12 15:48:59 +02:00
Stephane Nicoll 451b419624 Polish "Use Map#forEach instead of Map#entrySet#forEach"
Closes gh-1449
2017-06-12 14:37:33 +02:00
diguage 2efa06237a Use Map#forEach instead of Map#entrySet#forEach
See gh-1449
2017-06-12 14:37:33 +02:00
diguage c1d44d9a34 Use the diamond syntax
Closes gh-1450
2017-06-12 09:19:06 +02:00
Stephane Nicoll 27aabb15f9 Polish "Refact iterator of Map with Java 8 forEach"
Closes gh-1451
2017-06-12 08:53:56 +02:00
diguage dab7a7f0ee Refact iterator of Map with Java 8 forEach
See gh-1451
2017-06-12 08:11:32 +02:00
Sebastien Deleuze 86580b2358 Polishing 2017-06-09 01:49:56 +03:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Rossen Stoyanchev 4d52590964 Improve docs on forwarded headers
Issue: SPR-15612
2017-06-01 22:36:12 -04:00
Brian Clozel 0557404715 Throw exception for illegal PathMatch configurations
With the new `ParsingPathMatcher` implementation, new patterns are now
allowed, such as `"/foo/{*bar}". The `"{*bar}"` segment will capture
everything until the end of the given path. Adding other elements after
that segment is illegal and will throw exceptions.

One can configure on a `PathMatchConfigurer` various options like
`useTrailingSlashMatch` and `useSuffixPatternMatch`; those options, when
enabled, will try to append suffixes like `".*"` and `"/"` to existing
path patterns. In case of a "capture the rest" pattern segment, those
options won't be honored.

This is why this commit ensures that an exception is thrown at the start
of the application if an illegal configuration is applied to the
`PathMatchConfigurer`.

Issue: SPR-15303, SPR-15558
2017-06-01 18:30:18 +02:00
QBNemo 94618c4f37 Polish doc on RequestMappingHandlerMapping#isHandler 2017-05-31 21:25:44 -04:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Sebastien Deleuze c3e6afb879 Improve null-safety to fix some Spring Boot warnings
Issue: SPR-15540
2017-05-31 17:14:49 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
skarafaz 3d290165fb Find exact matches in WebJarsResourceResolver
Prior to this commit, resolving resources from webjars using the
`WebJarAssetLocator.getFullPath` could lead to multiple candidates,
since this method is trying to find *any* resource matching that path
under the given webjar location.

This commit replaces that call with
`WebJarAssetLocator.getFullPathExact`, which avoids those multiple
matches and only resolves resources if the given path is exact.

Issue: SPR-15526
(cherry picked from commit e2aa117ff9)
2017-05-24 10:46:35 +02:00
Juergen Hoeller 0183576215 Polishing 2017-05-23 22:05:22 +02:00
Juergen Hoeller db69a082d9 Avoid java.util.Optional signatures for simple field access
Issue: SPR-15576
2017-05-23 22:05:15 +02:00
Rossen Stoyanchev 48a5938cd4 Polish 2017-05-19 16:59:36 -04:00
Martin Švorc bf83e4e861 Use original query string of forwarded request
Prior to this commit, the AbstractFlashMapManager has used the
originating URI but the query string of the forwarded request. That
resulted to FlashMap not being matched even when both originating
URI and query string matched the FlashMap attributes. The originating
query string is now used to match the forwarded request.

Issue: SPR-15505
2017-05-19 16:49:29 -04:00
Juergen Hoeller 92f18a4985 HandlerExecutionChain.toString() includes reliable interceptor number
Issue: SPR-15525
2017-05-07 21:05:16 +02:00
Juergen Hoeller 25aef4d3cc ResponseStatusException reason is optional (with lazily constructed message)
Issue: SPR-15524
2017-05-06 12:53:03 +02:00
Juergen Hoeller 39f8bd663e Polishing 2017-05-05 23:19:08 +02:00
Juergen Hoeller 4fdd85324d Aligned exception handling in Jackson and JAXB codecs
Issue: SPR-15516
2017-05-05 23:19:01 +02:00
Rossen Stoyanchev 4d962a1793 Remove HttpStatus from HttpMessageConversionException
HttpMessageConverter's are client and server and arguably shouldn't
contain a server-side concept such a response status.

The status field is recent, it was added to differentiate 400 vs 500
errors with Jackson 2.9+ but there is no need for it since the same
distinction is reflected in raising an HttpMessageNotReadableException
vs a general HttpMessageConversionException.

Issue: SPR-15516
2017-05-05 14:44:08 -04:00
Stephane Nicoll 1b9e12f52f Polish "Use Java 8 forEach method on Map"
Closes gh-1404
2017-04-28 11:07:08 +02:00
Jon Borenstein 13dc0cd828 Use Java 8 forEach method on Map 2017-04-28 11:07:08 +02:00
Juergen Hoeller 1ea54eb2c6 GenericFilterBean lazily initializes its default environment
Alignment with HttpServletBean; consistent use of EnvironmentCapable.

Issue: SPR-15469
2017-04-27 21:38:30 +02:00
Juergen Hoeller c668d9a473 Polishing 2017-04-26 18:20:19 +02:00
Rossen Stoyanchev abe3cfd8de Flux<String> + "application/json" renders as text
Spring MVC now treats Flux<String> + "application/json" as (serialized)
text to be written directly to the response as is. This is consistent
with the rendering of String + "application/json".

Issue: SPR-15456
2017-04-25 12:47:13 -04:00
Rossen Stoyanchev c67b0d6507 Properly support ResponseEntity<Flux<T>> in Spring MVC
Issue: SPR-15478
2017-04-25 12:03:59 -04:00
Stephane Nicoll 239b7086c6 Polish "Reuse constant in DispatcherServlet"
Closes gh-1398
2017-04-25 10:06:51 +02:00
QBNemo 224e369484 Reuse constant in DispatcherServlet
See gh-1398
2017-04-25 09:51:38 +02:00
Rossen Stoyanchev 7df3d68b2a Replace WebMvcConfigurerAdapter with default methods
Issue: SPR-15465
2017-04-20 16:14:13 -04:00
Rossen Stoyanchev d3b178a812 Consistent JSON array result for Flux<T> in Spring MVC
Issue: SPR-15456
2017-04-20 09:19:38 -04:00
Rossen Stoyanchev a93698487e Fix handling for ResponseEntity<Flux<T>> in Spring MVC
Issue: SPR-15456
2017-04-20 09:19:38 -04:00
Rossen Stoyanchev 633544943f Polish 2017-04-20 09:19:38 -04:00
Juergen Hoeller 0b118322b0 Polishing 2017-04-13 16:17:05 +02:00
Rossen Stoyanchev 46a790f9be Remove EmitterProcessor#connect (dropped upstream) 2017-04-13 09:58:48 -04:00
Juergen Hoeller cec36fe784 Configurable locale/timezone attribute name for SessionLocaleResolver
Issue: SPR-15450
2017-04-13 13:07:54 +02:00
Rossen Stoyanchev 043c7070e3 Polish default content type change
Issue: SPR-15367
2017-04-11 11:54:40 -04:00
Ryan O'Meara 4a890226ea Support for multiple default content types
Enhance FixedContentNegotiationStrategy and places where it is exposed
to also accept a list of media types.

Issue: SPR-15367
2017-04-11 11:54:40 -04:00
Rossen Stoyanchev 5d92a85fcb Mock Servlet request/response support Accept-Language
Issue: SPR-15209
2017-04-11 07:19:07 -04:00
Juergen Hoeller 15b5dd9f12 Polishing 2017-04-10 15:36:45 +02:00
Juergen Hoeller cf306037b5 Support for JSON Binding API (JSON-B)
Issue: SPR-14923
2017-04-10 15:36:38 +02:00
Juergen Hoeller ea98ee820a AcceptHeaderLocaleResolver returns default locale in case of no supported locale found
Issue: SPR-15426
2017-04-10 15:36:13 +02:00
Juergen Hoeller 5986f881d0 HandlerMethod evaluates ResponseStatus annotation for early caching
Issue: SPR-15227
2017-04-08 15:56:05 +02:00
Dávid Karnok 68cc57549a Restore correct order of terminated flag check 2017-04-06 14:01:49 -04:00
Rossen Stoyanchev 43eea41dd6 Polish 2017-04-06 12:54:49 -04:00
akarnokd 3312ef0aa2 Refactor AbstractEmitterSubscriber 2017-04-06 12:54:49 -04:00
Sebastien Deleuze ed8565894a Return 5xx HTTP status for invalid target types with Jackson
InvalidDefinitionException has been introduced in Jackson 2.9 to be
able to differentiate invalid data sent from the client (should still
generate a 4xx HTTP status code) from server side errors like beans with
no default constructor (should generate a 5xx HTTP status code).

Issue: SPR-14925
2017-04-05 11:31:26 +02:00
Rossen Stoyanchev f293c4d84b Doc use of reactive types in Spring MVC controllers
Issue: SPR-15365
2017-04-04 17:32:24 -04:00
Rossen Stoyanchev de6f34893a Restore ResponseBodyEmitterReturnValueHandler constructor
Issue: SPR-15410
2017-04-04 14:23:47 -04:00
Rossen Stoyanchev d9221fb87d Async boundary for Spring MVC reactive type streaming
Issue: SPR-15365
2017-04-04 11:22:40 -04:00
Juergen Hoeller f29ffb37f7 Compatibility with Servlet 4.0 b05
Issue: SPR-15379
2017-04-04 17:17:23 +02:00
Rossen Stoyanchev 62c1e44db2 Spring MVC supports reactive return values
This commit adds support for reactive library types to be returned
directly from controller methods adapting them either to a
ResponseBodyEmitter (streaming) or DeferredResult (non-streaming).

The reactive libraries supported are the ones that can adapted to a
Reactive Streams Publisher through the ReactiveAdapterRegistry.

Issue: SPR-15365
2017-04-03 09:01:49 -04:00
Rossen Stoyanchev ae1ed16cb8 Async return values refactoring in Spring MVC
Revise Javadoc on AsyncHandlerMethodReturnValueHandler to clarify its
main purpose is to prioritze custom async return value handlers ahead
of built-in ones. Also replace the interface from built-in handlers
which are prioritized already.

Remove DeferredResultAdapter and ResponseBodyEmitterAdapter --
introduced in 4.3 for custom async return value handling, since for
5.0 we will add built-in support for reactive types and the value of
these contracts becomes very marginal.

Issue: SPR-15365
2017-04-03 09:01:49 -04:00
Brian Clozel 2baceac5ff Resolve ResourceUrlProvider from current request
This commit changes `ResourceTransformerSupport` to look for the
`ResourceUrlProvider` in the current request if none is configured on
the resource transformer itself.

Issue: SPR-15369
2017-03-24 16:09:14 +01:00
Brian Clozel fdd503152d VersionResourceResolver should delegate to the chain
Prior to this commit, the `VersionResourceResolver` implementations of
`resolveUrlPathInternal` would delegate to the resolver chain but would
never use the give result if the current request didn't match a
configured version strategy pattern.

This is a problem if the resolver supposed to resolve the resource path
is configured after a `VersionResourceResolver` in the resolver chain;
this means that other resolver never gets to participate in the result
of the chain.

Issue: SPR-15372
2017-03-24 14:14:43 +01:00
Juergen Hoeller 65ba865d70 Support for populating model attributes through data class constructors
Includes a new overloaded ModelAndView constructor with an HttpStatus argument, as well as a HandlerMethodArgumentResolverSupport refactoring (revised checkParameterType signature, actually implementing the HandlerMethodArgumentResolver interface).

Issue: SPR-15199
2017-03-24 12:15:45 +01:00
Juergen Hoeller 5ea4abdb85 Revised supportedMethods null handling in HttpRequestMethodNotSupportedException
Issue: SPR-15377
2017-03-24 11:06:47 +01:00
Arjen Poutsma a287e67992 Introduce 'useRegisteredExtensionsOnly' property in classes using MediaTypeFactory
This commit introduces a `useRegisteredExtensionsOnly` property that
indicates whether classes that use the `MediaTypeFactory` for supplying
default media types can do so.

 - In classes that were introduced in Spring 5.0, the
 `useRegisteredExtensionsOnly` property takes the place of the
 `useJaf` property that was removed in 0aaa652
 - In classes that existed before Spring 5.0, the
 `useRegisteredExtensionsOnly` property is added in addition to the
 deprecated `useJaf`, the latter delegating to the former, but with
 flipped behavior.

Issue: SPR-14908
2017-03-23 17:16:46 +01:00
Juergen Hoeller e892e02f41 Polishing 2017-03-21 17:44:47 +01:00
Arjen Poutsma d414718467 Update MockServletContext to MediaTypeFactory
This commit changes the `MockServletContext.getMimeType` method to use
`MediaTypeFactory` instead of JAF. It also adds a `addMimeType(String,
MediaType)` method to customize the mime types returned from said
method.

Issue: SPR-14908
2017-03-21 09:39:22 -04:00
Arjen Poutsma 0aaa6528dc Remove JAF references
This commit updates the main code base to conform to the dropped JAF
dependency in MediaTypeFactory. Specifically, it

 - Removes JAF detection (JAF_PRESENT constants)
 - Deprecated useJaf properties, with no direct replacement.
 - Updated docs to remove JAF references, in favor of MediaTypeFactory.

Issue: SPR-14908
2017-03-21 09:11:10 -04:00
Sebastien Deleuze 9963c4a495 Fix Kotlin warnings 2017-03-10 10:35:30 +01:00
Rossen Stoyanchev 84d11e9c17 Update Javadoc on exception resolvers in MVC config
Issue: SPR-15324
2017-03-07 20:50:10 -05:00
stonio 7d062df992 Use String#isEmpty()
Closes gh-1335
2017-02-22 11:55:17 +01:00
Juergen Hoeller d2cc97af47 Polishing 2017-02-21 22:41:40 +01:00
Rossen Stoyanchev 5ea5f81c00 Support flash attributes on ResponseEntity redirect
Issue: SPR-15176
2017-02-21 14:44:17 -05:00
Juergen Hoeller 1ddf8ec625 Polishing 2017-02-21 00:04:08 +01:00
Juergen Hoeller 73493bc490 Revised imports in tests (org.jetbrains.annotations.NotNull etc) 2017-02-20 23:00:22 +01:00
Juergen Hoeller fc11321010 ServletRequestMethodArgumentResolver passes null references through (again)
Issue: SPR-15214
2017-02-20 23:00:07 +01:00
Juergen Hoeller 1ee0626c94 Polishing 2017-02-17 21:06:58 +01:00
Juergen Hoeller 199aa776c9 Support for Servlet 4.0 (PushBuilder argument, MockServletContext)
Issue: SPR-12674
2017-02-13 15:06:59 +01:00
Juergen Hoeller d44325ec91 Defensively ignore multipart parsing failure in case of error dispatch
Issue: SPR-15231
2017-02-13 15:06:52 +01:00
Brian Clozel 47ac3379ea Do not use ParsingPathMatcher by default in Spring MVC 2017-02-09 11:21:33 +01:00
Andy Clement f58ffad939 Introduce PathPatternParser for optimized path matching
This commit introduces a PathPatternParser which parses request pattern
strings into PathPattern objects which can then be used to fast
match incoming string paths. The parser and matching supports the syntax
as described in SPR-14544. The code is optimized around the common usages
of request patterns and is designed to create very little transient
garbage when matching.

Issue: SPR-14544
2017-02-09 11:09:38 +01:00
Sebastien Deleuze 02c4aff4ce Upgrade to Kotlin 1.1.0-beta-38 2017-02-03 00:33:04 +01:00
Juergen Hoeller acf511ac0e Polishing 2017-02-02 20:11:06 +01:00
Juergen Hoeller e44533f4c2 ServletRequestMethodArgumentResolver validates argument type match
Issue: SPR-15214
2017-02-02 19:59:30 +01:00
Juergen Hoeller f84907a1fc Polishing 2017-01-31 12:00:13 +01:00
Juergen Hoeller 1b2dc3638f Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
2017-01-30 22:15:55 +01:00
Sebastien Deleuze 7ff257c0ea Prevent NPE in ScriptTemplateView when no view is found
Issue: SPR-15064
2017-01-26 15:29:55 +01:00
Sebastien Deleuze 2a5d1b086f Fix Spring MVC ScriptTemplateView locale support
The locale should be set in resolveViewName() instead of
createView() in order to be taken in account with cached
views.

Issue: SPR-15064
2017-01-26 14:33:21 +01:00
Sebastien Deleuze 2d95199466 Support i18n and nested templates in ScriptTemplateView
This commit changes the 3rd parameter passed to the rendering
function from String url to RenderingContext renderingContext.

RenderingContext contains 4 properties:
 - ApplicationContext applicationContext
 - Locale locale
 - Function<String, String> templateLoader
 - String url

Issue: SPR-15064
2017-01-25 17:23:20 +01:00
Juergen Hoeller e8776f80da Revised CookieLocaleResolver parse exception handling
Issue: SPR-15182
2017-01-24 17:48:54 +01:00
Juergen Hoeller ecc22f7179 DispatcherServet.checkMultipart considers MultipartException cause as well
Issue: SPR-15178
2017-01-23 21:22:38 +01:00
Sebastien Deleuze 35d5dca571 Upgrade to Kotlin 1.1-beta-17
Spring Framework 5.0 now requires Kotlin 1.1+. This commit
also re-enable Kotlin JSR 223 unit tests.

Issue: SPR-15100
2017-01-19 13:09:38 +01:00
Juergen Hoeller af7289d6e9 Clarify WebContentInterceptor path mappings and efficiently match them
Issue: SPR-15096
(cherry picked from commit 801b93a)
2017-01-17 21:28:10 +01:00
Juergen Hoeller ac6aa53031 Drop outdated BeanFactoryLocator / beanRefContext.xml mechanism
Issue: SPR-15154
2017-01-17 13:58:37 +01:00
Juergen Hoeller 743ce2cda6 Polishing 2017-01-12 23:30:38 +01:00
Mark Hobson 2ce2f7d9a5 Introduce mime/media types for application/rss+xml
Issue: SPR-15109
2017-01-07 17:13:32 +00:00
Sam Brannen 9ed66bf2eb Clean up warnings across code base 2017-01-07 01:54:38 +01:00
Philippe Marschall 19e77cd140 Remove use of Boolean constructors
Codacy warns us that there are several references to Boolean
constructors in the tests. Direct usage of the Boolean constructor is
discouraged and even deprecated in Java 9 [1]. Boolean constructor use
can easily be replaced with the constant instances.

This commit contains the following changes:

 - replace references to Boolean constructors with boolean constants in
   JSP tag tests
 - update the copyright year where necessary
 - BooleanComparatorTests is intentionally left unchanged as it should
   also work with the non-constant instances correctly

 [1] http://download.java.net/java/jdk9/docs/api/java/lang/Boolean.html#Boolean-boolean-

Issue: SPR-15076
2017-01-04 09:31:14 +01:00
Sebastien Deleuze e78ea34711 Temporary rollback to Kotlin 1.0.6
Kotlin 1.1-M04 has a bug that makes the generated bytecode
not compatible with Kotlin 1.0.x. This bug should be fixed in
Kotlin 1.1-M05.
2017-01-03 18:07:49 +01:00
Sebastien Deleuze badde3a479 Add Kotlin based ScriptTemplateView rendering test
Kotlin JSR 223 support currently requires kotlin-script-util
dependency (jcabi-aether, maven-core and aether-api can be
excluded since they are only used for live import of
dependencies and bring a lot of JARs in the classpath) and a
/META-INF/services/javax.script.ScriptEngineFactory
file specifying the ScriptEngineFactory to use, in that case
org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory.

Issue: SPR-15059
2017-01-01 14:17:39 +01:00
Juergen Hoeller 4c005e6336 ResolvableType-based matching respects generic factory method return type
Includes consistent use of ResolvableType.resolve() wherever applicable.

Issue: SPR-15011
2016-12-17 23:10:48 +01:00
Rossen Stoyanchev 6119415427 Support for "request parameters"
ServerWebExchange now provides access to "requestParams" as a
MulitValueMap with query parameters and form data combined.

The combined map is then used for the params condition of
@RequestMapping purposes () and also for @RequestParam arguments.

Issue: SPR-15000
2016-12-15 14:24:39 -05:00
Juergen Hoeller 8a7467020f Polishing 2016-12-15 15:44:16 +01:00
Juergen Hoeller 5169c51a6c Polishing 2016-12-13 13:02:23 +01:00
Juergen Hoeller eeb7ae537f @RequestBody supports java.util.Optional
Issue: SPR-15007
2016-12-13 13:00:03 +01:00
Brian Clozel 52f664139f Improve VersionResourceResolve javadoc
The `pathPatterns` args are relative to the patterns configured for the
resource handler.

Issue: SPR-14817
2016-12-13 10:43:27 +01:00
Brian Clozel 933f1501e8 Do not include URL hash in resource paths
When getting the lookup path of a resource, both query params and hashes
should be removed from the request path.

This commit fixes the public path resolution for paths like
`/resources/main.svg#icon-hamburgermenu`.

Issue: SPR-14928
2016-12-12 15:14:50 +01:00
Brian Clozel 17089d607f Allow RedirectAttributes on ExceptionHandlers
Prior to this commit, `@ExceptionHandler` methods could not be injected
with `RedirectAttributes` arguments. This would make it impossible to
handle an error by redirecting to another view and add flashmap
attributes, to be included in the model when the next view is called.

Here is an example:

```
@ExceptionHandler(MyException.class)
public String handleException(MyException ex, RedirectAttributes
    redirectAttributes) {

  redirectAttributes.addFlashAttribute("errorMessage",
      "This is an error message");
  return "redirect:/";
}
```

This commit adds a new `RedirectAttributesMethodArgumentResolver`
instance in the list of pre-configured `HandlerMethodArgumentResolver`
in `ExceptionHandlerExceptionResolver`.

Issue: SPR-14651
2016-12-09 23:41:22 +01:00
bedrin 8315a4033f Add consumes attribute to @GetMapping
Issue: SPR-14988
2016-12-07 17:45:43 -05:00
Nicklas Holm 9a7028ad0d Javadoc fix 2016-12-02 16:22:25 -05:00
Rossen Stoyanchev 93cfc791a7 Spring MVC supports ResponseStatusException
The ResponseStatusException is now also supported in Spring MVC
through the ResponseStatusExceptionResolver.

Issue: SPR-14895
2016-11-29 15:18:02 -05:00
Sebastien Deleuze a143b57d4b Polish Kotlin nullable support
This commit polishes Kotlin nullable support by reusing
MethodParameter#isOptional() instead of adding a new
MethodParameter#isNullable() method, adds
Kotlin tests and introduces Spring Web Reactive
support.

Issue: SPR-14165
2016-11-24 18:28:50 +01:00
Raman Gupta fada91e538 Treat Kotlin nullable as non-required
Where `isOptional` is used, also check for `isNullable` i.e.
values are not considered required if they are Kotlin nullables:
- spring-messaging: named value method arguments
- spring-web: named value method arguments
- spring-webmvc: request parts

This means that Kotlin client code no longer has to explicity specify
"required=false" for Kotlin nullables -- this information is inferred
automatically by the framework.

Issue: SPR-14165
2016-11-24 17:18:55 +01:00
Juergen Hoeller 0b71e3640b Avoid defensive check for Servlet 3.1 setContentLengthLong method
Issue: SPR-14467
2016-11-24 15:30:10 +01:00
Brian Clozel b10045dc0e Do not execute ResourceUrlEncodingFilter only once per request
In case the filter is also registered to the ERROR dispatcher, the
following happens:
* the filter is executed once for the regular execution
* the filter should be executed a second time when dispatched to error

Since the filter is a `OncePerRequestFilter`, the filter is only
executed once and won't be executed when handling the error.

This can lead to situations like spring-projects/spring-boot#7348

This commit makes this filter a simple `GenericFilterBean`.

Issue: SPR-14891
2016-11-24 09:56:33 +01:00
Rossen Stoyanchev 9bcc7c3b06 Remove ResourceServlet (deprecated in 4.3) 2016-11-23 21:24:07 -05:00
Juergen Hoeller 96bfc14dba No warn logging for propagated original exception
Issue: SPR-14907
2016-11-22 16:00:23 +01:00
Juergen Hoeller 85b0ce1ef7 Avoid defensive checks against java.time API
Issue: SPR-13188
2016-11-22 14:55:03 +01:00
Juergen Hoeller da63898d5f Polishing 2016-11-21 17:36:04 +01:00
Brian Clozel cb44f2746e Prevent resource transformation of gzipped CSS files
When resolved through the `GzipResourceResolver`, CSS files can be
resolved as their pre-gzipped variant, if a ".gz" file is present in the
configured resource locations.

Such resources are gzipped and thus should not be transformed by
`CssLinkResourceTransformer`s, since rewriting those would need to
uncompress/transform/recompress. This would lead to poorer performances
than resolving plain resources and delegating compression to the
container.

This commit checks for `GzippedResource` instances in
`CssLinkResourceTransformer` and avoids processing them.

Issue: SPR-14773
2016-11-16 10:26:09 +01:00
Juergen Hoeller 84d3808b3b Upgrade to Mockito 2.2
Issue: SPR-14880
2016-11-03 22:53:35 +01:00
Rossen Stoyanchev 6c098b3301 Polish 2016-11-02 09:53:27 +02:00
Juergen Hoeller ac80ac6f8b Consistent instanceof/casting of Class references 2016-10-30 21:40:27 +01:00
Juergen Hoeller 7627c38695 Exceptions thrown from @ExceptionHandler methods logged at warn level (instead of debug)
Issue: SPR-14861
2016-10-30 21:40:20 +01:00
Rossen Stoyanchev afcc120b97 Better handling for AsyncRequestTimeoutException
Avoid call to sendError when response is committed and log a short
error message instead.

Issue: SPR-14739
2016-10-28 17:45:30 +03:00
Juergen Hoeller b7d3a969a4 ResourceHttpRequestHandler initializes PathExtensionContentNegotiationStrategy in afterPropertiesSet
Issue: SPR-14851
2016-10-28 15:13:37 +02:00
Rossen Stoyanchev efe3996cf9 Respect ModelAndView.status in @ExceptionHandler
Issue: SPR-14006
2016-10-24 16:04:49 +01:00
Juergen Hoeller 3726c6f18d Polishing 2016-10-21 12:26:27 +02:00
Rossen Stoyanchev 72397e3505 Polish
Issue: SPR-14798
2016-10-19 16:30:52 -04:00
Sebastien Deleuze 50f2cda009 Better encapsulation for CORS default permit configuration
This commit also improves CorsRegistration Javadoc.

Issue: SPR-14798
2016-10-19 15:31:22 -04:00
Rossen Stoyanchev 71201e1a43 Relax generic type detection for ResponseEntity
Before this change the getHttpEntityType method in
HttpEntityMethodProcessor raised an ISE if the generic type cannot be
detected. That made sense for resolving a controller method argument
where the target body type is crucial. However for a return value
the generic type should not be required since we either have an
actual body or no body at all in which case it doesn't even matter.

This change relaxes the checks and defaults to Object.class for the
ResponseEntity generic type on the return value side.

Issue: SPR-14799
2016-10-13 13:31:47 -04:00
Rossen Stoyanchev bd69390c0f Fix failing test 2016-10-12 08:56:52 -04:00
Sam Brannen 580b8b92f8 Fix punctuation in Javadoc 2016-10-11 20:40:12 +02:00
Brian Clozel 679b661e19 Resolve absolute resource links in ResourceTransformers
Prior to this commit, `ResourceTransformer` implementations would
resolve internal links to other resources: both relative and absolute
request paths.
For relative request paths, those transformers would call
`ResourceTransformerSupport.resolveUrlPath` with the resource path,
as provided in the original file. This can cause problems when a
`CachingResourceResolver` is configured in the resolver chain, because
this resolver is caching resources, deriving the cache key from the
given resource path — this can cause collisions for cases like this:

    resources/
    |--foo/
    |  |--foo.css (imports style.css)
    |  |--style.css
    |--bar/
    |  |--bar.css (imports style.css)
    |  |--style.css

The first "style.css" resolved resource is then cached and will be given
to any request asking for "style.css".

To avoid those issues, this commit improves the `ResourceTransformer`
implementations to calculate the absolute request path before asking the
chain to resolve the resource URL, thus avoiding duplications.
The resource chain will be then asked to resolve "/foo/style/css" or
"/bar/style.css".

Issue: SPR-14597
2016-10-11 17:45:34 +02:00
Rossen Stoyanchev 33c48e7a17 Polish reactive CORS support 2016-10-10 18:00:11 -04:00
Brian Clozel ee17f56626 Fix missing ETag/LastModified headers in responses
Prior to this commit, the `HttpEntityMethodProcessor` would avoid
writing ETag/Last-Modified response headers before calling
`ServletWebRequest` to process conditional requests. This was done to
avoid duplicate response header values due to headers being already
written to the underlying servlet response.

This is still necessary for GET/HEAD requests, since this is properly
handled by `ServletWebRequest` for those cases. But
`HttpEntityMethodProcessor` should not make that decision for
PUT/PATCH/POST responses since developers are adding response headers on
purpose and should be in control of the situation — whereas
`ServletWebRequest` does not write those headers in those cases.

Issue: SPR-14767
2016-10-04 12:08:09 +02:00
Juergen Hoeller fb7ae010c8 Avoid unnecessary generics on emptyMap/Set/List 2016-09-26 18:04:49 +02:00
Brian Clozel e3da8b5e9c Polish ResourceHttpRequestHandler, ResourceEncoder 2016-09-20 16:49:14 +02:00
Juergen Hoeller f532de92aa Revised checkResource implementation
Issue: SPR-14729
(cherry picked from commit ca17edd)
2016-09-18 21:33:52 +02:00
Brian Clozel 9e5435e6f2 Check template availability in ScriptTemplateView
This commit overrides the `checkResource` implementation in
`ScriptTemplateView` in order to check if the template file resource is
available and if the resolver can then proceed with rendering the
template.

Issue: SPR-14729
Cherry-picked from: 66b370e10
2016-09-17 22:30:54 +02:00
Sam Brannen 8f62b63663 Introduce 'value' alias for @Bean's 'name' attribute
In order to simplify configuration for use cases involving @Bean where
only a bean name or aliases are supplied as an attribute, this commit
introduces a new 'value' attribute that is an @AliasFor 'name' in @Bean.

Issue: SPR-14728
2016-09-17 16:16:06 +02:00
Brian Clozel 084daa7fb5 Document media type registration for appcache files
Since appcache manifests can have various file extensions, developers
should register the (file extension, media type) mapping in their Spring
MVC / Reactive Web configuration.

This commit adds javadoc on both `AppCacheManifestTransformer` variants
to explain how to do that.

Issue: SPR-14510
2016-09-16 12:04:56 +02:00
Juergen Hoeller 6dc1898dbb Timeout exceptions as RuntimeExceptions
Issue: SPR-14669
2016-09-15 08:54:17 +02:00
Rossen Stoyanchev 765b47246a Improve async request timeout handling
Rather than setting the status to 503 directly from the timeout
interceptor which no longer seems to work reliably with Servlet
containers like Jetty even performing an additional ERROR dispatch back
to the original URL, we know rather set the DeferredResult to an
AsyncTimeoutException, which results in a dispatch and standard
handling within Spring MVC. This should be a more reliable way of
dealing with timeouts.

Issue: SPR-14669
2016-09-14 21:34:30 -04:00
Rossen Stoyanchev bc14c5ba83 Polish [CssLinkResource|AppCacheManifest]Transformer
This commit updates the two transformers to make them more
consistent with updates of their spring-web-reactive equivalents.

Issue: SPR-14521
2016-09-13 18:04:40 -04:00
Juergen Hoeller ce42ed4d44 Polishing 2016-09-13 21:58:41 +02:00
Brian Clozel 1881aa5b5b Change default appcache manifest file extension
This commit changes the default file extension configured with
`AppCacheManifestTranformer`. This ResourceTransformer was previously
considering `.manifest` files by default, but this has been changed in
the official spec to `appcache`, in order not to clash with Microsoft's
unregistered application/manifest type.

Issue: SPR-14687
2016-09-09 22:11:20 +02:00
Brian Clozel 4588b6c9f4 Rename ResolvedResource to HttpResource
`ResolvedResource` is a rather generic name - changing the extended
interface to something more meaningful: `HttpResource`.
For now, implementations are linked with the resource handling chain,
but this aspect has been removed from the interface documentation.

Issue: SPR-14264
2016-09-09 18:18:09 +02:00
Brian Clozel ccb3c44dbc Add ResolvedResource in resource handling chain
Prior to this commit, the resource handling chain and its
`ResourceResolvers` would use specific `Resource` implementations in
order to add resource metadata to the HTTP response. For example,
`VersionedResource` and `EncodedResource` are both adding specific HTTP
response headers.

This commit aims at making this mechanism more stable and reusable,
since the previous implementation would fail in case a resolved resource
would be both a `VersionedResource` wrapping a `EncodedResource` (or the
other way arount). Only one of the specific implementations would
contribute its metadata since the code supporting that in
`ResourceHttpRequestHandler` would only check for `instanceof` tests,
whereas those implementations are acutally delegating calls to
the wrapped resource.

Now both `VersionedResource` and `EncodedResource` have been replaced by
specific implementations of `ResolvedResource`, which directly provides
those HTTP response headers as part of `getResponseHeaders()`.

This commit applies the same changes for the web reactive
implementations and its `ResourceWebHandler`.

Issue: SPR-14264
2016-09-07 09:52:33 +02:00
Brian Clozel cc5300c4d5 Align MVC checkNotModified with reactive support
Since SPR-14522, the web reactive framework supports checkNotModified
features. This commit aligns the existing MVC infrastructure with
web reactive's behavior.

Because of the new Servlet 3.0 baseline, some constraints
aren't relevant anymore and duplicate code has been removed in
`HttpEntityMethodProcessor`.

Issue: SPR-14659
2016-09-06 18:02:48 +02:00
Brian Clozel 72e4fac28d Fix missing resources in GzipResourceResolverTests 2016-09-06 15:39:28 +02:00
Rossen Stoyanchev 108ebe0f2b Polish resource handling tests 2016-09-05 21:59:22 -04:00
Brian Clozel a8ba065a6e Mention AntPathMatcher regexp support
This commit documents the regexp support in `AntPathMatcher` when
matching for URL patterns. This support is also mentioned in places
where developers can register patterns for ViewControllers or resource
handlers.

Issue: SPR-14652
2016-09-02 11:35:58 +02:00
Juergen Hoeller e08b1b75b6 @PathVariable supports 'required' attribute (for model attribute methods)
Issue: SPR-14646
2016-08-31 14:43:39 +02:00
Brian Clozel 7a88776329 Fix missing ResourceHttpRequestHandler init in registry
Issue: SPR-14577
2016-08-31 10:43:11 +02:00
Rossen Stoyanchev 436486b8a1 Relax ServletContext check for resource handling
This is a follow-up on commit 3b95e0b relaxing the expectation that a
ServletContext is present. Instead we check defensively and fall back
on PathExtensionContentNegotiationStrategy which can use JAF.

Issue: SPR-14577
2016-08-30 13:04:58 -04:00
Sebastien Deleuze e8530c917e Add Smile and CBOR Jackson data formats support
This commit adds Smile and CBOR Jackson HttpMessageConverters
and make it possible to create Smile and CBOR ObjectMapper via
Jackson2ObjectMapperBuilder, which now allows to specify any
custom JsonFactory.

Like with JSON and XML Jackson support, the relevant
HttpMessageConverters are automaticially configurered by
Spring MVC WebMvcConfigurationSupport if jackson-dataformat-smile
or jackson-dataformat-cbor dependencies are found in the classpath.

Issue: SPR-14435
2016-08-30 11:06:40 +02:00
Rossen Stoyanchev 204a50ee6c Fix compile issue 2016-08-29 21:06:35 -04:00
Rossen Stoyanchev 4d3c3056ed Polish media type change in ResourceHttpRequestHandler 2016-08-29 19:49:24 -04:00
Rossen Stoyanchev 3b95e0b6e0 Fix media type regression in resource handling
Issue: SPR-14577
2016-08-29 16:27:24 -04:00
Juergen Hoeller dfdfd72a3e Polishing
(cherry picked from commit 430180a)
2016-08-26 18:59:40 +02:00
Brian Clozel d8fc13f6fc Fix server errors for invalid If-None-Match request headers
HttpEntityMethodProcessor should not throw IllegalArgumentExceptions for
invalid If-None-Match headers.

For those cases, this commit makes sure that both
`HttpEntityMethodProcessor` and `ServletWebRequest` have a consistent
behavior and stop processing the request as conditional and leave the
handler handle it.

Issue: SPR-14559
2016-08-26 15:48:47 +02:00
Juergen Hoeller 2e4a7480fc Consistent use of JDK 7 StandardCharsets over Charset.forName
Issue: SPR-14492
2016-08-26 14:16:19 +02:00
Juergen Hoeller 14046575b0 Polishing 2016-08-26 13:27:33 +02:00
Juergen Hoeller a8f7f75f64 Moved encodeHttpHeaderFieldParam method to HttpHeaders itself (including tests)
This commit also sets the test source encoding to UTF-8.

Issue: SPR-14547
2016-08-26 11:14:02 +02:00
Juergen Hoeller d047174c6b Unit test for empty Access-Control-Request-Headers (Chrome 52)
Includes optimized method/header resolution in CorsConfiguration.

Issue: SPR-14617
2016-08-24 11:40:18 +02:00
Juergen Hoeller 7bb4ab6842 Various @since tags (and varargs on setInterceptors)
(cherry picked from commit 5222489)
2016-08-18 12:58:02 +02:00
Juergen Hoeller 453822817f Protected visibility for configurePathMatch and configureAsyncSupport
Issue: SPR-14599
2016-08-18 10:15:48 +02:00
Juergen Hoeller d2e3a1a4f5 DelegatingWebMvcConfiguration properly delegates extendHandlerExceptionResolvers
Issue: SPR-14599
2016-08-18 09:05:47 +02:00
Juergen Hoeller eeeab27f1f Polishing
(cherry picked from commit 35e247a)
2016-08-10 16:42:21 +02:00
Juergen Hoeller 59a24b406a Polishing 2016-08-10 14:20:42 +02:00
Sebastien Deleuze e86529ec90 Prevent StackOverflowError in AbstractJackson2HttpMessageConverter
Issue: SPR-14520
2016-08-04 11:20:38 -07:00
Juergen Hoeller e03dea1d64 Polishing 2016-07-26 17:15:19 +02:00
Juergen Hoeller 382a931e7d Polishing 2016-07-22 22:28:20 +02:00
Marius Grama 3635c9dbfe Update xmlunit library to version 2.1.0
xmlunit 2.1.0 is the latest release for xmlunit.
Most of the xmlunit functionality used within spring-framework
was done through the xmlunit 1.x helper class
`org.custommonkey.xmlunit.XMLAssert`.

As of xmlunit 2.0.0 most of the XML comparison methods are done
through hamcrest matchers exposed by the xmlunit-matchers
library. In some cases during the migration, the matchers
had to be customized with custom `NodeMatcher` or
`DifferenceEvaluator` instances in order to keep the assertions
correct (they were performed with xmlunit 1.x previously).

Issue: SPR-14043
2016-07-21 15:04:21 +02:00
Juergen Hoeller 9cc625ee2c Polishing
(cherry picked from commit 5a92aa4)
2016-07-20 23:25:17 +02:00
Juergen Hoeller 28e7c11234 Polishing 2016-07-20 22:41:56 +02:00
Sebastien Deleuze 3a4e5d5da8 Fix ParameterizedType + contextClass support in Jackson converter
Issue: SPR-14470
2016-07-20 09:29:23 +02:00
Juergen Hoeller 99be15f58b Revise encoding steps towards use of JDK Charset and StandardCharsets
Issue: SPR-14492
2016-07-19 23:43:06 +02:00
Juergen Hoeller adc595b5f1 Avoid dependency on WebUtils for extracting file extension
Issue: SPR-14479
2016-07-19 23:30:33 +02:00
Juergen Hoeller fd4b5ac892 Ignore JRuby template tests (not compatible with JDK 9 yet)
Issue: SPR-13344
2016-07-19 19:42:31 +02:00
Juergen Hoeller d07381e862 Avoid deprecated number constructors on JDK 9
Issue: SPR-13344
2016-07-19 19:25:55 +02:00
Juergen Hoeller aaac199e8b Consistently use constructor-based instantiation instead of Class.newInstance / BeanUtils.instantiate
Issue: SPR-14486
2016-07-19 19:21:06 +02:00
Juergen Hoeller 8bb34bc962 Resource.isFile() and JAF MediaTypeFactory
Issue: SPR-14484
2016-07-19 18:53:31 +02:00
Juergen Hoeller dc1664939c Javadoc fixes and pruning of outdated references 2016-07-15 22:12:11 +02:00
Juergen Hoeller 503f0e3397 Polishing 2016-07-15 17:27:59 +02:00
Juergen Hoeller 8ccd727c9a AbstractHandlerMethodMapping adds type+method info to getMappingForMethod exceptions
Issue: SPR-14452
2016-07-13 15:42:34 +02:00
Juergen Hoeller 84afc601b8 Configurable UrlPathHelper in PathExtensionContentNegotiationStrategy
This commit also aligns ResourceUrlProvider's and RequestMappingInfo's UrlPathHelper setter/getter signatures.

Issue: SPR-14454
2016-07-13 15:14:42 +02:00
Juergen Hoeller 6aa5931e28 Polishing 2016-07-07 01:05:25 +02:00
Juergen Hoeller a1f5fb53db Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
2016-07-07 01:04:24 +02:00
Juergen Hoeller da9c24c41e Polishing 2016-07-06 18:11:33 +02:00
Juergen Hoeller 102dc8a4dd Polishing 2016-07-06 15:29:15 +02:00
Juergen Hoeller 76dedd7ca2 FactoryBean, BeanPostProcessor and HandlerInterceptor variants declared with default methods
Issue: SPR-14432
2016-07-06 15:10:08 +02:00
Stephane Nicoll e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +02:00
Juergen Hoeller 7dda9fbd8c Drop JasperReports support
Issue: SPR-13294
2016-07-05 23:06:15 +02:00
Juergen Hoeller bc2c22d51e Streamline XML namespace support towards unversioned schemas
This commit also removes support code for outdated options which were only available in older schema versions.

Issue: SPR-13499
2016-07-05 20:50:03 +02:00
Sam Brannen 1391248ea6 Introduce log4j 2 for Spring's test suite
This commit adds a test runtime dependency on log4j 2 for every project
and migrates all log4j.properties files to log4j2-test.xml files.

Issue: SPR-14431
2016-07-05 19:19:09 +02:00
Stephane Nicoll 00d2606b00 Explicit type can be replaced by <>
Issue: SPR-13188
2016-07-05 17:00:34 +02:00
Juergen Hoeller b5db5d3aac Broadly remove deprecated core classes and methods
Issue: SPR-14430
2016-07-05 15:52:49 +02:00
Juergen Hoeller 0fc0ce78ae Drop deprecated dependencies on Log4j, JRuby, JExcel, Burlap, Commons Pool/DBCP
This commit also removes outdated support classes for Oracle, GlassFish, JBoss.

Issue: SPR-14429
2016-07-05 15:46:53 +02:00
Juergen Hoeller 51252ebbca Avoid defensive checks against Java 8 API (java.util.Optional etc)
This commit also fixes broken javadoc links and code references.

Issue: SPR-13188
2016-07-05 02:09:00 +02:00
Juergen Hoeller 2b3445df81 Drop Portlet MVC support
This commit also removes the corresponding deprecated Servlet MVC variant and updates DispatcherServlet.properties to point to RequestMappingHandlerMapping/Adapter by default.

Issue: SPR-14129
2016-07-04 23:33:47 +02:00
Juergen Hoeller ae0b7c26c5 Drop Servlet 2.5 runtime compatibility
Issue: SPR-13189
2016-07-04 23:31:21 +02:00
Juergen Hoeller ff6ead1fff Remove Velocity support
Issue: SPR-13795
2016-07-04 23:30:58 +02:00
Juergen Hoeller b204437cef Polishing 2016-07-02 14:48:15 +02:00
Juergen Hoeller e7a53e37fb Avoid stateful MethodParameter nesting level changes in MVC processing 2016-07-02 13:02:22 +02:00
Juergen Hoeller cfc560c4c4 Leniently accept custom DeferredResult etc subclasses for null values
Issue: SPR-14423
2016-07-02 12:55:30 +02:00
Rossen Stoyanchev 9c29ed75f8 Suppress OPTIONS handling for an ERROR dispatch
Issue: SPR-14410
2016-06-30 12:34:54 -04:00
Juergen Hoeller 16949941f8 MatchableHandlerMapping extends HandlerMapping and lives in web.servlet.handler now
Issue: SPR-14321
2016-06-30 14:38:26 +02:00
Rossen Stoyanchev 89396ff01f Refactor handleNoMatch for @RequestMapping
Originally handleNoMatch looked for partial matches based on URL
pattern, HTTP method, consumes, produces, and params in that order
but without narrowing down the set of partial matches resulting in
potentially inaccruate response status codes

Commit 473de0 added an improvement to narrow the set with partial
matches for URL pattern and HTTP method matches.

This commit overhauls handleNoMatch so that the narrowing down of
matches happens at each stage resulting in more accurate error
reporting for request mappings with fine-grained conditions.

Issue: SPR-14397
2016-06-29 15:59:00 -04:00
Juergen Hoeller 2d5496df2b Polishing 2016-06-29 15:53:46 +02:00
Juergen Hoeller f2328e8e3c Polishing 2016-06-29 10:57:16 +02:00
Rossen Stoyanchev 775ffbe10b Improve static resource path check 2016-06-28 16:46:51 -04:00
Sam Brannen 1a7c6d3b10 Update @since tags in HandlerMappingIntrospector & Co. 2016-06-28 19:04:03 +02:00
Rossen Stoyanchev 2cdcf752ba MvcUriComponentsBuilder respects optional params
Issue: SPR-14405
2016-06-27 16:02:54 -04:00
Rossen Stoyanchev e38623df87 Fix MediaType lookup for ResourceHttpRequestHandler
As of 4.3 ResourceHttpRequestHandler delegates to the configured
ContentNegotiationManager, or one created internally, to look up
the media type for are resource.

This commit ensures the internally created ContentNegotiationManager is
correctly injected with the ServletContext through which it can perform
lookups as before.

Also the ServletPathContentNegotiationStrategy now checks the
ServletContext first and then delegates to its parent the
PathContentNegotiationStrategy and not vice versa. This is
consistent with how handleNoMatch (also in the same class) works
and also matches how ResourceHttpRequestHandler worked before 4.3.

Issue: SPR-14368
2016-06-27 14:56:55 -04:00
Rossen Stoyanchev a30ab30e4e Introduce HandlerMapping introspection API
Issue: SPR-14321
2016-06-27 14:23:02 -04:00
Brian Clozel a25c43f695 Enforce UTF-8 response encoding in SseEmitter
This commit sets the response content type to
"text/event-stream;charset=UTF-8". Even if the SSE spec says that the
encoding should always be UTF-8 and that specifying the charset is
optional, we're setting it in all cases, since some containers might use
the default encoding "ISO-8859-1" and confuse HTTP clients.

Issue: SPR-14407
2016-06-27 17:05:31 +02:00
Brian Clozel 0345d734e6 Improve exception logging in HandlerExceptionResolvers
This commit updates AbstractHandlerExceptionResolver to only log at the
WARN level exceptions that are actually resolved by the
ExceptionResolver.

In case developers wish to log each time an ExceptionResolver is called,
a DEBUG level log is still available.

Issue: SPR-14392
2016-06-23 14:12:37 +02:00
Rossen Stoyanchev 058279bc7e HEAD mapping has higher priority over other conditions
When comparing multiple matching @RequestMapping's, the HTTP method
condition has the lowest precedence. It's mainly about ensuring an
explicit mapping wins over an implicit (i.e. no method) one.

As of 4.3 HTTP HEAD is handled automatically for controller methods
that match to GET. However an explicit mapping HTTP HEAD allows an
application to take control.

This commit ensures that for HTTP HEAD requests the HTTP method
condition is checked first which means that an explicit HEAD mapping
now trumps all other conditions.

Normally we look for the most specific matching @RequestMapping.
For HTTP HEAD we now look for the most specific match among
@RequestMapping methods with a HEAD mapping first.

Issue: SPR-14383
2016-06-21 13:32:40 -04:00
Rossen Stoyanchev db1092f119 Polish RequestMappingInfoTests 2016-06-21 10:43:08 -04:00
Rossen Stoyanchev 919f6c96f9 ForwardedHeaderFilter is case-insensitive
Issue: SPR-14372
2016-06-17 14:20:42 -04:00
Juergen Hoeller 981c894acf @ExceptionHandler matches against cause type as well
Issue: SPR-14291
2016-06-07 21:22:01 +02:00
Juergen Hoeller 8c4bc3656b Polishing 2016-06-07 15:42:16 +02:00
Juergen Hoeller a9fda3e7e2 Defensive catching of any Throwable subclasses instead of just Error
Issue: SPR-14329
2016-06-04 00:17:20 +02:00
youmoo 9975f02e4d Method comment is wrong 2016-06-01 17:00:42 +02:00
Juergen Hoeller 37de0e45f6 Polishing 2016-06-01 11:39:08 +02:00
Rossen Stoyanchev fc40643033 Optimize Consumes/ProducesRequestCondition
Before this change Consumes/ProducesRequestCondition shared a common
match method in the package private AbstractMediaTypeExpression. The
benefit, two lines of code, was negligible but was forcing each
condition into parsing the content type of the request body or
evaluating the content type for the response respectively.

This change removes the shared match method and brings it down into
each sub-class resulting in a performance improvement as well as in
simpler code including exception handling.

Issue: SPR-14299
2016-05-31 14:55:50 -04:00
Rossen Stoyanchev 27215b5061 Negated produces works with no Accept header present
Issue: SPR-14299
2016-05-31 14:44:27 -04:00
Rossen Stoyanchev 8343ce9e44 Add defaultLocale to AcceptHeaderLocaleResolver
Issue: SPR-14312
2016-05-31 13:55:11 -04:00
Rossen Stoyanchev f20f6c952a Flush headers after null ResponseBodyEmitter
Issue: SPR-14315
2016-05-31 09:35:02 -04:00
Rossen Stoyanchev 431a50823f Polish 2016-05-31 09:35:01 -04:00
Lifu Zhou 7e95cd8b4e Flush headers after null StreamingResponseBody
Issue: SPR-14315
2016-05-31 09:34:51 -04:00
Juergen Hoeller 2d85accb83 SpringTilesContainerFactory uses Tiles 3's createDecoratedContainer
Issue: SPR-14311
2016-05-27 18:24:49 +02:00
Juergen Hoeller dacc31e3d3 For attribute is not actually required
Issue: SPR-14287
2016-05-26 19:18:30 +02:00
Rossen Stoyanchev c2625f968c Properly handle single-value map with @MatrixVariable
Issue: SPR-14294
2016-05-22 09:53:42 -04:00
Juergen Hoeller 5682950289 Polishing 2016-05-06 12:03:10 +02:00
Juergen Hoeller 42d32ba396 ResourceRegion fits better in core.io.support (next to EncodedResource)
Issue: SPR-14221
2016-05-06 12:02:51 +02:00
Juergen Hoeller e5dbe12e85 ResourceHttpRequestHandler sets "Accept-Ranges" header only once
Issue: SPR-14221
2016-05-06 11:50:47 +02:00
Sam Brannen 7b13311f03 Delete unused imports 2016-05-03 20:12:37 +02:00
Brian Clozel 5ac31fb39d Refactor HTTP Range support with ResourceRegion
Prior to this commit, the `ResourceHttpMessageConverter` would support
all HTTP Range requests and `MethodProcessors` would "wrap" controller
handler return values with a `HttpRangeResource` to support that use
case in Controllers.

This commit refactors that support in several ways:
* a new ResourceRegion class has been introduced
* a new, separate, ResourceRegionHttpMessageConverter handles the HTTP
range use cases when serving static resources with the
ResourceHttpRequestHandler
* the support of HTTP range requests on Controller handlers has been
removed until a better solution is found

Issue: SPR-14221, SPR-13834
2016-05-02 19:00:52 +02:00
Brian Clozel 977840884b Allow custom instances of WebJarAssetLocator
This commit allows to configure a custom WebJarAssetLocator in
WebJarResourceResolvers.

Issue: SPR-14092
2016-04-28 19:02:04 +02:00
Sebastien Deleuze 15138ed96f Revisit ScriptTemplateView resource loading
Resources are now retrieved using the application context in order to
support natively non-classpath locations like /WEB-INF/...

As a consequence of this refactoring, ScriptTemplateView#createClassLoader()
protected method as been removed, since it did not make sense anymore with
this new resource loading implementation.

Issue: SPR-14210
2016-04-28 15:40:14 +02:00
Juergen Hoeller d06188ed4d ResponseEntity allows for setting non-standard status code
Issue: SPR-14205
2016-04-26 23:06:10 +02:00
Rossen Stoyanchev 5ec6206e3f 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 master branch.

Issue: SPR-14186
2016-04-21 14:11:49 -04:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Rossen Stoyanchev 7cdcc102a9 Explicit HEAD sorted higher than implicit GET match
Issue: SPR-14182
2016-04-17 15:12:43 -04:00
Juergen Hoeller 537193a4e0 Consistent license header 2016-04-11 20:49:38 +02:00
Juergen Hoeller 4ae065996b Polishing
(cherry picked from commit aa5c12c)
2016-04-08 23:06:25 +02:00
Juergen Hoeller 37bd51cf6d Handle Resources beyond int length through Servlet 3.1's setContentLengthLong
Issue: SPR-14135
2016-04-08 15:54:24 +02:00
Juergen Hoeller ed14ae60e5 Consistent deprecation of outdated MVC infrastructure classes
Issue: SPR-14128
2016-04-07 11:37:34 +02:00
Juergen Hoeller f6cb30b165 @ExceptionHandler is able to process Error thrown from handler method
Issue: SPR-11106
2016-03-31 11:52:36 +02:00
Juergen Hoeller 2dae4d8134 Deprecated FormTag's "commandName" in favor of "modelAttribute"
Issue: SPR-14094
2016-03-29 12:09:16 +02:00
Juergen Hoeller 94cb7786c8 Polishing 2016-03-25 23:28:45 +01:00
Juergen Hoeller 775bcccd10 Polishing 2016-03-24 21:44:16 +01:00
Juergen Hoeller 852212d0c5 Polishing 2016-03-24 19:57:54 +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
Juergen Hoeller 9a52c81443 UriComponentsBuilder allows more efficient (and less restrictive) CORS origin comparison
Also introduces a specifically narrowed cloneBuilder() method for UriComponentsBuilders.

Issue: SPR-14080
2016-03-24 15:33:44 +01:00
Juergen Hoeller 3eff478c45 RequestMethodsRequestCondition uses common HttpMethod resolution
Issue: SPR-13776
2016-03-24 13:54:00 +01:00
Juergen Hoeller 86d5c5c0f7 Avoid putIfAbsent call in HttpEntityMethodProcessor
Issue: SPR-14086
2016-03-24 13:51:48 +01:00
Brian Clozel 20bb25647f Polish 2016-03-24 10:56:46 +01:00
Juergen Hoeller 5025c615b1 Consistent use of AnnotatedElementUtils.findMergedAnnotation/hasAnnotation
Issue: SPR-13440
2016-03-23 18:39:20 +01:00
Juergen Hoeller 311d4c95a3 Revised newline handling tests pass on Windows now
Issue: SPR-13503
2016-03-23 18:35:26 +01:00
Brian Clozel e079a726f8 Polish 2016-03-23 16:40:12 +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
Brian Clozel 15fe8279e6 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
2016-03-23 16:35:13 +01:00
Kazuki Shimizu 9b2023111d Add newline at the beginning of textarea macro for FreeMarker and Velocity
Issue: SPR-13503
2016-03-23 11:31:16 +01:00
Rossen Stoyanchev 7a5e93ff16 Add support for setting the "Vary" response header
Issue: SPR-14070
2016-03-22 21:47:55 -04:00
Rossen Stoyanchev 6bfe0c050d Polish 2016-03-22 20:59:16 -04:00
Rossen Stoyanchev 92dd4eb3ef Fix NPE in ResponseBodyEmitterReturnValueHandler
The possibility of NPE was introduced in the previous commit:
971ccab038

Issue: SPR-14046
2016-03-16 13:40:35 -04: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
Rossen Stoyanchev 971ccab038 DeferredResult/ResponseBodyEmitter adapter mechanism
The DeferredResult~ and the ResponseBodyEmitterReturnValueHandler now
each expose an adapter mechanism for plugging in other async return
value types. As a result the ListenableFutureReturnValueHandler and
CompletionStageReturnValueHandler are no longer needed and are now
deprecated.

Issue: SPR-14046
2016-03-14 12:20:02 -04:00
Juergen Hoeller d124a13eb4 Consistent use of empty enumerations 2016-03-11 15:07:59 +01:00
Juergen Hoeller 8852a5e178 Support for placeholders in @CrossOrigin attributes
Issue: SPR-14010
2016-03-11 15:04:16 +01:00
Brian Clozel 8ca6a18dae Allow Validator config in XML websocket namespace
This commit adds a new "validator" XML attribute to the
`<websocket:message-broker/>` element. This allows configuring a
specific Validator to be used for payload validation.

Issue: SPR-13996
2016-03-10 16:35:20 +01:00
Brian Clozel 0a56667093 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
2016-03-08 17:07:59 +01:00
Rossen Stoyanchev ff2a911baa Update MVC config to use CNM for static resources
The MVC config now plugs the configured ContentNegotiationManager into
resource request handling.

Issue: SPR-13658
2016-03-04 16:06:01 -05: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 1a76f7e9c2 Polish static resource handling 2016-03-04 16:05:49 -05:00
Brian Clozel 5067f00228 Polish
Issue: SPR-14018
2016-03-04 11:38:25 +01:00
Ruben Dijkstra 41da04d386 Remove duplicate slash from resolved WebJar locations
This commit updates the WEBJARS_LOCATION in WebJarResourceResolver to
avoid getting duplicate slashes in resolved resources locations such
as `/webjars//bootstrap/3.3.2/js/bootstrap.min.js`.

Issue: SPR-14018
2016-03-04 11:36:30 +01:00
Brian Clozel 44c32128dc 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
2016-03-03 16:48:17 +01:00
Brian Clozel 50bcd67fb6 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
2016-03-02 17:42:44 +01:00
Brian Clozel 3df66d023c Polish documentation on WebApplicationInitializer
Issue: SPR-13978
2016-03-01 17:38:52 +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 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