Commit Graph

14848 Commits

Author SHA1 Message Date
Violeta Georgieva
d68232c880 Refactor AbstractRequestBodyPublisher states
The state machine is refactored in order to solve various concurrency
issues.
2016-07-08 09:31:51 +03:00
Rossen Stoyanchev
d7a43d2003 Polish tests 2016-07-07 23:04:27 -04:00
Rossen Stoyanchev
7534092ef3 Comprensive support for empty request body
This commit adds support for handling an empty request body with both
HttpEntity where the body is not required and with @RequestBody where
the body is required depending on the annotation's required flag.

If the body is an explicit type (e.g. String, HttpEntity<String>) and
the body is required an exception is raised before the method is even
invoked or otherwise the body is passed in as null.

If the body is declared as an async type (e.g. Mono<String>,
HttpEntity<Mono<String>>) and is required, the error will flow through
the async type. If not required, the async type will be passed with no
values (i.e. empty).

A notable exception is rx.Single which can only have one value or one
error and cannot be empty. As a result currently the use of rx.Single
to represent the request body in any form effectively implies the body
is required.
2016-07-07 15:58:06 -04:00
Rossen Stoyanchev
a584311178 Fix StringDecoder#decodeToMono issue with empty input
Before this change decodeToMono always created a StringBuilder to
aggregate resulting in an "" (empty string) rather than an empty
Mono for an empty input stream.

Now we aggregate in the DataBuffer instead and then decode to String.
2016-07-07 15:58:06 -04:00
Rossen Stoyanchev
1e1e2f8b1b Support HttpEntity method arguments
The RequestBodyArgumentResolver has been refactored to have a shared
base class and tests with the new HttpEntityMethodArgumentResolver.

An HttpEntity argument is not expected to have an async wrapper because
the request headers are available immediately. The body however can be
asynchronous, e.g. HttpEntity<Flux<String>>.
2016-07-07 15:58:06 -04:00
Brian Clozel
4c3c54463c Upgrade build to Spring 5.0.0-BUILD-SNAPSHOT
* update bean validation API version
* MethodParameter now validates indices, see 39e3f2ebf6
* `getCharSet()` is now `getCharset()`
2016-07-07 18:11:04 +02:00
Sam Brannen
7e783dd91f Delete temporary MethodParameterFactory solution
SPR-14055 introduced first-class support for the Java 8 Parameter API.

This commit therefore replaces the MethodParameterFactory with use of
the new SynthesizingMethodParameter.forParameter(Parameter) factory
method.

Issue: SPR-13575
2016-07-07 13:02:49 +02:00
Sam Brannen
862fb2af5f Upgrade to JUnit 5.0.0-M1
Issue: SPR-13575
2016-07-07 12:49:46 +02:00
Stephane Nicoll
0f589fc49c Merge pull request #1100 from nkjackzhang:patch-1
* pr/1100:
  Remove trailing whitespaces
  Add the injection point for the Provider
2016-07-07 10:35:27 +02:00
Stephane Nicoll
1103a9cd16 Remove trailing whitespaces
Closes gh-1100
2016-07-07 10:34:50 +02:00
nkjackzhang
6aeaa1976d Add the injection point for the Provider
See gh-1100
2016-07-07 10:31:49 +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
39e3f2ebf6 MethodParameter supports Java 8 Executable/Parameter and validates parameter indexes
Also, equals insists on the same class now, differentiating from SynthesizingMethodParameter.

Issue: SPR-14055
Issue: SPR-13456
Issue: SPR-14438
2016-07-07 00:37:52 +02:00
Rossen Stoyanchev
9cc01fc185 Add @RequestBody tests 2016-07-06 14:10:51 -04:00
Rossen Stoyanchev
54bfbbc607 Rename decodeOne->decodeToMono and readOne->readMono 2016-07-06 12:38:05 -04:00
Juergen Hoeller
da9c24c41e Polishing 2016-07-06 18:11:33 +02:00
Rossen Stoyanchev
6525504e17 Restore local vars in JacksonJsonEncoder 2016-07-06 09:35:25 -04:00
Juergen Hoeller
102dc8a4dd Polishing 2016-07-06 15:29:15 +02:00
Juergen Hoeller
19e5a34f9f Restored binary compatibility with Hibernate 5.0/5.1's Query type
Issue: SPR-14425
2016-07-06 15:20:09 +02:00
Juergen Hoeller
5890758fd0 Avoid canonicalName call for already-seen bean name
Issue: SPR-14433
2016-07-06 15:12:18 +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
Rossen Stoyanchev
9ee4f6ee30 Polish tests 2016-07-06 08:59:46 -04:00
Stephane Nicoll
e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +02:00
Arjen Poutsma
b0de99bc8c Refactor ResponseBodySubscriber to Processor
This commit changes the AbstractResponseBodySubscriber into a
AbstractResponseBodyProcessor<DataBuffer, Void>, so that the processor
can be used as a return value for writeWith.

