This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch wicket-9.x
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/wicket-9.x by this push:
new 0fdaba6089 [WICKET-7070] quickstart should be fixed (#604)
0fdaba6089 is described below
commit 0fdaba6089176714f61c28e2e97c0fcc95eb791f
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Sat Aug 26 13:07:09 2023 +0700
[WICKET-7070] quickstart should be fixed (#604)
* [WICKET-7070] quickstart should be fixed
* Commented duplicated code is removed
---
.../src/main/resources/archetype-resources/pom.xml | 19 ++++++++++++-
.../archetype-resources/src/test/java/Start.java | 32 +++++++++++++++++-----
.../src/test/jetty/jetty-http.xml | 2 +-
.../src/test/jetty/jetty-https.xml | 2 +-
.../src/test/jetty/jetty-ssl.xml | 2 +-
.../archetype-resources/src/test/jetty/jetty.xml | 2 +-
6 files changed, 47 insertions(+), 12 deletions(-)
diff --git
a/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
b/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
index a8488ad9ec..ff7bdfce86 100644
--- a/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
@@ -57,6 +57,11 @@
<artifactId>wicket-core</artifactId>
<version>${wicket.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-native-websocket-javax</artifactId>
+ <version>${wicket.version}</version>
+ </dependency>
<!-- OPTIONAL DEPENDENCY
<dependency>
<groupId>org.apache.wicket</groupId>
@@ -83,9 +88,15 @@
<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
+ <artifactId>jetty-server</artifactId>
+ <version>${jetty9.version}</version>
<scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
<version>${jetty9.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@@ -93,6 +104,12 @@
<version>${jetty9.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.websocket</groupId>
+ <artifactId>javax-websocket-server-impl</artifactId>
+ <version>${jetty9.version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- uncomment if WebSocket support is needed
<dependency>
diff --git
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java
index 37d546a9a8..198cc89f1c 100644
---
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java
+++
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java
@@ -1,9 +1,26 @@
+/*
+ * 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 ${package};
import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
+import org.apache.wicket.protocol.ws.javax.WicketServerEndpointConfig;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
@@ -14,6 +31,8 @@ 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;
/**
* Separate startup class for people that want to run the examples directly.
Use parameter
@@ -26,7 +45,7 @@ public class Start
*
* @param args
*/
- public static void main(String[] args)
+ public static void main(String[] args) throws Exception
{
System.setProperty("wicket.configuration", "development");
@@ -43,7 +62,7 @@ public class Start
server.addConnector(http);
- Resource keystore =
Resource.newClassPathResource("/keystore.p12");
+ Resource keystore = Resource.newClassPathResource("/keystore");
if (keystore != null && keystore.exists())
{
// if a keystore for a SSL certificate is available,
start a SSL
@@ -53,7 +72,7 @@ public class Start
// use this certificate anywhere important as the
passwords are
// available in the source.
- SslContextFactory sslContextFactory = new
SslContextFactory();
+ SslContextFactory sslContextFactory = new
SslContextFactory.Server();
sslContextFactory.setKeyStoreResource(keystore);
sslContextFactory.setKeyStorePassword("wicket");
sslContextFactory.setKeyManagerPassword("wicket");
@@ -78,11 +97,10 @@ public class Start
bb.setContextPath("/");
bb.setWar("src/main/webapp");
- // uncomment the next two lines if you want to start Jetty with
WebSocket (JSR-356) support
- // you need org.apache.wicket:wicket-native-websocket-javax in
the classpath!
- // ServerContainer serverContainer =
WebSocketServerContainerInitializer.configureContext(bb);
- // serverContainer.addEndpoint(new
WicketServerEndpointConfig());
+ // bb.getSessionHandler().setSessionCache(sessionCache);
+ ServerContainer serverContainer =
WebSocketServerContainerInitializer.initialize(bb);
+ serverContainer.addEndpoint(new WicketServerEndpointConfig());
// uncomment next line if you want to test with JSESSIONID
encoded in the urls
// ((AbstractSessionManager)
//
bb.getSessionHandler().getSessionManager()).setUsingCookies(false);
diff --git
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-http.xml
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-http.xml
index 7b39acb61c..51a50ff71f 100644
---
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-http.xml
+++
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-http.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd">
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_3.dtd">
<!-- ============================================================= -->
<!-- Configure the Jetty Server instance with an ID "Server" -->
<!-- by adding a HTTP connector. -->
diff --git
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-https.xml
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-https.xml
index 35100e7c5d..c709c55e9c 100644
---
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-https.xml
+++
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-https.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd">
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_3.dtd">
<!-- ============================================================= -->
<!-- Configure a HTTPS connector. -->
<!-- This configuration must be used in conjunction with jetty.xml -->
diff --git
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-ssl.xml
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-ssl.xml
index f23231bd72..af93d25154 100644
---
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-ssl.xml
+++
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty-ssl.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd">
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_3.dtd">
<!-- ============================================================= -->
<!-- Configure a TLS (SSL) Context Factory -->
<!-- This configuration must be used in conjunction with jetty.xml -->
diff --git
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty.xml
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty.xml
index fca91396f9..c1c8caa7b9 100644
---
a/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty.xml
+++
b/archetypes/quickstart/src/main/resources/archetype-resources/src/test/jetty/jetty.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd">
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_3.dtd">
<!-- ============================================================= -->
<!-- Configure a HTTP connector. -->
<!-- ============================================================= -->