blob: 502e69e28bf9928ad0126fc142666ca1573f70c8 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Apache Wicket releases Wicket 1.5 | Apache Wicket</title>
<meta charset="utf8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon" />
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
<body class="">
<div class="header default">
<div class="l-container">
<nav class="mainmenu">
<ul>
<!-- /start/quickstart.html || /news/2011/09/07/wicket-1.5-released.html -->
<li class=""><a href="/start/quickstart.html">Quick Start</a></li>
<!-- /start/download.html || /news/2011/09/07/wicket-1.5-released.html -->
<li class=""><a href="/start/download.html">Download</a></li>
<!-- /learn || /news/2011/09/07/wicket-1.5-released.html -->
<li class=""><a href="/learn">Documentation</a></li>
<!-- /help || /news/2011/09/07/wicket-1.5-released.html -->
<li class=""><a href="/help">Support</a></li>
<!-- /contribute || /news/2011/09/07/wicket-1.5-released.html -->
<li class=""><a href="/contribute">Contribute</a></li>
<!-- /apache || /news/2011/09/07/wicket-1.5-released.html -->
<li class=""><a href="/apache">Apache</a></li>
</ul>
</nav>
<div class="logo">
<a href="/"><img src="/img/logo-apachewicket-white.svg" alt="Apache Wicket"></a>
</div>
</div>
</div>
<main>
<div class="l-container">
<header class="l-full preamble">
<h1>Apache Wicket releases Wicket 1.5</h1>
</header>
<section class="l-one-third right">
<div id="toc" class="toc"><div id="toc-title"><h2>Table of Contents</h2></div><ul><li class="toc--level-1 toc--section-1"><a href="#downloading-apache-wicket-15"><span class="toc-number">1</span> <span class="toc-text">Downloading Apache Wicket 1.5</span></a></li><li class="toc--level-1 toc--section-2"><a href="#most-notable-changes"><span class="toc-number">2</span> <span class="toc-text">Most notable changes</span></a><ul><li class="toc--level-2 toc--section-3"><a href="#inter-component-events"><span class="toc-number">2.1</span> <span class="toc-text">Inter-component events</span></a></li></ul></li></ul></div>
</section>
<section class="l-two-third left">
<div class="l-full">
<p class="meta">07 Sep 2011</p>
<p>The Apache Wicket team is proud to announce the immediate availability of the newest release of their component oriented open source Java web framework. Apache Wicket 1.5 has been in development for the last two years and brings many improvements over previous versions.</p>
<h2 id="downloading-apache-wicket-15">Downloading Apache Wicket 1.5</h2>
<p>You can download the release here: <a href="http://www.apache.org/dyn/closer.cgi/wicket/1.5.0">http://www.apache.org/dyn/closer.cgi/wicket/1.5.0</a></p>
<p>Or use this in your Maven POM to upgrade to the new version:</p>
<div class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt">&lt;dependency&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.wicket<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>wicket-core<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>1.5.0<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;/dependency&gt;</span></code></pre></div>
<p>Please note that Wicket’s main artifact ID has been renamed to <code>wicket-core</code>.</p>
<p>You will need to upgrade all modules (i.e. wicket, wicket-extensions, wicket-ioc, wicket-spring, etc) to 1.5.0. <strong>It is not possible to mix previous versions of Wicket with modules of this release.</strong></p>
<h2 id="most-notable-changes">Most notable changes</h2>
<p>With this release the Wicket team has revised many of its internals. A short list:</p>
<ul>
<li>HTML5 components added: <code>EmailTextField</code>, <code>NumberTextField</code>, <code>UrlTextField</code> and <code>RangeTextField</code></li>
<li>New inter-component events (explained below)</li>
<li>Minimum required servlet API is servlet-api 2.5</li>
<li>All standard validators now extend <code>Behavior</code> to allow for client side validations</li>
<li><code>IBehavior</code> has been removed and <code>AbstractBehavior</code> has been deprecated, you should now extend <code>Behavior</code> instead</li>
<li>Simplified the <a href="https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5">request cycle processing</a> and made it more extensible</li>
<li>URL handling is now in one place</li>
<li>Wicket’s rendering code has been greatly simplified</li>
<li>Improved browser <a href="https://cwiki.apache.org/confluence/display/WICKET/Caching+in+Wicket+1.5">caching support</a></li>
<li>ClientSideImageMap replaces old ImageMap</li>
<li>Better support for running behind proxies with <code>x-forwarded-for</code> header</li>
<li><a href="https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5">Request cycle listeners</a> make it easier to integrate frameworks in your Wicket application</li>
<li>Consistent naming: methods with <code>Javascript</code> in the name have been renamed to use proper capitalization: <code>JavaScript</code></li>
<li>Switching to HTTPS is as simple as configuring a new root mapper to make Wicket HTTPS aware and annotating a page with @RequireHttps</li>
</ul>
<p>A longer list of changes and improvements can be found in our <a href="http://s.apache.org/wicket-1.5-migration">migration guide</a>. </p>
<h3 id="inter-component-events">Inter-component events</h3>
<p>Wicket 1.5 offers a simple, yet flexible, way for component to communicate with each other in a decoupled manner. The two major interfaces that facilitate this are:</p>
<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="cm">/**</span>
<span class="cm"> * Objects that can send events</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kd">interface</span> <span class="nc">IEventSource</span> <span class="o">{</span>
<span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span> <span class="kt">void</span> <span class="nf">send</span><span class="o">(</span><span class="n">IEventSink</span> <span class="n">sink</span><span class="o">,</span> <span class="n">Broadcast</span> <span class="n">broadcast</span><span class="o">,</span> <span class="n">T</span> <span class="n">payload</span><span class="o">);</span>
<span class="o">}</span></code></pre></div>
<p>and</p>
<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="cm">/**</span>
<span class="cm"> * Objects that can receive events</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kd">interface</span> <span class="nc">IEventSink</span>
<span class="o">{</span>
<span class="cm">/**</span>
<span class="cm"> * Called when an event is sent to this sink</span>
<span class="cm"> */</span>
<span class="kt">void</span> <span class="nf">onEvent</span><span class="o">(</span><span class="n">IEvent</span><span class="o">&lt;?&gt;</span> <span class="n">event</span><span class="o">);</span>
<span class="o">}</span></code></pre></div>
<p>The classes that implement these interfaces, and can thus participate in the event mechanism are: <code>Component</code>, <code>RequestCycle</code>, <code>Session</code>, and <code>Application</code>.</p>
<p>The mechanism allows for different event broadcast methods defined here:</p>
<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="cm">/**</span>
<span class="cm"> * Defines the event broadcast type.</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kd">enum</span> <span class="n">Broadcast</span> <span class="o">{</span>
<span class="n">BREADTH</span><span class="o">,</span>
<span class="n">DEPTH</span><span class="o">,</span>
<span class="n">BUBBLE</span><span class="o">,</span>
<span class="n">EXACT</span><span class="o">;</span>
<span class="o">}</span></code></pre></div>
<p>There is an example in wicket-examples which demonstrates the usage of this.</p>
<p>Applications can register custom event dispatchers in <code>FrameworkSettings</code>; the dispatchers can be used to build custom event delivery mechanisms. For example a custom <code>IEventDispatcher</code> mechanism can route events to annotated methods, for example:</p>
<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyComponent</span> <span class="kd">extends</span> <span class="n">Component</span> <span class="o">{</span>
<span class="nd">@OnEvent</span>
<span class="kd">private</span> <span class="kt">void</span> <span class="nf">onUserAdded</span><span class="o">(</span><span class="n">UserAddedEvent</span> <span class="n">event</span><span class="o">)</span> <span class="o">{...}</span>
<span class="o">}</span></code></pre></div>
<p>where <code>UserAddedEvent</code> is the event payload object.</p>
<p>The default <code>Component#onEvent</code> method will be called even if custom dispatchers are registered.</p>
<p>A default event is raised whenever Wicket begins to create an AJAX response. The payload of the event is the <code>AjaxRequestTarget</code> used for event. Sample implementation:</p>
<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="c1">// component that always adds itself to the ajax response</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyComponent</span> <span class="kd">extends</span> <span class="n">Component</span> <span class="o">{</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">onEvent</span><span class="o">(</span><span class="n">IEvent</span> <span class="n">event</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="n">event</span><span class="o">.</span><span class="na">getPayload</span><span class="o">()</span> <span class="k">instanceof</span> <span class="n">AjaxRequestTarget</span><span class="o">)</span> <span class="o">{</span>
<span class="o">((</span><span class="n">AjaxRequestTarget</span><span class="o">)</span><span class="n">event</span><span class="o">.</span><span class="na">getPayload</span><span class="o">()).</span><span class="na">add</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span></code></pre></div>
</div>
</section>
</div>
</main>
<footer class="l-container">
<div class="l-full">
<img height="60px" src="/img/asf_logo.gif" style="float:left">
Copyright © 2014 — The Apache Software Foundation. Apache Wicket,
Wicket, Apache, the Apache feather logo, and the Apache Wicket
project logo are trademarks of The Apache Software Foundation. All
other marks mentioned may be trademarks or registered trademarks of
their respective owners.
</div>
</footer>
</body>
</html>