Ouertani Slim was born in Tunisia in 1981. Now he is a software engineer since 2004 and he is Java 6 and Spring certified with 100% and 94% respectively. He is very interested in Java technology, Scala and open source projects. He believes that programming is one of the hardest jobs and most beautiful in the world. Slim has posted 32 posts at DZone. You can read more from them at their website. View Full User Profile

Tips : Wicket and JEE 6 With Servlet 3.0 Annotations

06.05.2010
| 9149 views |
  • submit to reddit

JEE 6 and especially Servlet 3.0 introduce many features such as pluggability and asynchronous processing. In this post, I will show a how to use Wicket filter with servlet 3.0 annotations.

The deployment descriptor web.xml isn't mandatory for JEE 6 and one of the best way to declare wicket filter is by using this concise declaration :

package com.jtunisie.wicket;


import org.apache.wicket.protocol.http.WicketFilter;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;

@WebFilter(value = "/*",
initParams = { @WebInitParam(name = "applicationClassName", value = "com.jtunisie.wicket.Application")})
public final class MyWicketFilter extends WicketFilter {}

While, for JEE 5 version, the equivalent web.xml file is:

<filter>
<filter-name>WicketApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.jtunisie.wicket.Application</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>wicket.configuration</param-name>
<param-value>deployment</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>WicketApplication</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

 

5
Your rating: None Average: 5 (3 votes)
Published at DZone with permission of its author, Slim Ouertani.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)