Additional, this commit no longer closes the response after an eror
occurred.

This fixes #59.
2016-07-06 13:18:42 +02:00
Stephane Nicoll
912b63ad44 Merge pull request #1099 from nkjackzhang:patch-5
* pr/1099:
  Polish doc
2016-07-06 11:20:54 +02:00
nkjackzhang
7dfbc16f1f Polish doc
Closes gh-1099
2016-07-06 11:20:32 +02:00
Arjen Poutsma
c85d1dc126 Merge pull request #133 from violetagg/onwritepossible-concurrency
AbstractResponseBodySubscriber improvements
2016-07-06 10:37:49 +02:00
Violeta Georgieva
7763391e84 AbstractResponseBodySubscriber improvements
When the thread is writing to the response in
RECEIVED.onWritePossible(), the execution may stop because isReady()
returned false. In this case the buffer is partially written.
When there is partially written case:
1. The state will be changed from WRITING to RECEIVED
2. A check for "write possible" will be performed:
  - If onWritePossible event has been already called by the web
  container while in WRITING state then this check will trigger
  RECEIVED.onWritePossible() because isReady() will be true and the
  writing will continue.
  - Otherwise the writing will be resumed when the web container sends
  onWritePossible event.
2016-07-06 10:14:05 +03:00
Rossen Stoyanchev
55193194c2 Polish tests 2016-07-05 20:39:56 -04:00
Rossen Stoyanchev
9c438a8f78 Fix failing test 2016-07-05 18:20:31 -04:00
Rossen Stoyanchev
33b6dca2a6 Polish tests 2016-07-05 18:14:47 -04:00
Juergen Hoeller
7dda9fbd8c Drop JasperReports support
Issue: SPR-13294
2016-07-05 23:06:15 +02:00
Juergen Hoeller
355c6f0715 Upgrade to JMS 2.0 and JCA 1.7
Issue: SPR-13793
2016-07-05 22:18:19 +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
Juergen Hoeller
12d373659a Upgrade to Undertow 1.4 CR3 (and Jackson 2.8 GA)
This commit also renames WebSocketIntegrationTests to WebSocketHandshakeTests.

Issue: SPR-14328
2016-07-05 20:47:53 +02:00
Juergen Hoeller
acdb43f470 Remove remaining JRuby and Commons Pool test resources
Issue: SPR-14429
2016-07-05 20:47:39 +02:00
Sam Brannen
2bae0613a3 Ensure code compiles with Eclipse JDT 2016-07-05 19:19:09 +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
Rossen Stoyanchev
7af7a55ede Polish and simplify JacksonJsonEncoder 2016-07-05 12:02:47 -04:00
Rossen Stoyanchev
2068f667f3 Expose getStatusCode from ServerHttpResponse 2016-07-05 11:10:36 -04:00
Sam Brannen
9a9551bf18 Make JUnit Jupiter support classes package private
Issue: SPR-13575
2016-07-05 17:09:18 +02:00
Sam Brannen
045c678622 Clean up warnings in spring-test 2016-07-05 17:09:18 +02:00
Rossen Stoyanchev
7401d10f91 Polish AbstractServerHttpResponse 2016-07-05 11:06:02 -04:00
Stephane Nicoll
00d2606b00 Explicit type can be replaced by <>
Issue: SPR-13188
2016-07-05 17:00:34 +02:00
Stephane Nicoll
3096888c7d Better synchronization in ConcurrentMapCache
Issue: SPR-13810
2016-07-05 16:44:07 +02:00
Juergen Hoeller
9b9f3714ae JRuby script template tests run against JRuby 9.1.2.0 now
Issue: SPR-14429
2016-07-05 16:34:52 +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
fb5a096ca2 Require Undertow 1.3 byte buffer pool
Issue: SPR-13495
2016-07-05 15:31:40 +02:00