Commit Graph

16872 Commits

Author SHA1 Message Date
Sebastien Deleuze
3fe87ee225 Change SseEvent#mimeType to SseEvent#mediaType 2016-06-24 17:21:01 +02:00
Sebastien Deleuze
e6a0b39df5 Remove SseHttpMessageConverter
CodecHttpMessageConverter is now suitable for SSE since it now
handles default content type.
2016-06-24 17:11:29 +02:00
Sebastien Deleuze
59d3721a40 Support default content type in CodecHttpMessageConverter 2016-06-24 17:09:33 +02:00
Arjen Poutsma
52325a21ff Fixed Undertow flush support
Reactored Servlet 3.1 and Undertow response support into an
AbstractResponseBodySubscriber that uses an internal state machine,
making thread-safity a lot easier.
2016-06-24 15:28:12 +02:00
Sebastien Deleuze
6b3d5f1bc5 Turn FlushingDataBuffer to an empty DataBuffer 2016-06-24 15:28:12 +02:00
Sebastien Deleuze
3c80c19c19 Take in account Rossen and Arjen feedbacks 2016-06-24 15:28:12 +02:00
Arjen Poutsma
81496624a9 Fixed Servlet flush
Servlet flush will now occur on the next possible write if it cannot be
done immediately.
2016-06-24 15:28:12 +02:00
Sebastien Deleuze
9004812231 Add Server-Sent Events support
Flux<SseEvent> is Spring Web Reactive equivalent to Spring MVC
SseEmitter type. It allows to send Server-Sent Events in a reactive way.
Sending Flux<String> or Flux<Pojo> is equivalent to sending
Flux<SseEvent> with the data property set to the String or
Pojo value. For example:

@RestController
public class SseController {

	@RequestMapping("/sse/string")
	Flux<String> string() {
		return Flux.interval(Duration.ofSeconds(1)).map(l -> "foo " + l);
	}

	@RequestMapping("/sse/person")
	Flux<Person> person() {
		return Flux.interval(Duration.ofSeconds(1)).map(l -> new Person(Long.toString(l), "foo", "bar"));
	}

	@RequestMapping("/sse-raw")
	Flux<SseEvent> sse() {
		return Flux.interval(Duration.ofSeconds(1)).map(l -> {
			SseEvent event = new SseEvent();
			event.setId(Long.toString(l));
			event.setData("foo\nbar");
			event.setComment("bar\nbaz");
			return event;
		});
	}
}
2016-06-24 15:27:26 +02:00
Sebastien Deleuze
aeb35787d7 Add flushing support
This commit add flushing support thanks to the FlushingDataBuffer
wrapper that allows to identify the elements that should trigger a
flush.
2016-06-24 15:23:26 +02:00
Juergen Hoeller
351a729317 Explicit javadoc reference to Hibernate 5.2
Issue: SPR-14393
2016-06-24 12:55:58 +02:00
Juergen Hoeller
711eb99812 HibernateJpaVendorAdapter and LocalSessionFactoryBuilder enforce Hibernate 5.2's connection handling mode DELAYED_ACQUISITION_AND_HOLD
Issue: SPR-14393
2016-06-24 12:37:31 +02:00
Juergen Hoeller
5e08598a2a HibernateJpaDialect accepts equivalent connection for proper reset as well
Issue: SPR-14393
2016-06-23 18:24:09 +02:00
Juergen Hoeller
f5282bc1e3 PayloadArgumentResolver's MessageConversionException includes original payload type
Issue: SPR-14394
2016-06-23 17:32:30 +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
Sam Brannen
3dbf25e018 Implement equals() & hashCode() in MockServerContainerContextCustomizer
Issue: SPR-14367
2016-06-23 13:22:10 +02:00
Sam Brannen
f7dd757593 Support WebSocket ServletServerContainerFB in the TCF
Prior to this commit, any attempt to include a bean of type
ServletServerContainerFactoryBean in the WebApplicationContext for an
integration test class annotated with @WebAppConfiguration in
conjunction the Spring TestContext Framework (TCF) would have resulted
in an IllegalStateException stating that "A ServletContext is required
to access the javax.websocket.server.ServerContainer instance."

