Repository: wicket
Updated Branches:
  refs/heads/wicket-7.x d9c05b460 -> a95c59823


Add information how to setup Native WebSockets in Spring Boot application.

Based on feedback at users@ mailing list: 
http://markmail.org/message/ffvmoc2te5wxt6lb


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a95c5982
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a95c5982
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a95c5982

Branch: refs/heads/wicket-7.x
Commit: a95c59823a7d49af18c28d2b52c31700c360de56
Parents: d9c05b4
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Thu Jun 22 22:24:45 2017 +0200
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Thu Jun 22 22:24:45 2017 +0200

----------------------------------------------------------------------
 .../src/main/asciidoc/nativewebsockets.adoc     |  2 +-
 .../nativewebsockets/nativewebsockets_1.adoc    |  2 +-
 .../nativewebsockets/nativewebsockets_2.adoc    | 38 +++++++++++++++++++-
 3 files changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a95c5982/wicket-user-guide/src/main/asciidoc/nativewebsockets.adoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/main/asciidoc/nativewebsockets.adoc 
b/wicket-user-guide/src/main/asciidoc/nativewebsockets.adoc
index aff2803..c7faaa1 100644
--- a/wicket-user-guide/src/main/asciidoc/nativewebsockets.adoc
+++ b/wicket-user-guide/src/main/asciidoc/nativewebsockets.adoc
@@ -2,7 +2,7 @@
 http://en.wikipedia.org/wiki/WebSocket[WebSockets]
 This means that once the browser establish a web socket connection to the 
server the server can push data back to the browser without the browser 
explicitly asking again and again whether there is something new for it.
 
-Wicket Native WebSockets modules provide functionality to integrate with the 
non-standard APIs provided by different web containers (like 
http://tomcat.apache.org/[Apache Tomcat]
+Wicket Native WebSockets modules provide functionality to integrate with the 
non-standard APIs provided by different web containers (like 
http://tomcat.apache.org/[Apache Tomcat])
 
 WARNING: Native WebSocket works only when both the browser and the web 
containers support WebSocket technology. There are no plans to add support to 
fallback to long-polling, streaming or any other technology that simulates two 
way communication. Use it only if you really know that you will run your 
application in an environment that supports WebSockets.
 Currently supported web containers are Jetty 7.5+ , Tomcat 7.0.27+ and JBoss 
WildFly 8.0.0+.

http://git-wip-us.apache.org/repos/asf/wicket/blob/a95c5982/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_1.adoc
----------------------------------------------------------------------
diff --git 
a/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_1.adoc 
b/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_1.adoc
index b960ffe..1f36e71 100644
--- 
a/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_1.adoc
+++ 
b/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_1.adoc
@@ -1,5 +1,5 @@
 
-Each of the modules provide a specialization of 
_org.apache.wicket.protocol.http.WicketFilter_ that registers implementation 
specific endpoint when an HTTP request is 
http://en.wikipedia.org/wiki/WebSocket#WebSocket_protocol_handshake[upgraded]
+Each of the modules provide a specialization of 
_org.apache.wicket.protocol.http.WicketFilter_ that registers implementation 
specific endpoint when an HTTP request is 
http://en.wikipedia.org/wiki/WebSocket#WebSocket_protocol_handshake[upgraded].
 
 WebSockets communication can be used in a Wicket page by using 
_org.apache.wicket.protocol.ws.api.WebSocketBehavior_ or in a IResource by 
exteding _org.apache.wicket.protocol.ws.api.WebSocketResource_.
 When a client is connected it is being registered in a application scoped 
registry using as a key the application name, the client http session id, and 
the id of the page or the resource name that registered it. Later when the 
server needs to push a message it can use this registry to filter out which 
clients need to receive the message.

http://git-wip-us.apache.org/repos/asf/wicket/blob/a95c5982/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_2.adoc
----------------------------------------------------------------------
diff --git 
a/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_2.adoc 
b/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_2.adoc
index 151f729..d0cca36 100644
--- 
a/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_2.adoc
+++ 
b/wicket-user-guide/src/main/asciidoc/nativewebsockets/nativewebsockets_2.adoc
@@ -43,6 +43,15 @@ Depending on the web container that is used the application 
has to add a depende
 </dependency>
 ----
 
+- for https://projects.spring.io/spring-boot/[Spring Boot] applications also 
add
+----
+<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-websocket</artifactId>
+</dependency>
+----
+
+
 NOTE: All web containers providing JSR356 implementation are built with Java 
7. This is the reason why _wicket-native-websocket-javax_ module is available 
only with Wicket 7.x. If your application runs with JRE 7.x then you can
 use _wicket-native-websocket-javax_ together with the latest version of Wicket 
6.x. Beware that the API/implementation of _wicket-native-websocket-javax_ may 
change before Wicket 7.0.0 is released!
 
@@ -76,7 +85,34 @@ For JSR356 complaint web containers (at the moment: Tomcat 
7.0.47+, Tomcat 8.x a
 
<filter-class>org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter</filter-class>
 ----
 
-
+For https://projects.spring.io/spring-boot/[Spring Boot] application:
+----
+@Bean
+    public FilterRegistrationBean wicketFilter() {
+        final FilterRegistrationBean wicketFilter = new
+FilterRegistrationBean();
+        wicketFilter.setDispatcherTypes(DispatcherType.REQUEST,
+DispatcherType.ERROR, DispatcherType.FORWARD, DispatcherType.ASYNC);
+        wicketFilter.setAsyncSupported(true);
+        wicketFilter.setFilter(new JavaxWebSocketFilter());
+        wicketFilter.addInitParameter(WicketFilter.APP_FACT_PARAM,
+SpringWebApplicationFactory.class.getName());
+        wicketFilter.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM,
+"/*");
+        wicketFilter.addUrlPatterns("/*");
+        return wicketFilter;
+    }
+
+    @Bean
+    public ServerEndpointExporter serverEndpointExporter() {
+        return new ServerEndpointExporter();
+    }
+
+    @Bean
+    public WicketServerEndpointConfig wicketServerEndpointConfig() {
+        return new WicketServerEndpointConfig();
+    }
+----
 
 * *WebSocketBehavior*
 

Reply via email to