diff --git a/wicket-intro/CafeAddress/pom.xml b/wicket-intro/CafeAddress/pom.xml index 2966105404..d0e238bbb9 100644 --- a/wicket-intro/CafeAddress/pom.xml +++ b/wicket-intro/CafeAddress/pom.xml @@ -1,52 +1,20 @@ - 4.0.0 - com.baeldung.wicket.examples.cafeaddress - CafeAddress + com.baeldung.wicket.examples + cafe-address war 1.0-SNAPSHOT - - quickstart - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - + CafeAddress 7.4.0 9.2.13.v20150730 2.5 4.12 UTF-8 - none @@ -63,6 +31,24 @@ ${wicket.version} --> + + + + + org.springframework + spring-web + 4.1.1.RELEASE + + + javax.servlet + javax.servlet-api + 3.1.0 + + + org.apache.wicket + wicket-spring + 8.0.0-M1 + @@ -93,6 +79,7 @@ + CafeAddress false @@ -130,15 +117,23 @@ true org.apache.maven.plugins maven-compiler-plugin - 3.1 + 3.5.1 - 1.7 - 1.7 + 1.8 + 1.8 UTF-8 true true + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + false + + org.eclipse.jetty jetty-maven-plugin diff --git a/wicket-intro/CafeAddress/src/main/java/com/baeldung/wicket/examples/cafeaddress/ApplicationConfiguration.java b/wicket-intro/CafeAddress/src/main/java/com/baeldung/wicket/examples/cafeaddress/ApplicationConfiguration.java new file mode 100644 index 0000000000..c0e34c6dc1 --- /dev/null +++ b/wicket-intro/CafeAddress/src/main/java/com/baeldung/wicket/examples/cafeaddress/ApplicationConfiguration.java @@ -0,0 +1,10 @@ +package com.baeldung.wicket.examples.cafeaddress; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan +public class ApplicationConfiguration { + +} diff --git a/wicket-intro/CafeAddress/src/main/java/com/baeldung/wicket/examples/cafeaddress/WebAppInitializer.java b/wicket-intro/CafeAddress/src/main/java/com/baeldung/wicket/examples/cafeaddress/WebAppInitializer.java new file mode 100644 index 0000000000..f1465e05b9 --- /dev/null +++ b/wicket-intro/CafeAddress/src/main/java/com/baeldung/wicket/examples/cafeaddress/WebAppInitializer.java @@ -0,0 +1,26 @@ +package com.baeldung.wicket.examples.cafeaddress; + +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("CafeAddressApplication", WicketFilter.class); + filter.setInitParameter("applicationClassName", CafeAddressApplication.class.getName()); + filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); + filter.addMappingForUrlPatterns(null, false, "/*"); + } + +} \ No newline at end of file diff --git a/wicket-intro/CafeAddress/src/main/webapp/WEB-INF/web.xml b/wicket-intro/CafeAddress/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 03e600188b..0000000000 --- a/wicket-intro/CafeAddress/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - CafeAddress - - - - - wicket.CafeAddress - org.apache.wicket.protocol.http.WicketFilter - - applicationClassName - com.baeldung.wicket.examples.cafeaddress.CafeAddressApplication - - - - - wicket.CafeAddress - /* - - diff --git a/wicket-intro/HelloWorld/pom.xml b/wicket-intro/HelloWorld/pom.xml index 08586375ce..2aff59dd93 100644 --- a/wicket-intro/HelloWorld/pom.xml +++ b/wicket-intro/HelloWorld/pom.xml @@ -1,26 +1,60 @@ - 4.0.0 - com.baeldung.wicket.examples.helloworld - HelloWorld - war - 1.0-SNAPSHOT - HelloWorld Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - org.apache.wicket - wicket-core - 8.0.0-M1 - - - - HelloWorld - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + com.baeldung.wicket.examples + hello-world + war + 1.0-SNAPSHOT + HelloWorld + + + junit + junit + 3.8.1 + test + + + org.apache.wicket + wicket-core + 8.0.0-M1 + + + org.springframework + spring-web + 4.1.1.RELEASE + + + javax.servlet + javax.servlet-api + 3.1.0 + + + org.apache.wicket + wicket-spring + 8.0.0-M1 + + + + HelloWorld + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + false + + + + diff --git a/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/ApplicationConfiguration.java b/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/ApplicationConfiguration.java new file mode 100644 index 0000000000..f9de7adb2a --- /dev/null +++ b/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/ApplicationConfiguration.java @@ -0,0 +1,10 @@ +package com.baeldung.wicket.examples.helloworld; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan +public class ApplicationConfiguration { + +} diff --git a/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorldApplication.java b/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorldApplication.java index 618496e5f7..64bfcadd29 100644 --- a/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorldApplication.java +++ b/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorldApplication.java @@ -3,10 +3,20 @@ package com.baeldung.wicket.examples.helloworld; import org.apache.wicket.Page; import org.apache.wicket.protocol.http.WebApplication; +import org.apache.wicket.spring.injection.annot.SpringComponentInjector; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; public class HelloWorldApplication extends WebApplication { @Override public Class getHomePage() { return HelloWorld.class; } + + @Override + public void init() { + super.init(); + getComponentInstantiationListeners().add(new SpringComponentInjector(this)); + } + } diff --git a/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/WebAppInitializer.java b/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/WebAppInitializer.java new file mode 100644 index 0000000000..362502e264 --- /dev/null +++ b/wicket-intro/HelloWorld/src/main/java/com/baeldung/wicket/examples/helloworld/WebAppInitializer.java @@ -0,0 +1,26 @@ +package com.baeldung.wicket.examples.helloworld; + +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("HelloWorldApplication", WicketFilter.class); + filter.setInitParameter("applicationClassName", HelloWorldApplication.class.getName()); + filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); + filter.addMappingForUrlPatterns(null, false, "/*"); + } + +} \ No newline at end of file diff --git a/wicket-intro/HelloWorld/src/main/webapp/WEB-INF/web.xml b/wicket-intro/HelloWorld/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index c68ca09241..0000000000 --- a/wicket-intro/HelloWorld/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - Hello World - - HelloWorldApplication - org.apache.wicket.protocol.http.WicketFilter - - applicationClassName - com.baeldung.wicket.examples.helloworld.HelloWorldApplication - - - - HelloWorldApplication - /* - -