In such scenarios, the MockServletContext was in fact present in the
WebApplicationContext; however there was no WebSocket ServerContainer
stored in the ServletContext.

This commit addresses this issue by introducing the following.

- MockServerContainer: a private mock implementation of the
  javax.websocket.server.ServerContainer interface.

- MockServerContainerContextCustomizer: a ContextCustomizer that
  instantiates a new MockServerContainer and stores it in the
  ServletContext under the attribute named
  "javax.websocket.server.ServerContainer".

- MockServerContainerContextCustomizerFactory: a
  ContextCustomizerFactory which creates a
  MockServerContainerContextCustomizer if WebSocket support is present
  in the classpath and the test class is annotated with
  @WebAppConfiguration. This factory is registered by default via the
  spring.factories mechanism.

Issue: SPR-14367
2016-06-22 22:10:16 +02:00
Sam Brannen
7f16bdaf74 Polish error messages in ServletServerContainerFactoryBean
Issue: SPR-14367
2016-06-22 19:30:23 +02:00
Juergen Hoeller
fd9d518c36 Avoid potential deadlock in AbstractBeanFactoryPointcutAdvisor
Issue: SPR-14388
2016-06-22 14:41:20 +02:00
Juergen Hoeller
a2aa82eb31 Polishing 2016-06-22 11:55:33 +02:00
Juergen Hoeller
981d4494c6 AspectJWeavingEnabler registered with well-defined bean name (and therefore once only)
Issue: SPR-14373
2016-06-22 11:55:24 +02:00
Juergen Hoeller
0de85e3a73 Upgrade to Undertow 1.4 CR2
Issue: SPR-14328
2016-06-22 11:15:24 +02:00
Rossen Stoyanchev
9aa6f5caac Add support for ResponseEntity result handling 2016-06-21 17:27:52 -04: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
Sebastien Deleuze
59b7c25003 Use ResolvableType instead of raw Class in JacksonJsonDecoder 2016-06-21 16:48:18 +02:00
Rossen Stoyanchev
db1092f119 Polish RequestMappingInfoTests 2016-06-21 10:43:08 -04:00
Juergen Hoeller
848562d68a Upgrade to CGLIB 3.2.3
Issue: SPR-14385
2016-06-21 10:13:42 +02:00
Sebastien Deleuze
b5ec47d360 Polishing 2016-06-20 17:10:31 +02:00
Sebastien Deleuze
a0e2231779 Use specified ResolvableType in JacksonJsonEncoder
This commit also fixes an issue in the HTTP client that used the
wrapper type instead of the element type. As a consequence, due
to type erasure, we now have to specify the type of the content
in DefaultHttpRequestBuilder#contentStream().
2016-06-20 16:23:02 +02:00
Juergen Hoeller
56db1af11d No tomcat-embed-logging-juli on Tomcat 8.5.3 anymore 2016-06-20 14:24:16 +02:00
Juergen Hoeller
8cb9d5ebae EnableAspectJAutoProxy features exposeProxy flag (analogous to XML namespace)
Issue: SPR-10454
2016-06-20 13:50:04 +02:00
Juergen Hoeller
01f115869b Bootstrap SessionFactory implements InfrastructureProxy interface for resource key unwrapping
Issue: SPR-14379
2016-06-20 13:42:42 +02:00
Juergen Hoeller
f9fec73f1d Latest dependency updates (Gson 2.7, Jackson 2.8 RC2, Tomcat 8.5.3, Caffeine 2.3.1) 2016-06-20 13:41:04 +02:00
Sebastien Deleuze
5141a198d9 Avoid using deprecated methods in StringEncoder 2016-06-20 13:28:59 +02:00
Rossen Stoyanchev
ba885f3d0b Add heartbeat lock to SockJS server sessions
Even before this change SockJS sessions always cancelled the heartbeat
task first prior to sending messages. However when the heartbeat task
is already in progress, cancellation of it is not enough and we must
wait until the heartbeat is sent.

