Skip to content

Commit

Permalink
[WICKET-7070] quickstart should be fixed (#604)
Browse files Browse the repository at this point in the history
* [WICKET-7070] quickstart should be fixed

* Commented duplicated code is removed
  • Loading branch information
solomax authored Aug 26, 2023
1 parent d4ca66c commit 0fdaba6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -83,16 +88,28 @@
<!-- 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>
<artifactId>jetty-jmx</artifactId>
<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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,6 +31,8 @@
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
Expand All @@ -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");

Expand All @@ -43,7 +62,7 @@ public static void main(String[] args)

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
Expand All @@ -53,7 +72,7 @@ public static void main(String[] args)
// 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");
Expand All @@ -78,11 +97,10 @@ public static void main(String[] args)
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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 -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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 -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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.                                  -->
<!-- ============================================================= -->
Expand Down

0 comments on commit 0fdaba6

Please sign in to comment.