Commit Graph

600 Commits

Author SHA1 Message Date
Rossen Stoyanchev d3324c8d4f Trap exception from SockJS HeartbeatTask
Issue: SPR-15307
2017-03-16 18:02:44 -04:00
Juergen Hoeller 98dbc17591 Polishing 2017-03-07 10:33:48 +01:00
Juergen Hoeller 28849e0987 Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
(cherry picked from commit 1b2dc36)
2017-01-31 10:28:46 +01:00
Juergen Hoeller fcfacd9f83 Polishing
(cherry picked from commit f095aa2)
2017-01-23 23:47:01 +01:00
Juergen Hoeller bddcc669b3 WebSocketSession.getExtensions consistently exposes unmodifiable/empty list
Issue: SPR-15180
(cherry picked from commit e94fa3f)
2017-01-23 23:33:04 +01:00
Rossen Stoyanchev 75daf781c2 Well-known names for beans in message broker XML config
Issue: SPR-15068
2017-01-17 17:08:45 -05:00
Juergen Hoeller 709d4ba6e7 Avoid explicit DecoratedObjectFactory setup in JettyRequestUpgradeStrategy
Issue: SPR-14940
2016-12-21 09:47:29 +01:00
Juergen Hoeller 9cb4de8b5e Polishing 2016-12-20 21:11:07 +01:00
Juergen Hoeller 54c7a9ee95 Revised Jetty 9.3 vs 9.4 differentiation
Issue: SPR-14940
(cherry picked from commit 52799c0)
2016-12-19 00:58:53 +01:00
Rossen Stoyanchev e16d753439 Allow athentication at the STOMP level
This commit makes it possible for a ChannelInterceptor to override the
user header in a Spring Message that contains a STOMP CONNECT frame.

After the message is sent, the updated user header is observed and
saved to be associated with session thereafter.

Issue: SPR-14690
2016-12-13 16:17:05 -05:00
Brian Clozel 35b0c8b577 Update websocket support for Jetty 9.3+
Due to a few changes in `WebSocketServerFactory` and `Session` API, our
`JettyRequestUpgradeStrategy` and `JettyWebSocketSession` needed to
adapt. As of 9.3.15+ and 9.4.0+, some reflection is required to support
previous versions.

Spring 4.3 websocket officially supports Jetty 9.1 to 9.3.

Issue: SPR-14940
2016-12-09 14:58:18 +01:00
Brian Clozel 75034c3710 Revert "Update websocket support for Jetty 9.3+"
This reverts commit 305cea28c5.
2016-12-08 22:48:06 +01:00
Brian Clozel 305cea28c5 Update websocket support for Jetty 9.3+
Due to a few changes in `WebSocketServerFactory` and `Session` API, our
`JettyRequestUpgradeStrategy` and `JettyWebSocketSession` needed to
adapt. As of 9.3.15+ and 9.4.0+, some reflection is required to support
previous versions.

Spring 4.3 officially supports Jetty 9.1 to 9.3.

Issue: SPR-14940
2016-12-08 21:44:31 +01:00
Rossen Stoyanchev 69ba85b051 Backport of STOMP message header encoding improvements
Issue: SPR-14901
2016-12-08 11:33:16 -05:00
Juergen Hoeller 5fee5f39ea Polishing 2016-12-01 14:13:23 +01:00
Christoph Dreis 8de100b116 Implement allocation-friendly method to get user count in SimpUserRegistry
SPR-14930
(cherry picked from commit a929e9c)
2016-12-01 14:09:43 +01:00
Juergen Hoeller ac30bcb0eb WebSocketServerSockJsSession uses dedicated disconnect lock
Issue: SPR-14917
(cherry picked from commit a49809b)
2016-12-01 14:09:34 +01:00
Rossen Stoyanchev 8f19650fd7 Avoid locking in WebSocket session "close" callback
When processing a "close" notification from the server make an effort
to cancel any outstanding heartbeat but avoid going as far as acquiring
the responseLock since the server itself may already hold a lock of its
own leading to a potential deadlock.

The heartbeat task is now also further protected with an isClosed()
check in case the heartbeat does not get cancelled in a concurrent
scenario.

Issue: SPR-14917
2016-11-23 20:58:22 -05:00
Juergen Hoeller fe0249bf8f Polishing 2016-11-04 13:37:06 +01:00
Juergen Hoeller 7e7504f5ea Polishing 2016-11-03 23:20:33 +01:00
Juergen Hoeller 05547979de Polishing
Issue: SPR-14867
(cherry picked from commit a90e4b2)
2016-11-03 14:54:15 +01:00
Rossen Stoyanchev 8f4ec35697 Check SockJS session type
This commits adds a validation check whether the SockJS session type
matches the transport type and rejects requests for which they
don't match.

