Commit Graph

1761 Commits

Author SHA1 Message Date
Rossen Stoyanchev a55ca56e34 BEST_MATCHING_HANDLER_ATTRIBUTE for spring-webmvc
Issue: SPR-17518
2018-11-20 22:31:02 -05:00
Juergen Hoeller ce5c65c0b0 Upgrade to JAXB 2.3.1, Groovy 2.5.4, Jetty 9.4.14, Tomcat 9.0.13
Includes JAX-WS 2.3.1, Awaitility 3.1.3, OkHttp 3.12, Woodstox 5.2.
2018-11-19 12:41:26 +01:00
Stephane Nicoll 7b6f2f8fb3 Polish contribution
Closes gh-2019
2018-11-19 08:45:33 +01:00
Hanope bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00
HeemangHan 729ce4108d Correct typos (#2018) 2018-11-17 16:31:01 +01:00
Rossen Stoyanchev c89e6c616a Improve logging of request mapping information
Issue: SPR-17450
2018-11-16 17:30:18 -05:00
Juergen Hoeller 40148c0560 Consistent use of ResolvableType.toClass() for assignability checks
Issue: SPR-17086
2018-11-12 20:29:37 +01:00
Juergen Hoeller c58da71006 Synthesize parameter annotations from interface methods as well
Issue: SPR-17460
2018-11-12 16:23:14 +01:00
Juergen Hoeller b1f5f51503 Synchronized onRefresh execution for concurrent ContextRefreshedEvent
Issue: SPR-17442
2018-11-05 19:27:43 +01:00
Juergen Hoeller f65408f646 Avoid references to groovy-all artifact across all modules
Issue: SPR-17446
2018-11-05 12:27:07 +01:00
Juergen Hoeller 991e9f4269 Upgrade to Joda-Time 2.10.1 2018-10-29 18:33:36 +01:00
Juergen Hoeller 3fee8cb625 Polishing 2018-10-26 11:43:46 +02:00
Juergen Hoeller f32e1bcbe3 Polishing 2018-10-26 11:07:29 +02:00
Brian Clozel 2146e13787 Fix absolute paths when transforming resources
Prior to this commit, `ResourceTransformerSupport.toAbsolutePath`
would call `StringUtils.applyRelativePath` in all cases. But this
implementation is prepending the given path even if the relative path
starts with `"/"`.

This commit skips the entire operation if the given path is absolute,
i.e. it starts with `"/"`.

Issue: SPR-17432
2018-10-25 16:42:47 +02:00
Juergen Hoeller 67bd3f670f Upgrade to AspectJ 1.9.2, Rome 1.11.1, OpenPDF 1.2.5, POI 4.0 2018-10-25 15:15:47 +02:00
Brian Clozel 50a4769162 Fix ResourceUrlEncodingFilter lifecycle
Prior to this commit, the `ResourceUrlEncodingFilter` would wrap the
response and keep a reference to the request. When
`HttpServletResponse.encodeURL` is later called during view rendering,
the filter looks at the request and extracts context mapping information
in order to resolve resource paths in views.

This approach is flawed, when the filter is used with JSPs - if the
request is forwarded to the container by the `InternalResourceView`,
the request information is overwritten by the container. When the view
is being rendered, the information available in the request is outdated
and does not allow to correctly compute that context mapping
information.

This commit ensures that that information is being extracted from the
request as soon as the `ResourceUrlProvider` is set as a request
attribute.

Issue: SPR-17421
2018-10-24 21:18:57 +02:00
Juergen Hoeller ffa032e78f Polishing 2018-10-24 20:46:26 +02:00
Rossen Stoyanchev 41e6aa6de2 Restore log level for resolved exceptions
The fix for SPR-17178 switched from debug to warn level warning for
all sub-classes of AbstractHandlerExceptionResolver where the request
concerned the DefaultHandlerExceptionResolver only.

This commit restores the original DEBUG level logging that was in
AbstractHandlerExceptionResolver from before SPR-17178. In addition
DefaultHandlerExceptionResolver registers a warnLogCategory by default
which enables warn logging and hence fulfilling the original goal
for SPR-17178.

Issue: SPR-17383
2018-10-22 12:13:18 -04:00
Rossen Stoyanchev de453ace86 Revert "@ExceptionHandler methods logs at DEBUG level again"
This reverts commit 162112.

Instead we'll go for a bigger rollback of the change from SPR-17178 so
that only DefaultHandlerExceptionResolver does warn logging by default.

Issue: SPR-17388
2018-10-22 11:46:02 -04:00
Rossen Stoyanchev 1621125ccf @ExceptionHandler methods logs at DEBUG level again
Issue: SPR-17383
2018-10-18 22:49:47 -04:00
Juergen Hoeller 93bb78ec23 Avoid private bean classes in integration tests (for CGLIB on JDK 11)
Issue: SPR-16391
2018-10-15 12:26:38 +02:00
Rossen Stoyanchev bb5c8ed4e8 Correct Javadoc in ServletUriComponentsBuilder
Replace all method level comments related to forwaded headers, some
current and some outdated, with a single class-level comment.

Issue: SPR-17317
2018-10-09 16:51:41 -04:00
Juergen Hoeller c385a1de83 Polishing 2018-09-17 15:17:39 +02:00
Juergen Hoeller 34663300a6 Avoid regex pattern matching for simple String replacement steps
Issue: SPR-17279
2018-09-17 14:22:19 +02:00
Simon Bowring cc87fbcb7f Fix javadoc comments to match behaviour 2018-09-17 12:25:39 +02:00
Rossen Stoyanchev db8e9eafb2 Add LogFormatUtils
1. Helper method to eliminate duplication in formatting (de-)serialized
   values for logging introduced with prior commit #e62298.

2. Helper method for TRACE vs DEBUG logging with different details.

Issue: SPR-17254
2018-09-14 18:06:46 -04:00
Rossen Stoyanchev e62298eaad Truncate logged encoded and decoded values if necessary
At DEBUG show up to 100 chars, at TRACE show full formatted value.

Note that the formatValue helper method is duplicated a number of times
in this commit. A utility method will likely be added in spring-core
through an extra commit.

Issue: SPR-17254
2018-09-14 12:20:03 -04:00
Juergen Hoeller 66c66baa8f Upgrade to Rhino 1.7.10
Includes reordering of web dependency declarations.
2018-09-14 14:03:53 +02:00
Juergen Hoeller cbc0fad961 Upgrade to Kotlin 1.2.70
Includes Hibernate ORM 5.1.16 and Hibernate Validator 6.0.13.
2018-09-13 18:23:42 +02:00
Juergen Hoeller e49896d95f Upgrade to Mockito 2.22, XMLUnit 2.6.2, JavaMail 1.6.2
Also includes Apache Johnzon 1.1.9.
2018-09-10 10:52:24 +02:00
Juergen Hoeller 6c487f7799 Revise ServletUriComponentsBuilder javadoc
Issue: SPR-17255
2018-09-07 18:11:18 +02:00
figueroaRicardo aa848d54ff Fix typo on javadoc
`ForwardedHeaderFilter` instead of `ForwardedHeaderFiller`
2018-09-07 18:00:06 +02:00
Juergen Hoeller 3067682347 Upgrade to Hibernate ORM 5.3.6 and OpenPDF 1.2.2 2018-09-04 23:02:35 +02:00
Kei KATO c2585073ba Fix typos
Closes gh-894
2018-09-03 10:05:14 +02:00
Juergen Hoeller 03f1920106 Support Jackson filters in combination with serialization view
Issue: SPR-17209
2018-08-24 12:06:52 +02:00
Sam Brannen 2bb15f7ed2 Fix grammar in JavaDoc for fully qualified links
This commit represents a best effort attempt at fixing remaining
"a" vs. "an" grammatical errors related links specified via a fully
qualified class name.

Issue: SPR-17208
2018-08-23 17:59:44 +02:00
Juergen Hoeller a6a6cf7d97 Upgrade to Java Activation Framework 1.2 as API dependency
Includes XMLUnit 2.6.1 and Undertow 2.0.13.

Issue: SPR-16115
2018-08-17 16:01:15 +02:00
Rossen Stoyanchev ad88c02bc3 Restore formatting change following revert 2018-08-17 09:53:47 +03:00
Rossen Stoyanchev 498984324d Revert "Add handleFailure property to FrameworkServlet"
This reverts commit 29ce6685ca.
2018-08-17 09:47:00 +03:00
Juergen Hoeller 04d2d1da0d Consistently use double quotes (even if no interpolation needed)
Includes upgrade to Hibernate ORM 5.3.5, EclipseLink 2.7.3, Selenium HtmlUnit Driver 2.32.1, Jetty 9.4.12 RC2.
2018-08-16 15:32:44 +02:00
Juergen Hoeller 5d7fb1a1c2 Polishing 2018-08-16 12:08:26 +02:00
Brian Clozel f2506ca7a1 Revert "Infer HTTP 404 from empty Optional/Publisher types"
This reverts commit 7e91733502.
2018-08-15 15:15:35 +02:00
Brian Clozel 7e91733502 Infer HTTP 404 from empty Optional/Publisher types
This commit handles "empty" cases for `ResponseEntity` controller
handler return types when wrapped with a `java.util.Optional` in Spring
MVC or a single `Publisher` like `Mono`.

Given the following example for Spring MVC:

```
@GetMapping("/user")
public Optional<ResponseEntity<User>> fetchUser() {
	Optional<User> user = //...
	return user.map(ResponseEntity::ok);
}
```

If the resulting `Optional` is empty, Spring MVC will infer a
`ResponseEntity` with an empty body and a 404 HTTP response status.

The same reasoning is applied to Spring WebFlux with Publisher types:

```
@GetMapping("/user")
public Mono<ResponseEntity<User>> fetchUser() {
	Mono<User> user = //...
	return user.map(ResponseEntity::ok);
}
```

This feature is only valid for `HttpEntity` return types and does not
apply to `@ResponseBody` controller handlers.

Issue: SPR-13281
2018-08-15 11:59:16 +02:00
Rossen Stoyanchev 04141dee65 Consistent logging of resolved exceptions
Issue: SPR-17178
2018-08-15 10:57:51 +03:00
Juergen Hoeller 6027cf2255 Polishing 2018-08-14 20:42:40 +02:00
Juergen Hoeller c0c9e08bf9 Revised documentation for PDF, Excel and JSON views
Issue: SPR-17180
Issue: SPR-17182
2018-08-14 20:36:29 +02:00
Juergen Hoeller de38af6843 Upgrade to JUnit Jupiter 5.3 RC1 (and Jetty 9.4.12 RC1)
Includes Groovy 2.5.2, Undertow 2.0.12, Hibernate Validator 6.0.12.

Issue: SPR-17129
2018-08-14 20:33:30 +02:00
Sam Brannen 8126ffbc8c Fix broken links in JavaDoc
Issue: SPR-17174
2018-08-13 12:22:52 +02:00
Sam Brannen 1dcb6236a6 Fix broken links in JavaDoc
First step (as proof of concept) toward addressing SPR-17174.

Issue: SPR-17174
2018-08-13 11:54:05 +02:00
Sam Brannen cfb1ed1009 Clean up warnings and delete dead code 2018-08-12 15:55:11 +02:00
Juergen Hoeller fc16b2d3fb AbstractHandlerMethodMapping allows for customized bean retrieval
Issue: SPR-15535
2018-08-11 01:20:17 +02:00
Juergen Hoeller 58e9706991 Polishing 2018-08-09 02:26:36 +02:00
Juergen Hoeller 7cf98261ce Polishing 2018-08-08 23:56:17 +02:00
Juergen Hoeller 247ec572b2 Consistent hasAnnotation check for findMergedAnnotation lookup
Issue: SPR-16933
2018-08-08 23:54:56 +02:00
Juergen Hoeller fa72186e28 Expose checkbox field marker as 'hidden' to RequestDataValueProcessor
Issue: SPR-17147
2018-08-08 23:52:24 +02:00
Kazuhiro Sera be211ceead Fix typos detected by github.com/client9/misspell 2018-08-08 12:50:46 +02:00
Sebastien Deleuze 7e9b7102b7 Support custom CorsConfigurationSource in AbstractHandlerMapping
This commit allows to specify a custom CorsConfigurationSource
in AbstractHandlerMapping (both Servlet and Reactive variants).

AbstractHandlerMapping#getCorsConfigurations method is now
deprecated.

Issue: SPR-17067
2018-08-08 10:08:55 +02:00
Juergen Hoeller a4c750e94c Upgrade to OpenPDF 1.2 and Apache HttpAsyncClient 4.1.4 2018-08-07 11:24:20 +02:00
Juergen Hoeller 821ab62492 Upgrade to RxJava 2.2 and Kotlin 1.2.60
Includes latest dependency updates (Mockito 2.21, Log4J 2.11.1, Hibernate ORM 5.3.4, Protobuf 3.6.1, JRuby 9.2, HtmlUnit 2.32, Selenium 3.14) for Spring Framework 5.1.

Issue: SPR-16388
Issue: SPR-16239
2018-08-03 23:18:10 +02:00
Juergen Hoeller 2474c48749 Polishing 2018-08-02 16:55:53 +02:00
Rossen Stoyanchev 29ce6685ca Add handleFailure property to FrameworkServlet
Issue: SPR-17100
2018-08-02 00:49:28 +03:00
Juergen Hoeller 9b671f8408 Polishing 2018-07-31 23:57:19 +02:00
Сергей Цыпанов f8340838b3 Use lambda expressions for lazy instantiation (#1911)
Issue: SPR-17074
2018-07-31 13:03:18 +02:00
Juergen Hoeller 487e14d549 Polishing 2018-07-30 23:30:36 +02:00
Sola 9b1eb397ee Fix documentation 2018-07-30 23:26:13 +02:00
Juergen Hoeller f74a631ea1 Nullability refinements in spring-webmvc
Includes revision of web.servlet.tags.form for non-null conventions.

Issue: SPR-15540
2018-07-30 22:08:11 +02:00
Rossen Stoyanchev f5ff1dc3f9 Comment on difference in matrix variable test
Based on discussion under
https://github.com/spring-projects/spring-framework/pull/1901
2018-07-27 08:40:36 -04:00
Rossen Stoyanchev 14d0fee86c Improve context-related logging on web startup
Sample output at TRACE:
```
DispatcherServlet - Initializing Servlet 'org.springframework.web.servlet.DispatcherServlet-7a8c8dcf'
AnnotationConfigWebApplicationContext - Refreshing WebApplicationContext for namespace 'org.springframework.web.servlet.DispatcherServlet-7a8c8dcf-servlet', started on Wed Jul 25 17:46:38 EDT 2018
AnnotationConfigWebApplicationContext - Registering [org.springframework.web.servlet.mvc.method.annotation.RequestPartIntegrationTests$CommonsMultipartResolverTestConfig]
AnnotationConfigWebApplicationContext - No 'messageSource' bean, using [Empty MessageSource]
AnnotationConfigWebApplicationContext - No 'applicationEventMulticaster' bean, using [SimpleApplicationEventMulticaster]
AnnotationConfigWebApplicationContext - No 'lifecycleProcessor' bean, using [DefaultLifecycleProcessor]
...
DispatcherServlet - Initialization completed in 3361 ms
```

Issue: SPR-16946
2018-07-25 17:50:03 -04:00
Juergen Hoeller 2b2bf27933 Polishing 2018-07-25 15:26:52 +02:00
Juergen Hoeller 3881a4aded Polishing 2018-07-25 14:16:02 +02:00
Juergen Hoeller fd8e4abe5d Introduce ResolvableType.toClass() shortcut
Issue: SPR-17086
2018-07-25 14:15:19 +02:00
Sebastien Deleuze d3b244a81b Optimize class detection by sharing the ClassLoader
Issue: SPR-17083
2018-07-25 11:09:42 +02:00
Rossen Stoyanchev 0be8c20fca Consistent logging of selected media types 2018-07-24 20:47:26 -04:00
Rossen Stoyanchev 6372c0f47c Ensure headers work with ResponseEntity + reactive body
Issue: SPR-17076
2018-07-24 00:24:29 -04:00
Sebastien Deleuze b09fad13a1 Catch errors when adding SourceHttpMessageConverter
This commit ignores errors like TransformerFactoryConfigurationError
that can be thrown when instantiating SourceHttpMessageConverter on
platforms where no TransformerFactory implementation is available,
like when compiling/running as GraalVM native images.

Issue: SPR-17007
2018-07-23 10:39:26 +02:00
Juergen Hoeller 9a43d2ec20 Revised log levels: less WARN and INFO, fine-tuned DEBUG vs TRACE
Issue: SPR-16946
2018-07-20 15:05:16 +02:00
Rossen Stoyanchev 07653bfd0c Fix for encoding issue with MvcUriComponentsBuilder
Provide method for stronger encoding of expanded URI variables when
building links from views.

Issue: SPR-17027
2018-07-19 19:07:42 -04:00
Rossen Stoyanchev 93b7a4838e UriComponentsBuilder method to configure URI variables
See Javadoc on UriComponentsBuilder#uriVariables for details.

This helps to prepare for SPR-17027 where the MvcUriComponentsBuilder
already does a partial expand but was forced to build UriComonents
and then create a new UriComponentsBuilder from it to continue. This
change makes it possible to stay with the same builder instance.

Issue: SPR-17027
2018-07-19 19:07:42 -04:00
Juergen Hoeller 867b3d233d Upgrade to OkHttp 3.11, Apache HttpClient 4.5.6, Hibernate Validator 6.0.11 2018-07-19 17:52:08 +02:00
Rossen Stoyanchev 66d73017d5 PathVariable consistently reflects value up to 1st ";"
Given "/{foo}" and "/a=42;c=b", previously that would be treated as a
sequence of matrix vars with an empty path variable. After the change
the path variable "foo" is "a=42".

This should be ok for backawards compatibility since it's unlikely for
anything to rely on an empty path variable.

Issue: SPR-11897
2018-07-18 22:14:02 -04:00
Juergen Hoeller c77dbbb1e6 Specific exception for missing request header, cookie, matrix variable
Issue: SPR-14818
2018-07-18 18:56:51 +02:00
Juergen Hoeller 790d515f8c HandlerMethod exposes interface parameter annotations as well
The HandlerMethodParameter arrangement uses an approach similar to ModelAttributeMethodProcessor's FieldAwareConstructorParameter, merging the local parameter annotations with interface-declared annotations.

Issue: SPR-11055
2018-07-18 17:13:55 +02:00
Sebastien Deleuze 3c9049d530 Leverage Jetty BOM
Issue: SPR-17058
2018-07-18 14:49:49 +02:00
Juergen Hoeller ef9027e1c1 Polishing 2018-07-17 17:59:16 +02:00
Juergen Hoeller b8d2a16c31 UrlBasedViewResolver exposes redirect/forward prefix as bean name
Issue: SPR-17045
2018-07-17 17:58:19 +02:00
Juergen Hoeller 88e4006790 CookieLocaleResolver is RFC6265 and language tag compliant by default
Like CookieLocaleResolver, LocaleChangeInterceptor parses both locale formats by default now. Since it does not need to render the locale, its languageTagCompliant property is not relevant anymore at all.

The parseLocale method in StringUtils validates the locale value now and turns an empty locale into null, compatible with parseLocaleString behavior and in particular aligned with web locale parsing needs.

Issue: SPR-16700
Issue: SPR-16651
2018-07-17 17:57:59 +02:00
Juergen Hoeller 955665b419 Consistent processing of binding/validation failures for data classes
Includes an extension of SmartValidator for candidate value validation, as well as nullability refinements in Validator and BindingResult.

Issue: SPR-16840
Issue: SPR-16841
Issue: SPR-16854
2018-07-17 17:01:34 +02:00
Juergen Hoeller b915e42c38 Resolve target type for GenericHttpMessageConverter.canWrite/write
Issue: SPR-16877
2018-07-16 19:45:35 +02:00
Juergen Hoeller 680afa75d8 ListableBeanFactory.getBeansOfType does not include null bean entries
Issue: SPR-17034
2018-07-14 01:02:39 +02:00
Rossen Stoyanchev 7b3a72f483 Warn when SimpleAsyncTaskExecutor is used
Issue: SPR-16203
2018-07-11 11:10:03 -04:00
Rossen Stoyanchev 1b1bc7f5b5 Switch defaults and model for logging sensitive data
Issue: SPR-17029
2018-07-11 11:10:03 -04:00
Rossen Stoyanchev a40d25a760 Remove no-op classes in web-related Java config 2018-07-11 11:10:03 -04:00
Juergen Hoeller c2fbd9f321 Upgrade to Rome 1.11 and OpenPDF 1.1 2018-07-11 16:48:12 +02:00
Brian Clozel 818e4b0776 Refine Content-Range support for Resources
This commit restricts the support of `"Content-Range"` when returning
`Resource` instances from Controllers - now only "HTTP 200 OK" responses
will be considered, as Controllers might want to handle content range
themselves.

Issue: SPR-16921
2018-07-10 12:11:23 +02:00
Juergen Hoeller 83faee67d5 HttpMessageNotReadableException provides access to HttpInputMessage
Issue: SPR-15588
2018-07-04 22:46:09 +02:00
Juergen Hoeller 641039d85d Polishing 2018-06-29 22:36:08 +02:00
Juergen Hoeller e22466e9d5 Polishing 2018-06-29 19:44:15 +02:00
Juergen Hoeller df6b01a329 Remove deprecated classes and methods from early 5.0.x phase 2018-06-29 19:44:08 +02:00
Juergen Hoeller d34e6f7f70 Polishing 2018-06-28 18:02:07 +02:00
Juergen Hoeller 40efcc933c Polishing 2018-06-28 14:51:33 +02:00
Juergen Hoeller 08e1c8cfaf Fix FreeMarker escaping regression for messages and separators
Issue: SPR-16951
2018-06-28 14:15:16 +02:00
Phillip Webb a89e716cc7 Use tabs rather than spaces in tests
Update tests to ensure that tabs are used instead of spaces. Also
consistently apply a new line at the end of each file.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 1c25cec44f Polish test code
Polish a few issue identified when adding checkstyle to the
build. Although checkstyle is not enforcing rules on tests,
these are a few minor changes that are still worth making.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 81451aa800 Organize imports
Reorganize imports to ensure consistent ordering. This commit also
expands any `.*` static imports in favor of using fully-qualified
method references.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 5cedd0d5d4 Consistently use tabs rather than spaces
Update code that has accidentally used spaces instead of tabs.
Also remove all trailing whitespace.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 9de3689f63 Never use 'this.' when accessing loggers
Ensure that `this.` is never used when accessing loggers.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 0b53c1096a Always use 'this.' when accessing fields
Ensure that `this.` is used consistently when accessing class
fields.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb eeebd51f57 Use consistent class design
Update all classes so that inner classes are always last. Also
ensure that utility classes are always final and have a private
constructor and make exceptions final whenever possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb 04a8c285df Fix annotation styling issues
Update all annotations so that each is on its own line and
consistently use the short form (i.e. don't use `value=`) when
possible.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb e9d1b39aff Apply consistent copyright header
Add copyright header to `package-info.java` files and fix a few
malformed headers on existing java files.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb c3a17dfd47 Ensure all files end with a newline
Update all files to ensure that they always end with a new line.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Phillip Webb e0480f75ac Fix javadoc checkstyle issues
Fix checkstyle violations for javadoc.

Issue: SPR-16968
2018-06-28 10:28:44 +02:00
Rossen Stoyanchev 7ccd2b024d Refine logging for async requests
Issue: SPR-16898
2018-06-25 14:42:29 -03:00
Rossen Stoyanchev 900bc8a2e3 Logging improvements for WebFlux
Issue: SPR-16898
2018-06-22 22:44:24 -04:00
Rossen Stoyanchev 69d8f9d3ab Option to disable logging request details
Issue: SPR-16898
2018-06-19 16:53:37 -04:00
Rossen Stoyanchev 28a5c3009e Improve DEBUG/TRACE logging for Spring MVC
Issue: SPR-16898
2018-06-18 18:33:11 -04:00
Rossen Stoyanchev 58cce615f5 MvcUriComponentsBuilder is aware of path prefixes
Issue: SPR-16336
2018-06-14 22:11:53 -04:00
Rossen Stoyanchev e6fef9555d Check all HandlerMapping beans for named mappings
Related to (but not required by) SPR-16336.
2018-06-14 22:07:06 -04:00
Rossen Stoyanchev dad9ed83b7 Polish MvcUriComponentsBuilder 2018-06-14 22:07:06 -04:00
Juergen Hoeller 9c36b53833 Upgrade to JAXB 2.3.0.1, Aalto XML 1.1, Rome 1.10 2018-06-11 22:01:51 +02:00
Brian Clozel 417354da8a Remove dependency management noise from POMs
Prior to this commit, the generated POMs for Spring Framework modules
would contain unneeded/harmful information from the Spring Framework
build:

1. The BOM imports applied to each module by the dependency
management plugin, for example for Netty or Reactor Netty.
Spring should not export that opinion to its POMs.

2. The exclusion of "org.slf4:jcl-over-slf4j" from *all* dependencies,
which made the POMs much larger than necessary and suggested to
developers that they should exclude it as well when using all those
listed dependencies. In fact, only Apache Tiles currently brings that
transitively.

This commit removes that information from the POMs.
The dependencyManagement Gradle plugin is disabled for POM generation
and we manually resolve the dependency versions during the generation
phase.
The Gradle build is streamlined to exclude "org.slf4:jcl-over-slf4j"
only when necessary.

Issue: SPR-16893
2018-06-11 15:57:54 +02:00
Rossen Stoyanchev 86c861516d Accept Predicate instead of HandlerTypePredicate
Issue: SPR-16336
2018-06-08 15:32:07 -04:00
Sebastien Deleuze ac37b678a3 Remove JSONP support
CORS is now widely supported and should be used instead for cross-domain
requests.

Issue: SPR-16914
2018-06-08 12:15:48 +02:00
Rossen Stoyanchev 19dc981685 Path prefixes for groups of controllers
Issue: SPR-16336
2018-06-07 18:18:42 -04:00
Rossen Stoyanchev 3acb96efd0 CachingResourceResolver varies by known codings only
Issue: SPR-16381
2018-06-04 23:30:35 -04:00
Juergen Hoeller 356bfe6e2e Upgrade to Joda-Time 2.10 2018-05-31 23:35:15 +02:00
Juergen Hoeller f3e860e8f1 Resource handler tests expect status 404 for directory in jar file
Issue: SPR-16832
2018-05-30 00:31:35 +02:00
Juergen Hoeller 69f14a2038 ClassPathResource.isReadable() checks InputStream (for jar directories)
Resource.isReadable() is defined to semantically imply exists() now.

Issue: SPR-16832
2018-05-29 21:47:33 +02:00
Juergen Hoeller 8593fec22c Avoid ConstantConditions warnings suppression (plus related polishing)
Issue: SPR-15756
2018-05-29 21:47:10 +02:00
Juergen Hoeller 836a09d5c0 Upgrade to Woodstox 5.1, XMLUnit 2.6, Gson 2.8.5 2018-05-25 00:18:06 +02:00
Rossen Stoyanchev 85e8634810 Properly initialize URI/Matrix vars w/ urlDecode=false
Issue: SPR-16867
2018-05-24 15:08:39 -04:00
Rossen Stoyanchev b472d192f4 Improve support for caching encoded resources
The key in CachingResourceResolver now includes the "Accept-Encoding"
request header cleaned to exclude "*", "identity", and parameters, and
also sorted alphabetically.

For encoded resources the response now includes a response header with
"Vary: Accept-Encoding".

Issue: SPR-16381
2018-05-23 09:17:21 -04:00
Rossen Stoyanchev 9274de390a Polish resource handling tests 2018-05-23 09:17:21 -04:00
Rossen Stoyanchev f121aa5e31 Immutable Resource[Resolver|Transformer]Chains
Issue: SPR-16862
2018-05-23 09:17:21 -04:00
Rossen Stoyanchev 5207672b3f Configurable support for static resource encodings
The new EncodedResourceResolver is a generalized version of
GzipResourceResolver that can be configured to support different
content codings, by "br" and "gzip".

GzipResourceResolver is now deprecated.

Issue: SPR-16381
2018-05-23 09:17:21 -04:00
Juergen Hoeller 285eb94a03 Upgrade to Hibernate Validator 6.0.10 2018-05-18 22:22:12 +02:00
Rossen Stoyanchev 395792b302 Produces media types cleared prior to error handling
Issue: SPR-16318
2018-05-14 23:16:36 -04:00
Rossen Stoyanchev 6cf6d8834c List OPTIONS in OPTIONS responses for @RequestMapping
Issue: SPR-16513
2018-05-14 09:05:03 -04:00
Rossen Stoyanchev 4da43de7e1 Remove individual detection of forwarded headers
This commit removes all places where forwarded headers are checked
implicitly, on an ad-hoc basis.

ForwardedHeaderFilter is expected to be used instead providing
centralized control over using or discarding such headers.

Issue: SPR-16668
2018-05-11 09:31:39 -04:00
Rossen Stoyanchev 1aadf2c3a6 Refine compareTo for param and header conditions
Issue: SPR-16674
2018-05-08 18:12:51 -04:00
Juergen Hoeller c238fb441b Polishing
(cherry picked from commit 2da02cc)
2018-05-08 00:58:58 +02:00
Juergen Hoeller a200df6c8d Explicit coverage of root vs cause exception matching in MVC ref docs
Issue: SPR-16743
2018-05-07 22:30:26 +02:00
Juergen Hoeller 53aa9cc4cd Upgrade to Servlet API 4.0.1 (aligned with Tomcat 9 and Undertow 2)
Issue: SPR-16470
2018-05-07 14:17:28 +02:00
nkjackzhang 321d7b0b06 Put CacheControl.empty() in else part.
Make sure the constructor of `CacheControl` being invoked only once.
2018-05-07 13:13:44 +02:00
Juergen Hoeller d0bd57b100 Polishing
(cherry picked from commit 0795ae5)
2018-05-05 17:04:24 +02:00
Juergen Hoeller c9f488363d Fine-tuned assertions and related polishing 2018-05-05 14:39:43 +02:00
Juergen Hoeller 7b894fe73b ResponseEntityExceptionHandler rethrows unknown exception (for further processing in DispatcherServlet's HandlerExceptionResolver chain)
Issue: SPR-16743
2018-05-05 12:46:58 +02:00
Johnny Lim fb898e1727 Remove inconsistent spaces 2018-05-05 11:07:35 +02:00
Johnny Lim 6519e7b22a Polish 2018-04-27 14:06:48 -04:00
Rossen Stoyanchev de18d96413 Validate contextPath in RedirectView
Issue: SPR-16752
2018-04-23 15:26:18 -04:00
Brian Clozel e9a8a5065b Disable HTTP Range support for InputStreamResource
Prior to this commit, the `AbstractMessageConverterMethodProcessor`
would fail to convert `InputStreamResource` to `ResourceRegion` as
expected, since the content length cannot be read without consuming the
stream. This is enforced by the `HttpRange` class.

Now the method processor would still try to output HTTP range response
headers to provide range support information. This step is using the
resource content length and reads the input stream, leading to
exceptions such as "IllegalStateException: InputStream has already been
read".

This commit improves the return type detection and excludes early
`InputStreamResource` return types. With those types, HTTP range support
is now completely disabled.

Issue: SPR-16754
2018-04-23 18:39:05 +02:00
sdeleuze 1d6540b1c2 Enable KotlinScriptTemplateTests after KT-18833 fix 2018-04-23 14:49:22 +02:00
Juergen Hoeller 0754833b37 Local XMLUnit dependency declarations with consistent version 2.5.1 2018-04-14 21:03:20 +02:00
Juergen Hoeller 7ee6130680 Revised reference example for linkable controller method signature
Issue: SPR-16710
2018-04-12 14:45:11 +02:00
Juergen Hoeller f28a5d0cf7 Proper exception for controller method return types that do not work with MvcUriComponentsBuilder (e.g. final classes)
Includes direct use of ControllerMethodInvocationInterceptor for return type Object, avoiding the attempt to generate an Object subclass.

Issue: SPR-16710
2018-04-11 16:05:54 +02:00
Sam Brannen aba882af4c Clean up warnings in spring-webmvc 2018-04-04 14:04:54 +02:00
Sam Brannen 2c648379ab Delete dead code in spring-webmvc 2018-04-04 14:01:24 +02:00
Juergen Hoeller aa0face9a1 Upgrade to RxJava 1.3.8 and Rhino 1.7.9 2018-04-03 15:18:25 +02:00
Juergen Hoeller 8a9321652d Refined javadoc 2018-03-31 23:07:08 +02:00
Juergen Hoeller 912c270f2b Polishing 2018-03-31 17:49:21 +02:00
Juergen Hoeller 6393e5ce0c Consistent Ordered.LOWEST_PRECEDENCE declarations for default order 2018-03-31 00:20:44 +02:00
Rossen Stoyanchev b1048975d2 Minor updates based on PR#1058
The original repo no longer exists:
https://github.com/spring-projects/spring-framework/pull/1058
2018-03-30 13:36:20 -04:00
Rossen Stoyanchev 240d6f52c9 Replaces rather than prepend contextPath
Issue: SPR-16650
2018-03-29 18:17:29 -04:00
Rossen Stoyanchev dd96c873e3 Improve docs on forwarded headers
Issue: SPR-16660
2018-03-29 16:11:01 -04:00
Juergen Hoeller b165475eb6 Polishing 2018-03-29 16:05:52 +02:00
Juergen Hoeller 695bf2961f Consistent trace logging in PathResourceResolver
Issue: SPR-16616
2018-03-29 16:04:33 +02:00
igor-suhorukov e6020ed377 avoid unnecessary autoboxing 2018-03-28 23:48:12 +02:00
igor-suhorukov 4aae6a6dda Use Map.forEach instead of manual Map.Entry iteration wherever possible SPR-16646 2018-03-28 01:09:03 +02:00
Rossen Stoyanchev f3994467c4 Refine ContentNegotiationStrategy contract
Consistently return "*/*" if no media types were requested rather than
an empty list. Existing code has to check for both in any case to see
if nothing was requested.

Issue: SPR-16624
2018-03-27 16:54:19 -04:00
Juergen Hoeller 9a27bc9b3e Upgrade to Jackson 2.9.5 and Hibernate Validator 6.0.9 2018-03-27 17:33:34 +02:00
Juergen Hoeller 98ad23bef8 Consistent logging of encoded path evaluation failure
Issue: SPR-16616
2018-03-27 17:04:59 +02:00
Juergen Hoeller e3d0ef6015 Use Map.forEach instead of manual Map.Entry iteration wherever possible
Issue: SPR-16646
2018-03-27 00:38:32 +02:00
Juergen Hoeller f59ea610df Simplified separator check within isInvalidEncodedPath
Issue: SPR-16616
2018-03-27 00:23:36 +02:00
Juergen Hoeller c1405ef140 Polishing 2018-03-21 16:12:42 +01:00
Juergen Hoeller 91b803a231 Consistent encoded path evaluation in ResourceHttpRequestHandler and co
Issue: SPR-16616
2018-03-21 12:02:13 +01:00
Rossen Stoyanchev 0e28bee0f1 Clean duplicate separators in resource URLs
Most Servlet containers do this anyway, but not all, and not
consistently for forward and backslashes.

Issue: SPR-16616
2018-03-19 17:16:03 -04:00
Juergen Hoeller f8588e364a AcceptHeaderLocaleResolver keeps language match among supported locales
Issue: SPR-16599
2018-03-16 14:17:50 +01:00
Juergen Hoeller 2096676b3f Upgrade to Apache Johnzon 1.1.7 and JRuby 9.1.16 2018-03-15 15:43:45 +01:00
Juergen Hoeller 58011f71e9 Consistent assertions for template method result vs servlet registration 2018-03-14 18:55:50 +01:00
Juergen Hoeller 2a3f90dc7b Upgrade to Hibernate ORM 5.2.15 and Hibernate Validator 6.0.8 2018-03-09 09:40:12 +01:00
Brian Clozel ed7684d2b2 Don't implicitly check preconditions on PUT requests
Prior to this commit, the `HttpEntityMethodProcessor` would check HTTP
conditions on non-safe requests (i.e. not GET/HEAD). This would prevent
Controllers from returning `ResponseEntity` containing response headers
with updated values of `"Last-Modified"` or `ETag` once the resource has
been updated.

This commit avoids those checks for non GET/HEAD requests - this code
can still be leveraged from Controllers themselves using
`ServletWebRequest::checkNotModified` methods.

Issue: SPR-15780
2018-03-08 19:43:01 +01:00
Juergen Hoeller 139dc1d373 Polishing (collapsed if checks, consistent downcasts, refined javadoc) 2018-03-08 18:11:57 +01:00
igor-suhorukov 0f7485b01d Polish: reorder the modifiers to comply with the Java Language Specification. 2018-03-08 17:57:47 +01:00
Rossen Stoyanchev 568c93457a Improve ResponseBodyEmitter error handling
After send error, ignore calls to complete or completeWithError by the
application in the same thread (e.g. try-catch block), to avoid a
competing with an error callback from servlet container during which
the same action is taken.

Issue: SPR-16548
2018-03-07 15:25:31 -05:00
Rossen Stoyanchev e20652009d Improve docs on SseEmitter onComplete/onError
Issue: SPR-16548
2018-03-07 14:59:18 -05:00
Juergen Hoeller 934a995acb Strong recommendation for OpenPDF 1.0.5 instead of iText 2.1.7
Issue: SPR-16107

(cherry picked from commit b70d400)
2018-03-07 17:08:45 +01:00
Juergen Hoeller f57fcdee3c Polishing 2018-03-07 15:49:58 +01:00
Patrick0308 6f4d25a6e6 Polish "Use Java 8 forEach method on Map" 2018-03-07 15:39:58 +01:00
Brian Clozel 6d26e61ac7 Guard against invalid paths in ResourceUrlProvider
This commit makes sure that no `StringIndexOutOfBoundsException` is
thrown when `getForRequestUrl` is called with a URL that's shorter than
the expected context path.

Issue: SPR-16526
2018-03-05 15:26:56 +01:00
Juergen Hoeller cd4f0935c5 Revised deprecation markers 2018-03-01 23:43:06 +01:00
Rossen Stoyanchev 36cfdf68b1 Correct log level
Issue: SPR-16528
2018-03-01 15:52:59 -05:00
Juergen Hoeller bfddbbe731 Polishing 2018-03-01 01:39:06 +01:00
igor-suhorukov 83300c4b27 Polish: follow naming convention 2018-03-01 00:22:29 +01:00
igor-suhorukov 8080f56db8 Polish: "@Override" should be used on overriding and implementing methods 2018-03-01 00:15:18 +01:00
igor-suhorukov d1ccecd021 Polish: to get rid unnecessary array creation 2018-02-27 23:37:54 +01:00
igor-suhorukov 7bce04c06c Polish: combine catches block with same body 2018-02-27 12:51:28 +01:00
igor-suhorukov 49fd724d8f Polish: String function use should be optimized for single characters 2018-02-25 20:48:47 +01:00
Juergen Hoeller a5cbf5fe24 Consistent use of Collection.toArray with zero-sized array argument
Includes consistent use of ClassUtils.toClassArray (as non-null variant)

Issue: SPR-16523
2018-02-22 11:29:46 +01:00
Juergen Hoeller 0de36d2883 Consistent HttpMethod identity comparisons 2018-02-18 22:01:22 +01:00
Juergen Hoeller d7cab23e6d Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
2018-02-16 20:49:17 +01:00
Juergen Hoeller 8d3264f680 Prefer List.sort(Comparator) over Collections.sort(List, Comparator) 2018-02-16 10:23:18 +01:00
igor-suhorukov 2be4985b8f Polish: anonymous inner classes containing only one method should become lambdas,
use getOrDefault instead of ternary operator
2018-02-16 09:38:19 +01:00
Rossen Stoyanchev 9801afb85d Fix compile error
Update places that call UriUtils to catch the right exception that is
now raised as a result of using Charet.forName.
2018-02-15 15:59:21 -05:00
Juergen Hoeller cd8a1bdb8b AcceptHeaderLocaleContextResolver leniently handles invalid header value
Also falls back to language-only match among its supported locales now.

Issue: SPR-16500
Issue: SPR-16457
2018-02-15 13:14:49 +01:00
Juergen Hoeller 6d7573262e FormTag skips rendering of hidden fields in case of empty Map
Issue: SPR-16498
2018-02-14 17:41:45 +01:00
Juergen Hoeller 3b810f3544 Consistent Class array vs vararg declarations (and related polishing) 2018-02-14 14:44:00 +01:00
Juergen Hoeller 46cbdff5c3 Consistent ControllerAdvice applicability against user-declared class
Issue: SPR-16496
2018-02-14 14:41:16 +01:00
igor-suhorukov 711b0f50f2 Polish: replace the synchronized class "Stack" by an unsynchronized one such as "Deque". 2018-02-11 21:15:46 +01:00
igor-suhorukov 0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
Stephane Nicoll 991eb4858e Update copyright header 2018-02-09 10:16:58 +01:00
igor-suhorukov e381514b07 Collection.isEmpty() should be used to test for emptiness
Closes gh-1670
2018-02-09 10:11:44 +01:00
igor-suhorukov 4c888d0f32 Polish
Closes gh-1669
2018-02-09 10:10:05 +01:00
Juergen Hoeller 4dc964544f AcceptHeaderLocaleResolver falls back to language-only match among its supported locales
Issue: SPR-16457
2018-02-02 12:41:59 +01:00
Juergen Hoeller 7f96827ade Polishing 2018-02-02 11:34:03 +01:00
Juergen Hoeller 4a1cc9ced7 Constructor-provided field values get recorded for failed binding result
Also, TypeMismatchExceptions get registered via BindingErrorProcessor.

Issue: SPR-16449
2018-02-02 11:33:56 +01:00
Rossen Stoyanchev 0ded239453 [doc] Update Spring MVC exception handling content
Issue: SPR-16394
2018-01-31 23:03:10 -05:00
sdeleuze b6c78452b2 Update and improve script templating documentation
Issue: SPR-16447
2018-01-31 17:57:41 +01:00
Juergen Hoeller 8d42888476 Upgrade to RxJava 1.3.5 and WebJars Locator 0.35
Includes Rhino 1.7.8 and JRuby 9.1.15 as well.
2018-01-29 21:31:27 +01:00
Rossen Stoyanchev 97894a1c22 Improve logging dependencies for tests 2018-01-23 10:42:41 -05:00
Juergen Hoeller 91e6274b7d Upgrade to Apache HttpClient 4.5.5 and Tomcat 8.5.27 2018-01-22 22:11:00 +01:00
Juergen Hoeller 61579ffe7b Polishing 2018-01-22 21:34:44 +01:00
Juergen Hoeller 9d0e62ef68 Javadoc format and related polishing 2018-01-22 11:43:21 +01:00
Johnny Lim 36d42bcda4 Polish InterceptorRegistration
Closes gh-1647
2018-01-20 10:15:12 +01:00
Juergen Hoeller ea5f8f5a7c Consistently handle NoClassDefFoundError in BeanUtils and related places
Issue: SPR-16369
2018-01-17 20:24:57 +01:00
Juergen Hoeller 121f9e3734 BridgeMethodResolver properly resolves all declared interfaces
Issue: SPR-16288
2018-01-11 10:18:27 +01:00
Rossen Stoyanchev ea73ec5c41 ResourceUrlProvider handles sanitizes double slashes
Issue: SPR-16296
2018-01-10 17:48:43 -05:00
Rossen Stoyanchev 846636f2b9 Polish 2018-01-08 17:35:30 -05:00
Aleksey Voronenkov cb8ad46564 Overloaded methods in InterceptorRegistration
Issue: SPR-16324
2018-01-08 17:31:06 -05:00
Rossen Stoyanchev 446e7ed25c Links from @RequestMapping to reference docs
Issue: SPR-16266
2018-01-08 09:29:52 -05:00
Juergen Hoeller 7a55d932f9 Build against OpenPDF 1.0.5 instead of outdated iText 2.1.7
Issue: SPR-16352
2018-01-08 00:26:10 +01:00
Juergen Hoeller 9d27e86951 Upgrade to Hibernate Validator 6.0.7 2017-12-21 17:00:06 +01:00
Juergen Hoeller 3a51b5a9d2 Upgrade to Hibernate Validator 6.0.6 2017-12-15 15:58:12 +01:00
Rossen Stoyanchev fda08852ba Take content-type from ResponseEntity unconditionally
From #9a894a we began using the content-type from the ResponseEntity
but cross-checking it still against the requested content type.

Arguably there isn't any purpose in cross-checking. The only possible
outcomes are: a) it's compatible or b) it's not, which would result in
406 (NOT_ACCEPTABLE). As we've been given explicitly the media type to
use, it makes little sense to send 406, ignoring the wish to use that
content type.

Issue: SPR-16251
2017-12-02 00:43:43 -05:00
Rossen Stoyanchev 3650ecc3bb Polish 2017-11-28 22:16:07 -05:00
Juergen Hoeller a8323f6a27 Latest dependency updates (OkHttp 3.9.1, JRuby 9.1.14, Rome 1.9) 2017-11-26 16:03:48 +01:00
sdeleuze 652e5c5584 Disable CORS credentials by default
Access-Control-Allow-Credentials CORS header, used to
allow cookies with CORS requests, is not set to true
anymore by default when enabling CORS with
@CrossOrigin or global CORS configuration in order to
provide a more secured default CORS configuration.

The related allowCredentials property now requires to
be set to true explicitly in order to support cookies
with CORS requests.

Issue: SPR-16130
2017-11-22 22:46:44 +01:00
Juergen Hoeller 0cc644f61f Polishing 2017-11-21 16:34:08 +01:00
Rossen Stoyanchev bc8e525e60 Add shared instance of ReactiveAdapterRegistry
Issue: SPR-16218
2017-11-20 17:02:22 -05:00
Juergen Hoeller 40dacd3c1c Polishing 2017-11-20 22:27:07 +01:00
Juergen Hoeller 27bbb73583 Expose all HttpResource header values (even if commonly not multi-value)
Issue: SPR-14264
2017-11-20 15:31:34 +01:00
Juergen Hoeller 20fcefc647 ResourceHttpRequestHandler uses EmbeddedValueResolverAware 2017-11-19 21:16:29 +01:00
Juergen Hoeller 14a7da8183 Upgrade to Hibernate Validator 6.0.5 2017-11-19 21:16:10 +01:00
Rossen Stoyanchev b1b5353b7f Revise charset by location support for static resources 2017-11-17 12:33:58 -05:00
Juergen Hoeller cc7c90cca5 Polishing 2017-11-16 10:52:56 +01:00
Juergen Hoeller 7af9910244 Restored support for placeholders in mvc namespace resource locations
With the recent charset mechanism in place, we cannot rely on implicit placeholder parsing during String-to-Resource conversion anymore.
2017-11-16 09:36:23 +01:00
Juergen Hoeller 7697b398d5 Polishing 2017-11-14 17:11:16 +01:00
Juergen Hoeller b5cedd43eb Consistent and efficient access to BeanDefinition argument values
Issue: SPR-16192
2017-11-13 21:51:11 +01:00
Juergen Hoeller 72f20e8d4f Polishing 2017-11-11 00:37:50 +01:00
Rossen Stoyanchev 9a894ab61e Use ResponseEntity Content-Type as producible media type
Issue: SPR-16172
2017-11-10 15:05:03 -05:00
Juergen Hoeller 780993ce75 Polishing 2017-11-10 20:21:26 +01:00