Over a million developers have joined DZone.

Tips : Wicket and JEE 6 With Servlet 3.0 Annotations

· Java Zone

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

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>

 

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}