Issue: SPR-14867
2016-11-03 09:38:24 +02:00
Juergen Hoeller 1c80d2ac2f Avoid deadlock between SockJS heartbeat and XHR polling
Issue: SPR-14833
(cherry picked from commit 72e1f7e)
2016-10-31 11:47:23 +01:00
Juergen Hoeller f5cd5387da StompSubProtocolHandler does not insist on SimpMessageHeaderAccessor
Issue: SPR-14791
(cherry picked from commit 66722af)
2016-10-12 17:47:58 +02:00
Juergen Hoeller f2ac416f66 Consistent final logger fields
(cherry picked from commit cfa0f6c)
2016-10-06 00:15:45 +02:00
Juergen Hoeller d04567b99c Polishing 2016-09-26 18:19:04 +02:00
Sam Brannen c26bf871b7 Clean up warnings related to forthcoming removals in Tomcat 9
(cherry picked from commit b521aa8)
2016-09-18 21:04:29 +02:00
Juergen Hoeller 37670924f6 Polishing 2016-08-31 01:53:03 +02:00
Juergen Hoeller acbb2544bf Polishing
(cherry picked from commit 4ef428d)
2016-08-31 00:45:25 +02:00
Juergen Hoeller d8f7347000 Consistent comma splitting without regex overhead
Issue: SPR-14635
(cherry picked from commit 03609c1)
2016-08-31 00:44:52 +02:00
Rossen Stoyanchev 5075dd4dfa Harden synchronization around SockJS heartbeats
Create an explicit heartbeat task with an experiration flag so that
it can be cancelled reliably vs relying on the ScheduledFutureTask
cancel method which may return true even if the task is already
running.

Issue: SPR-14356
2016-08-30 09:20:07 -04:00
Rossen Stoyanchev 198a74d793 Support receipt on DISCONNECT with simple broker
Issue: SPR-14568
2016-08-29 18:30:17 -04:00
Juergen Hoeller 0735e9ba98 Avoid unnecessary String concatenation in StompSubProtocolHandler
Issue: SPR-14624
(cherry picked from commit 56b197b)
2016-08-24 23:36:13 +02:00
Juergen Hoeller 67ba187b6f Polishing
(cherry picked from commit 59a24b4)
2016-08-10 14:57:50 +02:00
Juergen Hoeller 36e1c82ef5 Backported refinements and polishing 2016-07-20 21:46:25 +02:00
Juergen Hoeller afe106e254 Polishing 2016-07-15 22:47:12 +02:00
Juergen Hoeller 92d78c10a2 Polishing (backported from master) 2016-07-06 17:13:18 +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
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
Sam Brannen e2810904b0 Fix Javadoc formatting 2016-06-07 19:07:38 +02:00
Rossen Stoyanchev a9217d51c2 Safe InetSocketAddress init for WebSocket and SockJS
Issue: SPR-14295
2016-05-22 06:36:42 -04:00
Rossen Stoyanchev 3fb58cda8e Wrap Jetty WebSocketException
Issue: SPR-14267
2016-05-18 11:05:09 -04:00
Juergen Hoeller f83cbff543 Consistent SmartLifecycle implementations
Issue: SPR-14233
2016-05-02 13:01:44 +02:00
Brian Clozel 55dae618a6 Improve multi-valued HTTP headers support
Prior to this change, getting header values with `HttpHeaders` when
headers are multi-valued would cause issues.
For example, for a given HTTP message with headers:
    Cache-Control: public, s-maxage=50
    Cache-Control: max-age=42

Getting a `List` of all values would return <"public", "s-maxage=50">
and getting the header value would return "public, s-maxage=50".

This commit takes now into account multi-valued HTTP headers and adds
new getters/setters for "If-Match" and "If-Unmodified-Since" headers.

Note that for ETag-related headers such as "If-Match" and
"If-None-Match", a special parser has been implemented since ETag values
can contain separator characters.

Issue: SPR-14223, SPR-14228
2016-04-28 18:48:47 +02:00
Rossen Stoyanchev 8f0f5faf4d XML config properly initialize WS message broker stats
Issue: SPR-14190
2016-04-26 17:24:22 -04:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Venil Noronha aafd46aeb3 Remove isOpen assertion when sending WebSocket message
Issue: SPR-14138
2016-04-18 09:46:05 -04:00
Venil Noronha 28f2f4a431 Delegate sendMessage
Issue: SPR-14139
2016-04-18 09:30:48 -04:00
Juergen Hoeller 537193a4e0 Consistent license header 2016-04-11 20:49:38 +02:00