diff --git a/wicket-intro/CafeAddress/src/test/java/com/baeldung/wicket/examples/cafeaddress/Start.java b/wicket-intro/CafeAddress/src/test/java/com/baeldung/wicket/examples/cafeaddress/Start.java
index b2be405124..bb67ac56a5 100644
--- a/wicket-intro/CafeAddress/src/test/java/com/baeldung/wicket/examples/cafeaddress/Start.java
+++ b/wicket-intro/CafeAddress/src/test/java/com/baeldung/wicket/examples/cafeaddress/Start.java
@@ -19,90 +19,82 @@ import org.eclipse.jetty.webapp.WebAppContext;
* Separate startup class for people that want to run the examples directly. Use parameter
* -Dcom.sun.management.jmxremote to startup JMX (and e.g. connect with jconsole).
*/
-public class Start
-{
- /**
- * Main function, starts the jetty server.
- *
- * @param args
- */
- public static void main(String[] args)
- {
- System.setProperty("wicket.configuration", "development");
+public class Start {
+ /**
+ * Main function, starts the jetty server.
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ System.setProperty("wicket.configuration", "development");
- Server server = new Server();
+ Server server = new Server();
- HttpConfiguration http_config = new HttpConfiguration();
- http_config.setSecureScheme("https");
- http_config.setSecurePort(8443);
- http_config.setOutputBufferSize(32768);
+ HttpConfiguration http_config = new HttpConfiguration();
+ http_config.setSecureScheme("https");
+ http_config.setSecurePort(8443);
+ http_config.setOutputBufferSize(32768);
- ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
- http.setPort(8080);
- http.setIdleTimeout(1000 * 60 * 60);
+ ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
+ http.setPort(8080);
+ http.setIdleTimeout(1000 * 60 * 60);
- server.addConnector(http);
+ server.addConnector(http);
- 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.
+ 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 sslContextFactory = new SslContextFactory();
- sslContextFactory.setKeyStoreResource(keystore);
- sslContextFactory.setKeyStorePassword("wicket");
- sslContextFactory.setKeyManagerPassword("wicket");
+ SslContextFactory sslContextFactory = new SslContextFactory();
+ sslContextFactory.setKeyStoreResource(keystore);
+ sslContextFactory.setKeyStorePassword("wicket");
+ sslContextFactory.setKeyManagerPassword("wicket");
- HttpConfiguration https_config = new HttpConfiguration(http_config);
- https_config.addCustomizer(new SecureRequestCustomizer());
+ HttpConfiguration https_config = new HttpConfiguration(http_config);
+ https_config.addCustomizer(new SecureRequestCustomizer());
- ServerConnector https = new ServerConnector(server, new SslConnectionFactory(
- sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config));
- https.setPort(8443);
- https.setIdleTimeout(500000);
+ ServerConnector https = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config));
+ https.setPort(8443);
+ https.setIdleTimeout(500000);
- server.addConnector(https);
- System.out.println("SSL access to the examples has been enabled on port 8443");
- System.out
- .println("You can access the application using SSL on https://localhost:8443");
- System.out.println();
- }
+ server.addConnector(https);
+ System.out.println("SSL access to the examples 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/main/webapp");
+ WebAppContext bb = new WebAppContext();
+ bb.setServer(server);
+ 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());
+ // 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());
- // uncomment next line if you want to test with JSESSIONID encoded in the urls
- // ((AbstractSessionManager)
- // bb.getSessionHandler().getSessionManager()).setUsingCookies(false);
+ // uncomment next line if you want to test with JSESSIONID encoded in the urls
+ // ((AbstractSessionManager)
+ // bb.getSessionHandler().getSessionManager()).setUsingCookies(false);
- server.setHandler(bb);
+ server.setHandler(bb);
- MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
- MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
- server.addEventListener(mBeanContainer);
- server.addBean(mBeanContainer);
+ MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
+ MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
+ server.addEventListener(mBeanContainer);
+ server.addBean(mBeanContainer);
- try
- {
- server.start();
- server.join();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(100);
- }
- }
+ try {
+ server.start();
+ server.join();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(100);
+ }
+ }
}
diff --git a/wicket-intro/WicketIntro/pom.xml b/wicket-intro/WicketIntro/pom.xml
new file mode 100644
index 0000000000..9b759eb1be
--- /dev/null
+++ b/wicket-intro/WicketIntro/pom.xml
@@ -0,0 +1,136 @@
+
+
+
+ 4.0.0
+ com.baeldung.wicket.examples
+ wicket-intro
+ war
+ 1.0-SNAPSHOT
+ WicketIntro
+
+ 7.4.0
+ 9.2.13.v20150730
+ 2.5
+ 4.12
+ 4.1.1.RELEASE
+ 3.1.0
+ 8.0.0-M1
+ 3.5.1
+ 2.6
+ UTF-8
+ none
+
+
+
+
+ org.apache.wicket
+ wicket-core
+ ${wicket.version}
+
+
+
+
+
+ org.springframework
+ spring-web
+ ${spring-web.version}
+
+
+ javax.servlet
+ javax.servlet-api
+ ${javax.servlet-api.version}
+
+
+ org.apache.wicket
+ wicket-spring
+ ${wicket-spring.version}
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+
+
+ org.eclipse.jetty.aggregate
+ jetty-all
+ ${jetty9.version}
+ test
+
+
+
+ WicketIntro
+
+
+ false
+ src/main/resources
+
+
+ false
+ src/main/java
+
+ **
+
+
+ **/*.java
+
+
+
+
+
+ true
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ 1.8
+ UTF-8
+ true
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ ${maven-war-plugin.version}
+
+ false
+
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+ ${jetty9.version}
+
+
+
+ maven.project.build.directory.test-classes
+ ${project.build.directory}/test-classes
+
+
+ ${project.basedir}/src/test/jetty/jetty.xml,${project.basedir}/src/test/jetty/jetty-ssl.xml,${project.basedir}/src/test/jetty/jetty-http.xml,${project.basedir}/src/test/jetty/jetty-https.xml
+
+
+
+
+
+
+
+ Apache Nexus
+ https://repository.apache.org/content/repositories/snapshots/
+
+ false
+
+
+ true
+
+
+
+
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ApplicationConfiguration.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ApplicationConfiguration.java
new file mode 100644
index 0000000000..2b42af9065
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ApplicationConfiguration.java
@@ -0,0 +1,10 @@
+package com.baeldung.wicket.examples;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ComponentScan
+public class ApplicationConfiguration {
+
+}
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.html b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.html
new file mode 100644
index 0000000000..38eebbffe0
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.html
@@ -0,0 +1,52 @@
+
+
+
+
+Wicket Intro Examples
+
+
+
+
+
+
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.java
new file mode 100644
index 0000000000..358e4f7b19
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.java
@@ -0,0 +1,9 @@
+package com.baeldung.wicket.examples;
+
+import org.apache.wicket.markup.html.WebPage;
+
+public class Examples extends WebPage {
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java
new file mode 100644
index 0000000000..711e8f01fd
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java
@@ -0,0 +1,27 @@
+package com.baeldung.wicket.examples;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.protocol.http.WebApplication;
+
+import com.baeldung.wicket.examples.cafeaddress.CafeAddress;
+import com.baeldung.wicket.examples.helloworld.HelloWorld;
+
+public class ExamplesApplication extends WebApplication {
+ /**
+ * @see org.apache.wicket.Application#getHomePage()
+ */
+ @Override
+ public Class extends WebPage> getHomePage() {
+ return Examples.class;
+ }
+
+ /**
+ * @see org.apache.wicket.Application#init()
+ */
+ @Override
+ public void init() {
+ super.init();
+ mountPage("/examples/helloworld", HelloWorld.class);
+ mountPage("/examples/cafes", CafeAddress.class);
+ }
+}
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/WebAppInitializer.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/WebAppInitializer.java
new file mode 100644
index 0000000000..1b2d06d2dc
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/WebAppInitializer.java
@@ -0,0 +1,26 @@
+package com.baeldung.wicket.examples;
+
+import javax.servlet.FilterRegistration;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.wicket.protocol.http.WicketFilter;
+import org.springframework.web.WebApplicationInitializer;
+import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
+
+public class WebAppInitializer implements WebApplicationInitializer {
+
+ @Override
+ public void onStartup(ServletContext container) throws ServletException {
+ AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
+ container.addListener(new ContextLoaderListener(context));
+ context.register(ApplicationConfiguration.class);
+
+ FilterRegistration filter = container.addFilter("ExamplesApplication", WicketFilter.class);
+ filter.setInitParameter("applicationClassName", ExamplesApplication.class.getName());
+ filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
+ filter.addMappingForUrlPatterns(null, false, "/*");
+ }
+
+}
\ No newline at end of file
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html
new file mode 100644
index 0000000000..b7e0368eaa
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html
@@ -0,0 +1,15 @@
+
+
+
+
+Cafes
+
+
+
+
+
+ Address: address
+
+
+
+
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java
new file mode 100644
index 0000000000..ce26c5a1ad
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java
@@ -0,0 +1,72 @@
+package com.baeldung.wicket.examples.cafeaddress;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+public class CafeAddress extends WebPage {
+
+ private static final long serialVersionUID = 1L;
+
+ String selectedCafe;
+ Address address;
+ Map cafeNamesAndAddresses = new HashMap<>();
+
+ public CafeAddress(final PageParameters parameters) {
+ super(parameters);
+ initCafes();
+
+ ArrayList cafeNames = new ArrayList<>(this.cafeNamesAndAddresses.keySet());
+ this.selectedCafe = cafeNames.get(0);
+ this.address = new Address(this.cafeNamesAndAddresses.get(this.selectedCafe).getAddress());
+
+ final Label addressLabel = new Label("address", new PropertyModel(this.address, "address"));
+ addressLabel.setOutputMarkupId(true);
+
+ final DropDownChoice cafeDropdown = new DropDownChoice<>("cafes", new PropertyModel(this, "selectedCafe"), cafeNames);
+ cafeDropdown.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onUpdate(AjaxRequestTarget target) {
+ String name = (String) cafeDropdown.getDefaultModel().getObject();
+ address.setAddress(cafeNamesAndAddresses.get(name).getAddress());
+ target.add(addressLabel);
+ }
+ });
+
+ add(addressLabel);
+ add(cafeDropdown);
+
+ }
+
+ private void initCafes() {
+ this.cafeNamesAndAddresses.put("Linda's Cafe", new Address("35 Bower St."));
+ this.cafeNamesAndAddresses.put("Old Tree", new Address("2 Edgware Rd."));
+ }
+
+ class Address implements Serializable {
+ private String sAddress = "";
+
+ public Address(String address) {
+ this.sAddress = address;
+ }
+
+ public String getAddress() {
+ return this.sAddress;
+ }
+
+ public void setAddress(String address) {
+ this.sAddress = address;
+ }
+ }
+}
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html
new file mode 100644
index 0000000000..c56d07fc10
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..f819e05be6
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java
@@ -0,0 +1,13 @@
+package com.baeldung.wicket.examples.helloworld;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+
+public class HelloWorld extends WebPage {
+
+ private static final long serialVersionUID = 1L;
+
+ public HelloWorld() {
+ add(new Label("hello", "Hello World!"));
+ }
+}
diff --git a/wicket-intro/WicketIntro/src/test/jetty/jetty-http.xml b/wicket-intro/WicketIntro/src/test/jetty/jetty-http.xml
new file mode 100644
index 0000000000..9f3256b15c
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/test/jetty/jetty-http.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wicket-intro/WicketIntro/src/test/jetty/jetty-https.xml b/wicket-intro/WicketIntro/src/test/jetty/jetty-https.xml
new file mode 100644
index 0000000000..58f7d53d2d
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/test/jetty/jetty-https.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+ http/1.1
+
+
+
+ -
+
+
+
+
+
+
+
+
+ 30000
+
+
+
+
\ No newline at end of file
diff --git a/wicket-intro/WicketIntro/src/test/jetty/jetty-ssl.xml b/wicket-intro/WicketIntro/src/test/jetty/jetty-ssl.xml
new file mode 100644
index 0000000000..49e558bb47
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/test/jetty/jetty-ssl.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+ /
+
+
+
+
+
+ - SSL_RSA_WITH_DES_CBC_SHA
+ - SSL_DHE_RSA_WITH_DES_CBC_SHA
+ - SSL_DHE_DSS_WITH_DES_CBC_SHA
+ - SSL_RSA_EXPORT_WITH_RC4_40_MD5
+ - SSL_RSA_EXPORT_WITH_DES40_CBC_SHA
+ - SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
+ - SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wicket-intro/WicketIntro/src/test/jetty/jetty.xml b/wicket-intro/WicketIntro/src/test/jetty/jetty.xml
new file mode 100644
index 0000000000..1a6293b405
--- /dev/null
+++ b/wicket-intro/WicketIntro/src/test/jetty/jetty.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+ https
+
+
+
+ 32768
+ 8192
+ 8192
+ true
+ false
+ 512
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wicket-intro/WicketIntro/src/test/resources/keystore b/wicket-intro/WicketIntro/src/test/resources/keystore
new file mode 100644
index 0000000000..30bbc90ccf
Binary files /dev/null and b/wicket-intro/WicketIntro/src/test/resources/keystore differ