You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2016/11/15 21:42:15 UTC
[1/3] wicket git commit: Extract the WebSockets demo application in
its own module so that it is easier to test it in non-embedded containers
Repository: wicket
Updated Branches:
refs/heads/master a42a27b5d -> 4b600a200
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartWebSocketResource.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartWebSocketResource.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartWebSocketResource.java
deleted file mode 100644
index f7ff175..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartWebSocketResource.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app.charts;
-
-import org.apache.wicket.protocol.ws.api.WebSocketResource;
-import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
-
-/**
- *
- */
-public class ChartWebSocketResource extends WebSocketResource
-{
- public static final String NAME = ChartWebSocketResource.class.getName();
-
- @Override
- protected void onConnect(ConnectedMessage message)
- {
- super.onConnect(message);
-
- ChartUpdater.start(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartsResourceReference.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartsResourceReference.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartsResourceReference.java
deleted file mode 100644
index 520dcc4..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartsResourceReference.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app.charts;
-
-import java.util.List;
-
-import org.apache.wicket.markup.head.HeaderItem;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.protocol.ws.api.WicketWebSocketJQueryResourceReference;
-import org.apache.wicket.request.Url;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-import org.apache.wicket.request.resource.UrlResourceReference;
-
-/**
- * A resource reference that contributes 'charts.js' - the JavaScript that registers the WebSocket client
- * and constructs the Google chart.
- */
-public class ChartsResourceReference extends JavaScriptResourceReference
-{
- public ChartsResourceReference()
- {
- super(ChartsResourceReference.class, "charts.js");
- }
-
- /**
- * Specify that charts.js depends on Google JS APIs and Wicket WebSocket JavaScript
- * @return a list of dependencies
- */
- @Override
- public List<HeaderItem> getDependencies()
- {
- List<HeaderItem> dependencies = super.getDependencies();
- dependencies.add(JavaScriptHeaderItem.forReference(new UrlResourceReference(Url.parse("https://www.google.com/jsapi"))));
- dependencies.add(JavaScriptHeaderItem.forReference(WicketWebSocketJQueryResourceReference.get()));
- return dependencies;
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.html b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.html
deleted file mode 100644
index 678facd..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<wicket:panel>
- <div id="chart_div"></div>
-</wicket:panel>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.java
deleted file mode 100644
index 773b644..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/WebSocketChart.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app.charts;
-
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.html.panel.Panel;
-
-/**
- * A panel that initializes a Google Line chart and uses WebSocketBehavior to register an asynchronous
- * task that will push some data through the web socket connection.
- */
-public class WebSocketChart extends Panel
-{
- public WebSocketChart(final String id)
- {
- super(id);
- }
-
- @Override
- public void renderHead(IHeaderResponse response)
- {
- super.renderHead(response);
- response.render(JavaScriptHeaderItem.forReference(new ChartsResourceReference()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/charts.js
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/charts.js b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/charts.js
deleted file mode 100644
index 376899a..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/charts.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-google.load("visualization", "1", {
- packages:["corechart"]
-});
-
-google.setOnLoadCallback(drawChart);
-
-function drawChart() {
-
- var options = {
- title: 'Stock prices'
- };
-
- var rawData = [
- ['Year', 'Company 1', 'Company 2'],
- ["1999", 0, 0]
- ];
-
- var chart;
-
- /**
- * (Re)Initializes the chart
- */
- var updateChart = function() {
- var data = google.visualization.arrayToDataTable(rawData);
- if (chart) {
- chart.clearChart();
- } else {
- chart = new google.visualization.LineChart(Wicket.$('chart_div'));
- }
- chart.draw(data, options);
- };
-
- /**
- * Updates the chart data by updating or appending the new data pushed by the server
- *
- * @param data the new data pushed by the server
- */
- var updateChartData = function(data) {
-
- // the index of the column which data will be updated. Either 1 (Company 1) or 2 (Company 2)
- var columnIndex = rawData[0].indexOf(data.field);
-
- var replaced = false;
-
- // look whether there is already a record for that year and update the data for the company
- for (var r = 1; r < rawData.length; r++) {
- var oldRecord = rawData[r];
- if (oldRecord[0] === data.year) {
- oldRecord[columnIndex] = data.value;
- replaced = true;
- break;
- }
- }
-
- if (!replaced) {
- // there is no update, so append the new data
-
- // the data of the last appended record
- var lastRecord = rawData[rawData.length - 1];
-
- // the new record that keeps the same data as the last one but updates the value for the updated company
- var newRecord = [data.year, lastRecord[1], lastRecord[2]];
- newRecord[columnIndex] = data.value;
- rawData.push(newRecord);
- }
-
- if (rawData.length > 20) {
- // show at most 20 years back. The first record is special (the headers), so cut the second one
- rawData.splice(1, 1);
- }
-
- updateChart();
- };
-
- Wicket.Event.subscribe("/websocket/open", function(jqEvent) {
- // show the initial state of the chart
- updateChart();
- });
-
- Wicket.Event.subscribe("/websocket/message", function(jqEvent, message) {
- // new record is pushed by the server
-
- var record = jQuery.parseJSON(message);
- if (record && record.year) {
- updateChartData(record);
- }
- });
-
-}
-
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/resources/keystore
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/resources/keystore b/wicket-native-websocket/wicket-native-websocket-javax/src/test/resources/keystore
deleted file mode 100644
index 30bbc90..0000000
Binary files a/wicket-native-websocket/wicket-native-websocket-javax/src/test/resources/keystore and /dev/null differ
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/WEB-INF/web.xml b/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/WEB-INF/web.xml
deleted file mode 100644
index 187950d..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
- version="3.1">
-
- <display-name>JSR356 WebSockets</display-name>
-
- <filter>
- <filter-name>jsr356.websockets</filter-name>
- <filter-class>org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter</filter-class>
- <init-param>
- <param-name>applicationClassName</param-name>
- <param-value>org.apache.wicket.protocol.ws.javax.app.JSR356Application</param-value>
- </init-param>
- </filter>
-
- <filter-mapping>
- <filter-name>jsr356.websockets</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-</web-app>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/logo.png
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/logo.png b/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/logo.png
deleted file mode 100644
index 39ec548..0000000
Binary files a/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/logo.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/style.css
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/style.css b/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/style.css
deleted file mode 100644
index 7de46da..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/webapp/style.css
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-body, p, li, a { font-family: georgia, times, serif;font-size:13pt;}
-h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; }
-body { margin:0;padding:0;}
-#hd {
- width : 100%;
- height : 87px;
- background-color : #092E67;
- margin-top : 0;
- padding-top : 10px;
- border-bottom : 1px solid #888;
- z-index : 0;
-}
-#ft {
- position : absolute;
- bottom : 0;
- width : 100%;
- height : 99px;
- background-color : #6493D2;
- border-top : 1px solid #888;
- z-index : 0;
-}
-#logo,#bd {
- width : 650px;
- margin: 0 auto;
- padding: 25px 50px 0 50px;
-}
-#logo h1 {
- color : white;
- font-size:36pt;
- display: inline;
-}
-#logo img {
- display:inline;
- vertical-align: bottom;
- margin-left : 50px;
- margin-right : 5px;
-}
-body { margin-top : 0; padding-top : 0;}
-#logo, #logo h1 { margin-top : 0; padding-top : 0;}
-#bd {
- position : absolute;
- top : 75px;
- bottom : 75px;
- left : 50%;
- margin-left : -325px;
- z-index : 1;
- overflow: auto;
- background-color : #fff;
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- -moz-box-shadow: 0px 0px 10px #888;
- -webkit-box-shadow: 0px 0px 10px #888;
- box-shadow: 0px 0px 10px #888;
-}
-a, a:visited, a:hover, a:active {
- color : #6493D2;
-}
-h2 {
- padding : 0; margin:0;
- font-size:36pt;
- color:#FF5500;
-}
-h3 {
- padding : 0; margin:0;
- font-size:24pt;
- color:#092E67;
-}
[2/3] wicket git commit: Extract the WebSockets demo application in
its own module so that it is easier to test it in non-embedded containers
Posted by mg...@apache.org.
Extract the WebSockets demo application in its own module so that it is easier to test it in non-embedded containers
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4b600a20
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4b600a20
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4b600a20
Branch: refs/heads/master
Commit: 4b600a200ec1eb513dc3f4643c53e7fea91f35cc
Parents: 3904754
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Nov 15 22:38:19 2016 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Nov 15 22:39:12 2016 +0100
----------------------------------------------------------------------
wicket-native-websocket/pom.xml | 1 +
.../wicket-native-websocket-example/pom.xml | 148 +++++++++++++++++++
.../wicket/protocol/ws/example/HomePage.html | 40 +++++
.../wicket/protocol/ws/example/HomePage.java | 23 +++
.../protocol/ws/example/JSR356Application.java | 72 +++++++++
.../ws/example/WebSocketBehaviorDemoPage.html | 35 +++++
.../ws/example/WebSocketBehaviorDemoPage.java | 58 ++++++++
.../ws/example/WebSocketResourceDemoPage.html | 35 +++++
.../ws/example/WebSocketResourceDemoPage.java | 34 +++++
.../protocol/ws/example/WrappingFilter.java | 51 +++++++
.../ws/example/charts/ChartUpdater.java | 148 +++++++++++++++++++
.../example/charts/ChartWebSocketResource.java | 40 +++++
.../example/charts/ChartsResourceReference.java | 52 +++++++
.../ws/example/charts/WebSocketChart.html | 23 +++
.../ws/example/charts/WebSocketChart.java | 41 +++++
.../wicket/protocol/ws/example/charts/charts.js | 105 +++++++++++++
.../src/main/resources/log4j.properties | 25 ++++
.../src/main/webapp/WEB-INF/web.xml | 55 +++++++
.../src/main/webapp/logo.png | Bin 0 -> 12244 bytes
.../src/main/webapp/style.css | 84 +++++++++++
.../ws/example/ApacheLicenceHeaderTest.java | 34 +++++
.../ws/example/StartNativeWebSocketExample.java | 124 ++++++++++++++++
.../src/test/resources/keystore | Bin 0 -> 1481 bytes
.../src/test/java/log4j.properties | 16 --
.../apache/wicket/protocol/ws/javax/Start.java | 112 --------------
.../wicket/protocol/ws/javax/app/HomePage.html | 23 ---
.../wicket/protocol/ws/javax/app/HomePage.java | 24 ---
.../ws/javax/app/JSR356Application.java | 55 -------
.../ws/javax/app/WebSocketBehaviorDemoPage.html | 18 ---
.../ws/javax/app/WebSocketBehaviorDemoPage.java | 43 ------
.../ws/javax/app/WebSocketResourceDemoPage.html | 18 ---
.../ws/javax/app/WebSocketResourceDemoPage.java | 32 ----
.../ws/javax/app/charts/ChartUpdater.java | 140 ------------------
.../app/charts/ChartWebSocketResource.java | 36 -----
.../app/charts/ChartsResourceReference.java | 51 -------
.../ws/javax/app/charts/WebSocketChart.html | 6 -
.../ws/javax/app/charts/WebSocketChart.java | 41 -----
.../protocol/ws/javax/app/charts/charts.js | 106 -------------
.../src/test/resources/keystore | Bin 1481 -> 0 bytes
.../src/test/webapp/WEB-INF/web.xml | 38 -----
.../src/test/webapp/logo.png | Bin 12244 -> 0 bytes
.../src/test/webapp/style.css | 84 -----------
42 files changed, 1228 insertions(+), 843 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/pom.xml b/wicket-native-websocket/pom.xml
index d7f27b9..233d99b 100644
--- a/wicket-native-websocket/pom.xml
+++ b/wicket-native-websocket/pom.xml
@@ -31,5 +31,6 @@
<module>wicket-native-websocket-core</module>
<module>wicket-native-websocket-tomcat</module>
<module>wicket-native-websocket-javax</module>
+ <module>wicket-native-websocket-example</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/pom.xml b/wicket-native-websocket/wicket-native-websocket-example/pom.xml
new file mode 100644
index 0000000..97106fb
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-native-websocket</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>wicket-native-websocket-example</artifactId>
+ <packaging>war</packaging>
+ <name>Wicket Native WebSocket Example</name>
+
+ <properties>
+ <jetty.version>9.2.3.v20140905</jetty.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <!-- WICKET DEPENDENCIES -->
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-core</artifactId>
+ </dependency>
+
+ <!--<dependency>-->
+ <!--<groupId>org.apache.wicket</groupId>-->
+ <!--<artifactId>wicket-native-websocket-jetty9</artifactId>-->
+ <!--<version>${wicket.version}</version>-->
+ <!--</dependency>-->
+
+ <!--<dependency>-->
+ <!--<groupId>org.apache.wicket</groupId>-->
+ <!--<artifactId>wicket-native-websocket-tomcat</artifactId>-->
+ <!--<version>${wicket.version}</version>-->
+ <!--</dependency>-->
+
+ <!--<dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-websocket</artifactId>
+ <version>8.5.8</version>
+ <scope>provided</scope>
+ </dependency>-->
+
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-native-websocket-javax</artifactId>
+ </dependency>
+
+ <!-- LOGGING DEPENDENCIES - LOG4J -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+
+ <!-- JUNIT DEPENDENCY FOR TESTING -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
+
+ <!-- JETTY DEPENDENCIES FOR TESTING -->
+ <dependency>
+ <groupId>org.eclipse.jetty.aggregate</groupId>
+ <artifactId>jetty-all</artifactId>
+ <version>${jetty.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>${jetty.version}</version>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.html b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.html
new file mode 100644
index 0000000..72e6466
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.html
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+ <head>
+ <meta charset="utf-8" />
+ <title>Apache Wicket Quickstart</title>
+ <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
+ <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
+ </head>
+ <body>
+ <div id="hd">
+ <div id="logo">
+ <img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
+ <h1>Apache Wicket</h1>
+ </div>
+ </div>
+ <wicket:link>
+ <ul>
+ <li><a href="WebSocketBehaviorDemoPage.html">demo with WebSocketBehavior</a></li>
+ <li><a href="WebSocketResourceDemoPage.html">demo with WebSocketResource</a></li>
+ </ul>
+ </wicket:link>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.java
new file mode 100644
index 0000000..26f3626
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/HomePage.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example;
+
+import org.apache.wicket.markup.html.WebPage;
+
+public class HomePage extends WebPage
+{
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/JSR356Application.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/JSR356Application.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/JSR356Application.java
new file mode 100644
index 0000000..7ebd05d
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/JSR356Application.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example;
+
+import org.apache.wicket.protocol.ws.example.charts.ChartWebSocketResource;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.https.HttpsConfig;
+import org.apache.wicket.protocol.https.HttpsMapper;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+
+/**
+ * Application object for your web application.
+ * If you want to run this application without deploying, run the com.wicketinaction.StartNativeWebSocketExample class.
+ */
+public class JSR356Application extends WebApplication
+{
+ private ScheduledExecutorService scheduledExecutorService;
+
+ @Override
+ public Class<HomePage> getHomePage()
+ {
+ return HomePage.class;
+ }
+
+ @Override
+ public void init()
+ {
+ super.init();
+
+ scheduledExecutorService = Executors.newScheduledThreadPool(1);
+
+ setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(8080, 8443)));
+
+ mountPage("/behavior", WebSocketBehaviorDemoPage.class);
+ mountPage("/resource", WebSocketResourceDemoPage.class);
+
+ getSharedResources().add(ChartWebSocketResource.NAME, new ChartWebSocketResource());
+ }
+
+ @Override
+ protected void onDestroy() {
+ scheduledExecutorService.shutdownNow();
+
+ super.onDestroy();
+ }
+
+ public ScheduledExecutorService getScheduledExecutorService()
+ {
+ return scheduledExecutorService;
+ }
+
+ public static JSR356Application get()
+ {
+ return (JSR356Application) WebApplication.get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.html b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.html
new file mode 100644
index 0000000..8ec9a88
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.html
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+ <head>
+ <meta charset="utf-8" />
+ <title>Apache Wicket Quickstart</title>
+ <link href='https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
+ <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
+ </head>
+ <body>
+ <div id="hd">
+ <div id="logo">
+ <img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
+ <h1>Apache Wicket</h1>
+ </div>
+ </div>
+ <div wicket:id="chartPanel"></div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.java
new file mode 100644
index 0000000..f3c9db1
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketBehaviorDemoPage.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example;
+
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.apache.wicket.protocol.ws.example.charts.ChartUpdater;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.protocol.https.RequireHttps;
+import org.apache.wicket.protocol.ws.api.WebSocketBehavior;
+import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler;
+import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
+import org.apache.wicket.protocol.ws.api.message.TextMessage;
+import org.apache.wicket.protocol.ws.example.charts.WebSocketChart;
+
+@RequireHttps
+public class WebSocketBehaviorDemoPage extends WebPage
+{
+ public WebSocketBehaviorDemoPage()
+ {
+ WebSocketChart chartPanel = new WebSocketChart("chartPanel");
+ chartPanel.add(new WebSocketBehavior()
+ {
+ @Override
+ protected void onConnect(ConnectedMessage message)
+ {
+ super.onConnect(message);
+
+ ScheduledExecutorService service = JSR356Application.get().getScheduledExecutorService();
+ ChartUpdater.start(message, service);
+ }
+ });
+ add(chartPanel);
+
+ add(new WebSocketBehavior()
+ {
+ @Override
+ protected void onMessage(WebSocketRequestHandler handler, TextMessage message)
+ {
+ super.onMessage(handler, message);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.html b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.html
new file mode 100644
index 0000000..5281758
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.html
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+ <head>
+ <meta charset="utf-8" />
+ <title>Apache Wicket Quickstart</title>
+ <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
+ <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
+ </head>
+ <body>
+ <div id="hd">
+ <div id="logo">
+ <img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
+ <h1>Apache Wicket</h1>
+ </div>
+ </div>
+ <div wicket:id="chartPanel"></div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.java
new file mode 100644
index 0000000..c921078
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WebSocketResourceDemoPage.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example;
+
+import org.apache.wicket.protocol.ws.example.charts.ChartWebSocketResource;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.protocol.https.RequireHttps;
+import org.apache.wicket.protocol.ws.api.BaseWebSocketBehavior;
+import org.apache.wicket.protocol.ws.example.charts.WebSocketChart;
+
+@RequireHttps
+public class WebSocketResourceDemoPage extends WebPage
+{
+ public WebSocketResourceDemoPage()
+ {
+ WebSocketChart chartPanel = new WebSocketChart("chartPanel");
+ chartPanel.add(new BaseWebSocketBehavior(ChartWebSocketResource.NAME));
+ add(chartPanel);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WrappingFilter.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WrappingFilter.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WrappingFilter.java
new file mode 100644
index 0000000..69b224f
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/WrappingFilter.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ *
+ */
+public class WrappingFilter implements Filter
+{
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
+ {
+ request = new HttpServletRequestWrapper((HttpServletRequest) request);
+ chain.doFilter(request, response);
+ }
+
+ @Override
+ public void destroy()
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartUpdater.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartUpdater.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartUpdater.java
new file mode 100644
index 0000000..5b34992
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartUpdater.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example.charts;
+
+import java.io.IOException;
+import java.util.Random;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.protocol.ws.WebSocketSettings;
+import org.apache.wicket.protocol.ws.api.IWebSocketConnection;
+import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
+import org.apache.wicket.protocol.ws.api.registry.IKey;
+import org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry;
+
+/**
+ * A helper class that uses the web connection to push data to the
+ * client.
+ * To keep the demo simpler it doesn't use #onClose() to stop
+ * the thread.
+ */
+public class ChartUpdater
+{
+ public static void start(ConnectedMessage message, ScheduledExecutorService scheduledExecutorService)
+ {
+ Record[] data = generateData();
+
+ // create an asynchronous task that will write the data to the client
+ UpdateTask updateTask = new UpdateTask(message.getApplication(), message.getSessionId(), message.getKey(), data);
+ scheduledExecutorService.schedule(updateTask, 1, TimeUnit.SECONDS);
+ }
+
+
+
+ /**
+ * Generates some random data to send to the client
+ * @return records with random data
+ */
+ private static Record[] generateData()
+ {
+ Random randomGenerator = new Random();
+ Record[] data = new Record[1000];
+ for (int i = 0; i < 1000; i++)
+ {
+ Record r = new Record();
+ r.year = 2000 + i;
+ r.field = (i % 2 == 0) ? "Company 1" : "Company 2";
+ r.value = randomGenerator.nextInt(1500);
+ data[i] = r;
+ }
+ return data;
+ }
+
+
+ /**
+ * A task that sends data to the client by pushing it to the web socket connection
+ */
+ private static class UpdateTask implements Runnable
+ {
+ private static final String JSON_SKELETON = "{ \"year\": \"%s\", \"field\": \"%s\", \"value\": %s }";
+
+ /**
+ * The following fields are needed to be able to lookup the IWebSocketConnection from
+ * IWebSocketConnectionRegistry
+ */
+ private final String applicationName;
+ private final String sessionId;
+ private final IKey key;
+
+ /**
+ * The data that has to be sent to the client
+ */
+ private final Record[] data;
+
+ private UpdateTask(Application application, String sessionId, IKey key, Record[] data)
+ {
+ this.applicationName = application.getName();
+ this.sessionId = sessionId;
+ this.key = key;
+ this.data = data;
+ }
+
+ @Override
+ public void run()
+ {
+ Application application = Application.get(applicationName);
+ WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
+ IWebSocketConnectionRegistry webSocketConnectionRegistry = webSocketSettings.getConnectionRegistry();
+ IWebSocketConnection connection = webSocketConnectionRegistry.getConnection(application, sessionId, key);
+
+ int dataIndex = 0;
+
+ while (dataIndex < data.length)
+ {
+ try
+ {
+ Record record = data[dataIndex++];
+ String json = String.format(JSON_SKELETON, record.year, record.field, record.value);
+
+ if (connection == null || !connection.isOpen())
+ {
+ // stop if the web socket connection is closed
+ return;
+ }
+ connection.sendMessage(json);
+
+ // sleep for a while to simulate work
+ TimeUnit.SECONDS.sleep(1);
+ }
+ catch (InterruptedException x)
+ {
+ Thread.currentThread().interrupt();
+ break;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * The data that is being sent to the client in JSON format
+ */
+ private static class Record
+ {
+ private int year;
+ private String field;
+ private int value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartWebSocketResource.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartWebSocketResource.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartWebSocketResource.java
new file mode 100644
index 0000000..a7468d6
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartWebSocketResource.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example.charts;
+
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.apache.wicket.protocol.ws.api.WebSocketResource;
+import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
+import org.apache.wicket.protocol.ws.example.JSR356Application;
+
+/**
+ *
+ */
+public class ChartWebSocketResource extends WebSocketResource
+{
+ public static final String NAME = ChartWebSocketResource.class.getName();
+
+ @Override
+ protected void onConnect(ConnectedMessage message)
+ {
+ super.onConnect(message);
+
+ ScheduledExecutorService service = JSR356Application.get().getScheduledExecutorService();
+ ChartUpdater.start(message, service);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartsResourceReference.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartsResourceReference.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartsResourceReference.java
new file mode 100644
index 0000000..fe0998d
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/ChartsResourceReference.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example.charts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.wicket.markup.head.HeaderItem;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.protocol.ws.api.WicketWebSocketJQueryResourceReference;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.resource.JavaScriptResourceReference;
+import org.apache.wicket.request.resource.UrlResourceReference;
+
+/**
+ * A resource reference that contributes 'charts.js' - the JavaScript that registers the WebSocket client
+ * and constructs the Google chart.
+ */
+public class ChartsResourceReference extends JavaScriptResourceReference
+{
+ public ChartsResourceReference()
+ {
+ super(ChartsResourceReference.class, "charts.js");
+ }
+
+ /**
+ * Specify that charts.js depends on Google JS APIs and Wicket WebSocket JavaScript
+ * @return a list of dependencies
+ */
+ @Override
+ public List<HeaderItem> getDependencies()
+ {
+ List<HeaderItem> dependencies = new ArrayList<HeaderItem>();
+ dependencies.add(JavaScriptHeaderItem.forReference(new UrlResourceReference(Url.parse("https://www.google.com/jsapi"))));
+ dependencies.add(JavaScriptHeaderItem.forReference(WicketWebSocketJQueryResourceReference.get()));
+ return dependencies;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.html b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.html
new file mode 100644
index 0000000..4f245b6
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.html
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+<wicket:panel>
+ <div id="chart_div"></div>
+</wicket:panel>
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.java b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.java
new file mode 100644
index 0000000..e47d8c9
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/WebSocketChart.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example.charts;
+
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.html.panel.Panel;
+
+/**
+ * A panel that initializes a Google Line chart and uses WebSocketBehavior to register an asynchronous
+ * task that will push some data through the web socket connection.
+ */
+public class WebSocketChart extends Panel
+{
+ public WebSocketChart(final String id)
+ {
+ super(id);
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response)
+ {
+ super.renderHead(response);
+ response.render(JavaScriptHeaderItem.forReference(new ChartsResourceReference()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/charts.js
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/charts.js b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/charts.js
new file mode 100644
index 0000000..501d9e0
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/java/org/apache/wicket/protocol/ws/example/charts/charts.js
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+google.load("visualization", "1", {
+ packages:["corechart"]
+});
+
+google.setOnLoadCallback(drawChart);
+
+function drawChart() {
+
+ var options = {
+ title: 'Stock prices'
+ };
+
+ var rawData = [
+ ['Year', 'Company 1', 'Company 2'],
+ ["1999", 0, 0]
+ ];
+
+ var chart;
+
+ /**
+ * (Re)Initializes the chart
+ */
+ var updateChart = function() {
+ var data = google.visualization.arrayToDataTable(rawData);
+ if (chart) {
+ chart.clearChart();
+ } else {
+ chart = new google.visualization.LineChart(Wicket.$('chart_div'));
+ }
+ chart.draw(data, options);
+ };
+
+ /**
+ * Updates the chart data by updating or appending the new data pushed by the server
+ *
+ * @param data the new data pushed by the server
+ */
+ var updateChartData = function(data) {
+
+ // the index of the column which data will be updated. Either 1 (Company 1) or 2 (Company 2)
+ var columnIndex = rawData[0].indexOf(data.field);
+
+ var replaced = false;
+
+ // look whether there is already a record for that year and update the data for the company
+ for (var r = 1; r < rawData.length; r++) {
+ var oldRecord = rawData[r];
+ if (oldRecord[0] === data.year) {
+ oldRecord[columnIndex] = data.value;
+ replaced = true;
+ break;
+ }
+ }
+
+ if (!replaced) {
+ // there is no update, so append the new data
+
+ // the data of the last appended record
+ var lastRecord = rawData[rawData.length - 1];
+
+ // the new record that keeps the same data as the last one but updates the value for the updated company
+ var newRecord = [data.year, lastRecord[1], lastRecord[2]];
+ newRecord[columnIndex] = data.value;
+ rawData.push(newRecord);
+ }
+
+ if (rawData.length > 20) {
+ // show at most 20 years back. The first record is special (the headers), so cut the second one
+ rawData.splice(1, 1);
+ }
+
+ updateChart();
+ };
+
+ Wicket.Event.subscribe("/websocket/open", function(jqEvent) {
+ // show the initial state of the chart
+ updateChart();
+ });
+
+ Wicket.Event.subscribe("/websocket/message", function(jqEvent, message) {
+ // new record is pushed by the server
+
+ var record = jQuery.parseJSON(message);
+ if (record && record.year) {
+ updateChartData(record);
+ }
+ });
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/resources/log4j.properties b/wicket-native-websocket/wicket-native-websocket-example/src/main/resources/log4j.properties
new file mode 100644
index 0000000..f9cafac
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/resources/log4j.properties
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n
+
+log4j.rootLogger=INFO,Stdout
+
+log4j.logger.org.apache.wicket=INFO
+log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
+log4j.logger.org.apache.wicket.version=INFO
+log4j.logger.org.apache.wicket.RequestCycle=INFO
+log4j.logger.org.apache.wicket.protocol.ws.javax=TRACE
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/WEB-INF/web.xml b/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..fec480d
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
+ version="3.1">
+
+ <display-name>wicket-native-websockets-example</display-name>
+
+ <filter>
+ <filter-name>wrapper</filter-name>
+ <filter-class>org.apache.wicket.protocol.ws.example.WrappingFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>wrapper</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <filter>
+ <filter-name>wicket.wicket-native-websockets</filter-name>
+ <!--<filter-class>org.apache.wicket.protocol.ws.jetty.Jetty7WebSocketFilter</filter-class>-->
+ <!--<filter-class>org.apache.wicket.protocol.ws.jetty9.Jetty9WebSocketFilter</filter-class>-->
+ <!--<filter-class>org.apache.wicket.protocol.ws.tomcat7.Tomcat7WebSocketFilter</filter-class>-->
+ <filter-class>org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter</filter-class>
+ <!--<filter-class>org.wicketstuff.protocol.ws.javax.JavaxWebSocketFilter</filter-class>-->
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.wicket.protocol.ws.example.JSR356Application</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>wicket.wicket-native-websockets</filter-name>
+ <!--<url-pattern>/ff/*</url-pattern>-->
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+</web-app>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/logo.png
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/logo.png b/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/logo.png
new file mode 100644
index 0000000..39ec548
Binary files /dev/null and b/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/logo.png differ
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/style.css
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/style.css b/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/style.css
new file mode 100644
index 0000000..185ecd4
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/main/webapp/style.css
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+body, p, li, a { font-family: georgia, times, serif;font-size:13pt;}
+h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; }
+body { margin:0;padding:0;}
+#hd {
+ width : 100%;
+ height : 87px;
+ background-color : #092E67;
+ margin-top : 0;
+ padding-top : 10px;
+ border-bottom : 1px solid #888;
+ z-index : 0;
+}
+#ft {
+ position : absolute;
+ bottom : 0;
+ width : 100%;
+ height : 99px;
+ background-color : #6493D2;
+ border-top : 1px solid #888;
+ z-index : 0;
+}
+#logo,#bd {
+ width : 650px;
+ margin: 0 auto;
+ padding: 25px 50px 0 50px;
+}
+#logo h1 {
+ color : white;
+ font-size:36pt;
+ display: inline;
+}
+#logo img {
+ display:inline;
+ vertical-align: bottom;
+ margin-left : 50px;
+ margin-right : 5px;
+}
+body { margin-top : 0; padding-top : 0;}
+#logo, #logo h1 { margin-top : 0; padding-top : 0;}
+#bd {
+ position : absolute;
+ top : 75px;
+ bottom : 75px;
+ left : 50%;
+ margin-left : -325px;
+ z-index : 1;
+ overflow: auto;
+ background-color : #fff;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ -moz-box-shadow: 0px 0px 10px #888;
+ -webkit-box-shadow: 0px 0px 10px #888;
+ box-shadow: 0px 0px 10px #888;
+}
+a, a:visited, a:hover, a:active {
+ color : #6493D2;
+}
+h2 {
+ padding : 0; margin:0;
+ font-size:36pt;
+ color:#FF5500;
+}
+h3 {
+ padding : 0; margin:0;
+ font-size:24pt;
+ color:#092E67;
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/ApacheLicenceHeaderTest.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/ApacheLicenceHeaderTest.java b/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/ApacheLicenceHeaderTest.java
new file mode 100644
index 0000000..a145cc6
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/ApacheLicenceHeaderTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example;
+
+import org.apache.wicket.util.license.ApacheLicenseHeaderTestCase;
+
+/**
+ * Test that the license headers are in place in this project. The tests are run from
+ * {@link ApacheLicenseHeaderTestCase}, but you can add project specific tests here if needed.
+ */
+public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase
+{
+ /**
+ * Construct.
+ */
+ public ApacheLicenceHeaderTest()
+ {
+ // addHeaders = true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/StartNativeWebSocketExample.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/StartNativeWebSocketExample.java b/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/StartNativeWebSocketExample.java
new file mode 100644
index 0000000..22a5df0
--- /dev/null
+++ b/wicket-native-websocket/wicket-native-websocket-example/src/test/java/org/apache/wicket/protocol/ws/example/StartNativeWebSocketExample.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.protocol.ws.example;
+
+import org.apache.wicket.protocol.ws.javax.WicketServerEndpointConfig;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.SecureRequestCustomizer;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.websocket.jsr356.server.ServerContainer;
+import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
+
+public class StartNativeWebSocketExample
+{
+ public static void main(String[] args) throws Exception
+ {
+ HttpConfiguration http_config = new HttpConfiguration();
+ http_config.setSecureScheme("https");
+ http_config.setSecurePort(8443);
+ http_config.setOutputBufferSize(32768);
+ http_config.setRequestHeaderSize(8192);
+ http_config.setResponseHeaderSize(8192);
+ http_config.setSendServerVersion(true);
+ http_config.setSendDateHeader(false);
+
+ Server server = new Server();
+ ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(http_config));
+
+ // Set some timeout options to make debugging easier.
+// connector.setMaxIdleTime(timeout);
+ connector.setSoLingerTime(-1);
+ connector.setPort(8080);
+ server.addConnector(connector);
+
+ Resource keystore = Resource.newClassPathResource("/keystore");
+ if (keystore != null && keystore.exists()) {
+ // if a keystore for a SSL certificate is available, start a SSL
+ // connector on port 8443.
+ // By default, the quickstart comes with a Apache Wicket Quickstart
+ // Certificate that expires about half way september 2021. Do not
+ // use this certificate anywhere important as the passwords are
+ // available in the source.
+
+ SslContextFactory factory = new SslContextFactory();
+ factory.setKeyStoreResource(keystore);
+ factory.setKeyStorePassword("wicket");
+ factory.setTrustStoreResource(keystore);
+ factory.setKeyManagerPassword("wicket");
+
+ // SSL HTTP Configuration
+ HttpConfiguration https_config = new HttpConfiguration(http_config);
+ https_config.addCustomizer(new SecureRequestCustomizer());
+
+ // SSL Connector
+ ServerConnector sslConnector = new ServerConnector(server,
+ new SslConnectionFactory(factory,"http/1.1"),
+ new HttpConnectionFactory(https_config));
+ sslConnector.setPort(8443);
+ server.addConnector(sslConnector);
+
+ System.out.println("SSL access to the quickstart has been enabled on port 8443");
+ System.out.println("You can access the application using SSL on https://localhost:8443");
+ System.out.println();
+ }
+
+ WebAppContext bb = new WebAppContext();
+ bb.setServer(server);
+ bb.setContextPath("/");
+// bb.setExtraClasspath("target/classes");
+ bb.setWar("src/main/webapp");
+// bb.getMetaData().addContainerResource(new FileResource(new File("./target/classes").toURI()));
+// bb.setConfigurations(new Configuration[]{
+// new WebXmlConfiguration(),
+// new AnnotationConfiguration()
+// });
+// ServletContainerInitializersStarter starter = new ServletContainerInitializersStarter(bb);
+// starter.doStart();
+
+ ServerContainer serverContainer = WebSocketServerContainerInitializer.configureContext(bb);
+ serverContainer.addEndpoint(new WicketServerEndpointConfig());
+// WebSocketUpgradeFilter upgradeFilter =
+// (WebSocketUpgradeFilter) webAppContext.getAttribute(WebSocketUpgradeFilter.class.getName());
+// upgradeFilter.getFactory().getPolicy().setIdleTimeout(5000);
+
+ // START JMX SERVER
+ // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
+ // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
+ // server.getContainer().addEventListener(mBeanContainer);
+ // mBeanContainer.start();
+
+ server.setHandler(bb);
+
+ try {
+ System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
+ server.start();
+ System.in.read();
+ System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
+ server.stop();
+ server.join();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-example/src/test/resources/keystore
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-example/src/test/resources/keystore b/wicket-native-websocket/wicket-native-websocket-example/src/test/resources/keystore
new file mode 100644
index 0000000..30bbc90
Binary files /dev/null and b/wicket-native-websocket/wicket-native-websocket-example/src/test/resources/keystore differ
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/log4j.properties
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/log4j.properties b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/log4j.properties
deleted file mode 100644
index 976b5c8..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/log4j.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-log4j.debug=false
-
-log4j.rootLogger=INFO,Stdout
-
-# please keep this setting FATAL to avoid questions from users
-# why there are stacktraces in the test output. You can turn it
-# down if you need to when testing, but don't check it in. (eelco)
-
-# changing back to ERROR. Looks like in some cases the log4j.properties
-# in wicket gets picked which results in not printing the exceptions
-# and that can be a bit dangerous (matej)
-log4j.logger.org.apache.wicket=ERROR
-
-log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/Start.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/Start.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/Start.java
deleted file mode 100644
index f1e6237..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/Start.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax;
-
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.SecureRequestCustomizer;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.SslConnectionFactory;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
-
-public class Start
-{
- public static void main(String[] args) throws Exception
- {
- HttpConfiguration http_config = new HttpConfiguration();
- http_config.setSecureScheme("https");
- http_config.setSecurePort(8443);
- http_config.setOutputBufferSize(32768);
- http_config.setRequestHeaderSize(8192);
- http_config.setResponseHeaderSize(8192);
- http_config.setSendServerVersion(true);
- http_config.setSendDateHeader(false);
-
- Server server = new Server();
- ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(http_config));
-
- // Set some timeout options to make debugging easier.
- connector.setSoLingerTime(-1);
- connector.setPort(8080);
- server.addConnector(connector);
-
- Resource keystore = Resource.newClassPathResource("/keystore");
- if (keystore != null && keystore.exists()) {
- // if a keystore for a SSL certificate is available, start a SSL
- // connector on port 8443.
- // By default, the quickstart comes with a Apache Wicket Quickstart
- // Certificate that expires about half way september 2021. Do not
- // use this certificate anywhere important as the passwords are
- // available in the source.
-
- SslContextFactory factory = new SslContextFactory();
- factory.setKeyStoreResource(keystore);
- factory.setKeyStorePassword("wicket");
- factory.setTrustStoreResource(keystore);
- factory.setKeyManagerPassword("wicket");
-
- // SSL HTTP Configuration
- HttpConfiguration https_config = new HttpConfiguration(http_config);
- https_config.addCustomizer(new SecureRequestCustomizer());
-
- // SSL Connector
- ServerConnector sslConnector = new ServerConnector(server,
- new SslConnectionFactory(factory,"http/1.1"),
- new HttpConnectionFactory(https_config));
- sslConnector.setPort(8443);
- server.addConnector(sslConnector);
-
- System.out.println("SSL access to the quickstart has been enabled on port 8443");
- System.out.println("You can access the application using SSL on https://localhost:8443");
- System.out.println();
- }
-
- WebAppContext bb = new WebAppContext();
-
- bb.setServer(server);
- bb.setContextPath("/");
- bb.setWar("src/test/webapp");
-
-
- WebSocketServerContainerInitializer.configureContext(bb);
-
- // START JMX SERVER
- // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
- // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
- // server.getContainer().addEventListener(mBeanContainer);
- // mBeanContainer.start();
-
- server.setHandler(bb);
-
- try {
-// bb.dumpStdErr();
- System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
- server.start();
- System.in.read();
- System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
- server.stop();
- server.join();
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(1);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.html b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.html
deleted file mode 100644
index c7de054..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
- <head>
- <meta charset="utf-8" />
- <title>Apache Wicket Quickstart</title>
- <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
- <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
- </head>
- <body>
- <div id="hd">
- <div id="logo">
- <img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
- <h1>Apache Wicket</h1>
- </div>
- </div>
- <wicket:link>
- <ul>
- <li><a href="WebSocketBehaviorDemoPage.html">demo with WebSocketBehavior</a></li>
- <li><a href="WebSocketResourceDemoPage.html">demo with WebSocketResource</a></li>
- </ul>
- </wicket:link>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.java
deleted file mode 100644
index 62db885..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/HomePage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app;
-
-import org.apache.wicket.markup.html.WebPage;
-
-//@RequireHttps
-public class HomePage extends WebPage
-{
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/JSR356Application.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/JSR356Application.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/JSR356Application.java
deleted file mode 100644
index 9cef063..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/JSR356Application.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app;
-
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.protocol.https.HttpsConfig;
-import org.apache.wicket.protocol.https.HttpsMapper;
-import org.apache.wicket.protocol.ws.javax.app.charts.ChartWebSocketResource;
-
-/**
- * Application object for your web application. If you want to run this application without deploying, run the Start class.
- *
- * @see org.apache.wicket.protocol.ws.javax.Start#main(String[])
- */
-public class JSR356Application extends WebApplication
-{
- /**
- * @see org.apache.wicket.Application#getHomePage()
- */
- @Override
- public Class<HomePage> getHomePage()
- {
- return HomePage.class;
- }
-
- /**
- * @see org.apache.wicket.Application#init()
- */
- @Override
- public void init()
- {
- super.init();
-
- mountPage("/behavior", WebSocketBehaviorDemoPage.class);
- mountPage("/resource", WebSocketResourceDemoPage.class);
-
- setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig()));
-
- getSharedResources().add(ChartWebSocketResource.NAME, new ChartWebSocketResource());
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.html b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.html
deleted file mode 100644
index efb084d..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
- <head>
- <meta charset="utf-8" />
- <title>Apache Wicket Quickstart</title>
- <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
- <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
- </head>
- <body>
- <div id="hd">
- <div id="logo">
- <img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
- <h1>Apache Wicket</h1>
- </div>
- </div>
- <div wicket:id="chartPanel"></div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.java
deleted file mode 100644
index 846ef04..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketBehaviorDemoPage.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.protocol.ws.api.WebSocketBehavior;
-import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
-import org.apache.wicket.protocol.ws.javax.app.charts.ChartUpdater;
-import org.apache.wicket.protocol.ws.javax.app.charts.WebSocketChart;
-
-//@RequireHttps
-public class WebSocketBehaviorDemoPage extends WebPage
-{
- public WebSocketBehaviorDemoPage()
- {
- WebSocketChart chartPanel = new WebSocketChart("chartPanel");
- chartPanel.add(new WebSocketBehavior()
- {
- @Override
- protected void onConnect(ConnectedMessage message)
- {
- super.onConnect(message);
-
- ChartUpdater.start(message);
- }
- });
- add(chartPanel);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.html
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.html b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.html
deleted file mode 100644
index efb084d..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
- <head>
- <meta charset="utf-8" />
- <title>Apache Wicket Quickstart</title>
- <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
- <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
- </head>
- <body>
- <div id="hd">
- <div id="logo">
- <img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
- <h1>Apache Wicket</h1>
- </div>
- </div>
- <div wicket:id="chartPanel"></div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.java
deleted file mode 100644
index 75f7855..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/WebSocketResourceDemoPage.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.protocol.ws.api.BaseWebSocketBehavior;
-import org.apache.wicket.protocol.ws.javax.app.charts.ChartWebSocketResource;
-import org.apache.wicket.protocol.ws.javax.app.charts.WebSocketChart;
-
-public class WebSocketResourceDemoPage extends WebPage
-{
- public WebSocketResourceDemoPage()
- {
- WebSocketChart chartPanel = new WebSocketChart("chartPanel");
- chartPanel.add(new BaseWebSocketBehavior(ChartWebSocketResource.NAME));
- add(chartPanel);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4b600a20/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartUpdater.java
----------------------------------------------------------------------
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartUpdater.java b/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartUpdater.java
deleted file mode 100644
index d83f72d..0000000
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/test/java/org/apache/wicket/protocol/ws/javax/app/charts/ChartUpdater.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.ws.javax.app.charts;
-
-import java.util.Random;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.protocol.ws.WebSocketSettings;
-import org.apache.wicket.protocol.ws.api.IWebSocketConnection;
-import org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry;
-import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
-import org.apache.wicket.protocol.ws.api.registry.IKey;
-
-/**
- * A helper class that uses the web connection to push data to the
- * client.
- * To keep the demo simpler it doesn't use #onClose() to stop
- * the thread.
- */
-public class ChartUpdater
-{
- public static void start(ConnectedMessage message)
- {
- Record[] data = generateData();
-
- // create an asynchronous task that will write the data to the client
- UpdateTask updateTask = new UpdateTask(message.getApplication(), message.getSessionId(), message.getKey(), data);
- Executors.newScheduledThreadPool(1).schedule(updateTask, 1, TimeUnit.SECONDS);
- }
-
- /**
- * Generates some random data to send to the client
- * @return records with random data
- */
- private static Record[] generateData()
- {
- Random randomGenerator = new Random();
- Record[] data = new Record[1000];
- for (int i = 0; i < 1000; i++)
- {
- Record r = new Record();
- r.year = 2000 + i;
- r.field = (i % 2 == 0) ? "Company 1" : "Company 2";
- r.value = randomGenerator.nextInt(1500);
- data[i] = r;
- }
- return data;
- }
-
-
- /**
- * A task that sends data to the client by pushing it to the web socket connection
- */
- private static class UpdateTask implements Runnable
- {
- private static final String JSON_SKELETON = "{ \"year\": \"%s\", \"field\": \"%s\", \"value\": %s }";
-
- /**
- * The following fields are needed to be able to lookup the IWebSocketConnection from
- * IWebSocketConnectionRegistry
- */
- private final String applicationName;
- private final String sessionId;
- private final IKey key;
-
- /**
- * The data that has to be sent to the client
- */
- private final Record[] data;
-
- private UpdateTask(Application application, String sessionId, IKey key, Record[] data)
- {
- this.applicationName = application.getName();
- this.sessionId = sessionId;
- this.key = key;
- this.data = data;
- }
-
- @Override
- public void run()
- {
- Application application = Application.get(applicationName);
- WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
- IWebSocketConnectionRegistry webSocketConnectionRegistry = webSocketSettings.getConnectionRegistry();
- IWebSocketConnection connection = webSocketConnectionRegistry.getConnection(application, sessionId, key);
-
- int dataIndex = 0;
-
- while (dataIndex < data.length)
- {
- try
- {
- Record record = data[dataIndex++];
- String json = String.format(JSON_SKELETON, record.year, record.field, record.value);
-
- if (connection == null || !connection.isOpen())
- {
- // stop if the web socket connection is closed
- return;
- }
- connection.sendMessage(json);
-
- // sleep for a while to simulate work
- TimeUnit.SECONDS.sleep(1);
- }
- catch (Exception x)
- {
- x.printStackTrace();
- return;
- }
- }
- }
- }
-
- /**
- * The data that is being sent to the client in JSON format
- */
- private static class Record
- {
- private int year;
- private String field;
- private int value;
- }
-}
[3/3] wicket git commit: Minor improvements to
ApacheLicenseHeaderTestCase
Posted by mg...@apache.org.
Minor improvements to ApacheLicenseHeaderTestCase
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/39047545
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/39047545
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/39047545
Branch: refs/heads/master
Commit: 390475455a512819287f27467d3e17ceeb7d7f6c
Parents: a42a27b
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Nov 15 22:35:51 2016 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Nov 15 22:39:12 2016 +0100
----------------------------------------------------------------------
.../util/license/ApacheLicenseHeaderTestCase.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/39047545/wicket-util/src/main/java/org/apache/wicket/util/license/ApacheLicenseHeaderTestCase.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/license/ApacheLicenseHeaderTestCase.java b/wicket-util/src/main/java/org/apache/wicket/util/license/ApacheLicenseHeaderTestCase.java
index be04817..b39e7c3 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/license/ApacheLicenseHeaderTestCase.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/license/ApacheLicenseHeaderTestCase.java
@@ -45,7 +45,7 @@ public abstract class ApacheLicenseHeaderTestCase extends Assert
private static final String LINE_ENDING = System.getProperty("line.separator");
- static interface FileVisitor
+ interface FileVisitor
{
/**
* @param file
@@ -83,13 +83,13 @@ public abstract class ApacheLicenseHeaderTestCase extends Assert
}
else
{
- log.info("File ignored: '{}'", pathname.toString());
+ log.debug("File ignored: '{}'", pathname);
}
}
}
else
{
- log.info("File ignored: '{}'", pathname.toString());
+ log.debug("File ignored: '{}'", pathname);
}
}
@@ -146,7 +146,7 @@ public abstract class ApacheLicenseHeaderTestCase extends Assert
private class DirectoryFileFilter implements FileFilter
{
- private final String[] ignoreDirectory = new String[] { ".svn" };
+ private final String[] ignoreDirectory = new String[] { ".git" };
@Override
public boolean accept(final File pathname)
@@ -159,7 +159,7 @@ public abstract class ApacheLicenseHeaderTestCase extends Assert
relativePathname = Strings.replaceAll(relativePathname,
baseDirectory.getAbsolutePath() + System.getProperty("file.separator"), "")
.toString();
- if (relativePathname.equals("target") == false)
+ if ("target".equals(relativePathname) == false)
{
boolean found = false;
for (String ignore : ignoreDirectory)
@@ -307,7 +307,7 @@ public abstract class ApacheLicenseHeaderTestCase extends Assert
ILicenseHeaderHandler licenseHeaderHandler = entry.getKey();
List<File> fileList = entry.getValue();
- failString.append("\n");
+ failString.append('\n');
failString.append(licenseHeaderHandler.getClass().getName());
failString.append(" failed. The following files(");
failString.append(fileList.size());
@@ -329,7 +329,7 @@ public abstract class ApacheLicenseHeaderTestCase extends Assert
failString.append(licenseType);
}
- failString.append(" ").append(filename).append(LINE_ENDING);
+ failString.append(' ').append(filename).append(LINE_ENDING);
}
}