Commit Graph

13910 Commits

Author SHA1 Message Date
Juergen Hoeller
08c2fd4e7c Upgrade to Groovy 2.4.8 and Mockito 2.6.1 2017-01-13 10:23:38 +01:00
Juergen Hoeller
7c05b427a7 MimeTypeUtils constants cleanup: removed web media types
Issue: SPR-15137
2017-01-12 23:30:57 +01:00
Juergen Hoeller
743ce2cda6 Polishing 2017-01-12 23:30:38 +01:00
Juergen Hoeller
e19dff179e Polishing 2017-01-12 21:18:01 +01:00
Juergen Hoeller
02d727fd7c MockHttpServletRequestBuilder supports multiple locales
Includes revised content type handling.

Issue: SPR-15116
2017-01-12 21:17:54 +01:00
Juergen Hoeller
d0e93284f3 SpringValidatorAdapter properly handles HV-5-style list constraint violations
Issue: SPR-15082
2017-01-12 21:16:56 +01:00
Juergen Hoeller
b06423a5f8 AbstractMessageSource does not attempt to format code-as-default-message
Issue: SPR-15123
2017-01-12 21:16:48 +01:00
Juergen Hoeller
8084da59a7 Map resolution for multiple beans applies to plain Map interface declaration only
Issue: SPR-15117
2017-01-12 21:15:41 +01:00
Juergen Hoeller
9e6aa0ff59 BeanDefinitionBuilder supports factory method on factory bean
Issue: SPR-15098
2017-01-12 21:15:22 +01:00
Juergen Hoeller
de4349792b GenericTableMetaDataProvider falls back to single schema as default
Issue: SPR-15090
2017-01-12 21:15:08 +01:00
Juergen Hoeller
50e5a65b2d LinkedCaseInsensitiveMap provides case-insensitive keySet again
Issue: SPR-15026
2017-01-12 21:14:07 +01:00
Juergen Hoeller
60882ceb4e Merge pull request #1286 from trisberg/SPR-15107
SPR-15107 Updating MySQLMaxValueIncrementer to not rely on MYISAM
2017-01-12 20:25:04 +01:00
Juergen Hoeller
0403fe340d Merge pull request #1287 from markhobson/SPR-15109
Introduce mime/media types for application/rss+xml
2017-01-12 20:24:27 +01:00
Juergen Hoeller
31f7860a40 Merge pull request #1285 from dreis2211/SPR-15094
Improve performance of StringUtils.capitalize()
2017-01-12 20:22:26 +01:00
Arjen Poutsma
d724644588 Expose WebSession on ServerRequest
This commit exposes the WebSession on ServerRequest.
2017-01-12 11:37:48 +01:00
Thomas Risberg
5c7aee7d38 Updating MySQLMaxValueIncrementer to not rely on MYISAM
We should no longer rely on MYISAM for the sequence table since this
engine might not always be available. After this change the storage
engine used by the sequence table can be MYISAM or INNODB since the
sequences are allocated using a new connection without being
affected by any other transactions that might be in progress.

To allow users to fall back on the original functionality of using
MYISAM tables for the incrementer, we add a `useNewConnection` flag to
indicate whether or not to use a new connection for the incrementer.
This flag defaults to true.

Issue: SPR-15107
2017-01-11 17:24:41 -05:00
Sebastien Deleuze
b7471e7fca Add a Kotlin Web functional DSL
This commit introduces a router DSL for RouterFunctions
and RouterFunction in order to be able to write idiomatic
Kotlin code as below:

fun route(request: ServerRequest) = RouterFunctionDsl {
    accept(TEXT_HTML).apply {
            (GET("/user/") or GET("/users/")) { findAllView() }
            GET("/user/{login}") { findViewById() }
    }
    accept(APPLICATION_JSON).apply {
            (GET("/api/user/") or GET("/api/users/")) { findAll() }
            POST("/api/user/") { create() }
            POST("/api/user/{login}") { findOne() }
    }
 } (request)