This commit adds a heartbeat write lock which is obtained and held
during the sending of a heartbeat. Now when sessions send a message
they still cancel the heartbeat task but if that fails they also wait
for the heartbeat write lock.

Issue: SPR-14356
2016-06-17 16:54:54 -04:00
Rossen Stoyanchev
919f6c96f9 ForwardedHeaderFilter is case-insensitive
Issue: SPR-14372
2016-06-17 14:20:42 -04:00
nkjackzhang
981a748dcc Fix ambiguous static import in TestPropertySourceUtilsTests 2016-06-17 17:18:36 +02:00
Stephane Nicoll
6f9fb31bf9 Merge pull request #1082 from nkjackzhang:patch-2
* pr/1082:
  Move <a> out of @code
2016-06-17 08:08:02 +02:00
nkjackzhang
c145ceebf3 Move <a> out of @code
Closes gh-1082
2016-06-17 08:06:21 +02:00
Stephane Nicoll
bcfc09a93c Document sync attribute of Cacheable
Closes gh-14366
2016-06-16 13:14:53 +02:00
Stephane Nicoll
b92576d8d9 Merge pull request #1080 from nkjackzhang:patch-2
* pr/1080:
  Polish contribution
  Fix typo in javadoc
2016-06-16 12:13:01 +02:00
Stephane Nicoll
d41178c75a Polish contribution
Closes gh-1080
2016-06-16 12:12:42 +02:00
nkjackzhang
9656015d26 Fix typo in javadoc
See gh-1080
2016-06-16 12:11:14 +02:00
Juergen Hoeller
7d39957ec9 SessionFactoryUtils defensively accesses getProperties method via reflection
Issue: SPR-14365
2016-06-15 16:48:34 +02:00
Sam Brannen
9001af7efb Revert build to Gradle 2.13
Issue: SPR-14362
2016-06-15 13:00:40 +02:00
Juergen Hoeller
b5364d5f1a SpringSessionSynchronization uses SessionFactoryUtils.getFlushMode for Hibernate 5.1/5.2 adaptation
Issue: SPR-14364
2016-06-14 22:55:31 +02:00
Juergen Hoeller
dcb2c73102 MultipartResolutionDelegate skips Part parameter checks on Servlet 2.5
Issue: SPR-14358
2016-06-14 22:48:51 +02:00
Sam Brannen
045ee52232 Invoke target.toString() safely in ReflectionTestUtils
ReflectionTestUtils invokes toString() on target objects in order to
build exception and logging messages, and prior to this commit problems
could occur if the invocation of toString() threw an exception.

This commit addresses this issue by ensuring that all invocations of
toString() on target objects within ReflectionTestUtils are performed
safely within try-catch blocks.

Issue: SPR-14363
2016-06-14 20:08:26 +02:00
Sam Brannen
2fd4462268 Upgrade build to Gradle 2.14
In the process of upgrading the build to use Gradle 2.14, the
setFieldOnLegacyEntityWithSideEffectsInToString() test method in
ReflectionTestUtilsTests began to fail. The reason is that the log
level for ReflectionTestUtils is now DEBUG by default with Gradle 2.14.
The apparent cause is that log4j was present on the test runtime
classpath for the spring-test module with all previous versions of
Gradle (via a transitive optional dependency from another project that
spring-test depends on). Thus the configuration in log4j.properties in
spring-test was previously honored, but with Gradle 2.14 a different
commons logging implementation is picked up.

Thus, in addition to upgrading the build to Gradle 2.14, this commit
introduces an explicit test runtime dependency on log4j in the
spring-test module.

The discovered bug in ReflectionTestUtils regarding DEBUG log level
will be addressed separately.

Issue: SPR-14362
2016-06-14 18:40:01 +02:00
Sam Brannen
0815560c85 Migrate to Asciidoctor 1.5 syntax
Issue: SPR-14355
2016-06-11 12:51:38 +02:00
Rossen Stoyanchev
551b7cd60e Add global Validator bean to WebReactiveConfiguration 2016-06-10 16:06:12 -04:00