Issue: SPR-15065
2017-01-11 14:54:31 +01:00
Sebastien Deleuze
b04b41b93b Add bodyToMono/Flux<Foo>() Kotlin extensions
Issue: SPR-15128
2017-01-11 08:59:10 +01:00
Sebastien Deleuze
0a988fd2b1 Remove object wrappers in Kotlin extensions
This commit also improve significantly Kotlin extensions
documentation.

Issue: SPR-15127
2017-01-11 08:52:01 +01:00
Sebastien Deleuze
4f1fe74912 Polish ListableBeanFactoryExtension 2017-01-11 07:57:02 +01:00
Sebastien Deleuze
8f14e29067 Support AnnotationConfigApplicationContext{} in Kotlin
Issue: SPR-15126
2017-01-10 22:47:33 +01:00
Sebastien Deleuze
f8461d856a Support Gradle-style Kotlin bean API
val context = GenericApplicationContext {
    registerBean<Foo>()
    registerBean { Bar(it.getBean<Foo>()) }
}

Issue: SPR-15126
2017-01-10 21:43:27 +01:00
Mario Arias
1af905ca0a Add Model and ModelMap Kotlin extensions
Issue: SPR-15119
2017-01-10 14:22:54 +01:00
Sebastien Deleuze
6ee5e2a817 Polishing
Issue: SPR-15118
2017-01-10 10:54:24 +01:00
Sebastien Deleuze
c5cfd8c8fc Make the Kotlin bean registration API even more idiomatic
Put the lambda parameter at the end and use a function
instead of a supplier to be able to register beans like this:

val context = GenericApplicationContext()
context.registerBean(Foo::class)
context.registerBean{ Bar(it.getBean(Foo::class)) }

Issue: SPR-15118
2017-01-10 10:38:24 +01:00
Sebastien Deleuze
715274e327 Avoid the need to specify Supplier in Kotlin bean registration API
Based on an idea from Mario Arias, we can avoid requiring specifying
explicitly Supplier lambda type in Kotlin API by declaring the supplier
parameter as "crossinline supplier: () -> T" instead of
"supplier: Supplier<T>".

Issue: SPR-15118
2017-01-09 20:22:30 +01:00
Sebastien Deleuze
b503e4679c Add reactive ScriptTemplateView
For now if sharedEngine is set to false, a new
ScriptEngine instance is created for each request.

Issue: SPR-15063
2017-01-09 19:47:07 +01:00
Juergen Hoeller
74fa088c7e Latest dependency updates (HtmlUnit 2.24, Joda-Time 2.9.7, RxJava 1.2.5 & 2.0.4) 2017-01-09 19:19:27 +01:00
Sebastien Deleuze
aa43472f2e Fix error handling in Jackson2JsonDecoder
Issue: SPR-15112
2017-01-09 14:51:16 +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
e4a599f961 Ensure that JUnit Jupiter tests are executed during build
After the upgrade to JUnit Jupiter 5.0 M3, JUnit Jupiter tests in the
Spring build were no longer executed due to the introduction of a
default test class name pattern.

This commit addresses this issue by making use of the
@IncludeClassNamePatterns to specify that *TestCase test classes should
be executed within the org.springframework.test.context.junit.jupiter
package.
2017-01-07 02:24:46 +01:00
Sam Brannen
08cc92176a Enable compilation on Eclipse 4.6 2017-01-07 02:15:02 +01:00
Sam Brannen
9ed66bf2eb Clean up warnings across code base 2017-01-07 01:54:38 +01:00
Sam Brannen
055da43e30 Clean up warnings in spring-test 2017-01-07 00:57:17 +01:00
Brian Clozel
87f498195c Fix RequestUpgradeStrategy impl. class loading
Issue: SPR-15106
2017-01-06 23:19:51 +01:00
Brian Clozel
afd93a0b52 Disable streaming when reading to Resources in RestTemplate
Prior to this commit, the `ResourceHttpMessageConverter` would support
converting from an `HttpInputMessage` to a `InputStreamResource`. This
is valid when reading resources on the server side, but it's not
compatible with the way `RestTemplate` works.

The API exposed by `RestOperations` imply that the HTTP server response
should be fully consumed and properly closed by the time the `exchange`
method returns. In other words, this HTTP client does not support
streaming the HTTP response.

This commit allows the `ResourceHttpMessageConverter` to be configured
to disable read streaming when used in `RestTemplate`.

Issue: SPR-14882
2017-01-05 14:48:35 +01:00
Stephane Nicoll
848a2b2ef8 Merge pull request #1284 from garyrussell:SPR-15091
* pr/1284:
  Implement MessagingException.toString()
2017-01-05 10:25:31 +01:00
Gary Russell
80bc8fc596 Implement MessagingException.toString()
Issue: SPR-15091
Closes gh-1284
2017-01-05 10:25:04 +01:00
Christoph Dreis
83929b2b98 Improve performance of StringUtils.capitalize()
Issue: SPR-15094
2017-01-04 19:23:08 +01:00
Stephane Nicoll
9e0a08753d Merge pull request #1281 from marschall:SPR-15076
* pr/1281:
  Remove use of Boolean constructors
2017-01-04 09:31:49 +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
Stephane Nicoll
4cd9710a0d Merge pull request #1282 from marschall:SPR-15077
* pr/1282:
  Avoid use of double constructor of BigDecimal
2017-01-04 09:30:55 +01:00
Philippe Marschall
3f97ab183e Avoid use of double constructor of BigDecimal
Codacy warns about an Error Prone [1] use of the double constructor of
BigDecimal in tests. The reason given is that it is a source of
precision loss if the number does not have an exact double
representation. The recommendation is to use the String constructor of
BigDecimal instead as it does not require using a lossy argument.

This commit contains the following changes:

 - replace usage of the double constructor of BigDecimal with the
   String constructor of BigDecimal in JdbcTemplateQueryTests
 - update the copyright year

 [1] http://errorprone.info/bugpattern/BigDecimalLiteralDouble

Issue: SPR-15077
2017-01-04 09:29:48 +01:00
Rob Winch
df98d304fd Fix ForwardedHeaderFilter with non-empty contextPath
Issue: SPR-15088
2017-01-03 14:51:31 -06: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
Stephane Nicoll
d912f77a31 Merge pull request #1280 from marschall:SPR-15075
* pr/1280:
  Remove String#toCharArray from ScriptUtils
2017-01-03 18:02:10 +01:00
Philippe Marschall
35bd00beaf Remove String#toCharArray from ScriptUtils
ScriptUtils contains two calls to String#toCharArray for the sole
purpose to iterating over all chars in a String. Not only is this
unnecessary and can be replaced with String#charAt it also causes
additional allocator and heap pressure because String#toCharArray
rather than returning the backing array (which is gone in Java 9)
creates a copy.

This commit contains the following changes:

 - remove String#toCharArray from ScriptUtils and replace with
   String#charAt

Issue: SPR-15075
2017-01-03 17:57:22 +01:00
Brian Clozel
1ab0916bed Fix default content-type for ResourceRegion HTTP responses
Prior to this commit, the `ResourceRegionHttpMessageConverter` would
rely on the default implementation of `getDefaultContentType` to guess
the default Content-Type of the resource region to be written to the
HTTP response. That implementation fetches the first media type
provided in the HTTP request "Accept" header.

This behavior is not correct when converting resources and this commits
aligns this converter with the `ResourceHttpMessageConverter` which uses
JAF to guess the correct Content-Type of the given resource, or just
returns "application/octet-stream" as a default value.

Issue: SPR-15041
2017-01-02 22:04:20 +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
Sebastien Deleuze
ef4340063e Upgrade to Kotlin 1.1-M04
Needed for Kotlin script and JSR 223 support, and a good target
for Spring Framework 5.0 since it will allow features like generating
Java 8 bytecode, JDK 9 support, annotation array attribute single
value without arrayOf(), etc.

We ensure Kotlin 1.0 compatibility by setting apiVersion and
languageVersion compiler options to 1.0.

Issue: SPR-15059
2017-01-01 13:48:08 +01:00