Repository: wicket-site Updated Branches: refs/heads/asf-site ec0b46008 -> d1fa7a5d6
http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2009/07/30/wicket-1.4-takes-typesafety-to-the-next-level.html ---------------------------------------------------------------------- diff --git a/content/news/2009/07/30/wicket-1.4-takes-typesafety-to-the-next-level.html b/content/news/2009/07/30/wicket-1.4-takes-typesafety-to-the-next-level.html index cbe4d0d..3bdf6e0 100644 --- a/content/news/2009/07/30/wicket-1.4-takes-typesafety-to-the-next-level.html +++ b/content/news/2009/07/30/wicket-1.4-takes-typesafety-to-the-next-level.html @@ -99,7 +99,7 @@ nationalities, credit card processors, etc.</p> <p>The signature of a constructor for the <code class="highlighter-rouge">DropDownChoice</code> component in Wicket 1.3 was:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">DropDownChoice</span> <span class="kd">extends</span> <span class="o">...</span> - <span class="kd">public</span> <span class="nf">DropDownChoice</span><span class="o">(</span><span class="n">String</span> <span class="n">id</span><span class="o">,</span> <span class="n">IModel</span> <span class="n">model</span><span class="o">,</span> <span class="n">IModel</span> <span class="n">choices</span><span class="o">)</span> + <span class="kd">public</span> <span class="n">DropDownChoice</span><span class="o">(</span><span class="n">String</span> <span class="n">id</span><span class="o">,</span> <span class="n">IModel</span> <span class="n">model</span><span class="o">,</span> <span class="n">IModel</span> <span class="n">choices</span><span class="o">)</span> <span class="o">}</span></code></pre></figure> <p>As you can see, this constructor doesnât give much insight into what goes where (other than the names of the parameters). The first parameter is the @@ -110,7 +110,7 @@ to assign the right IModel values to the right parameters. Now take a look at the same constructor, but now in Wicket 1.4. The signature for our generified constructor looks like the following example.</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="o"><</span><span class="n">T</span><span class="o">></span> <span class="n">DropDownChoice</span> <span class="kd">extends</span> <span class="o">...</span> - <span class="kd">public</span> <span class="nf">DropDownChoice</span><span class="o">(</span><span class="n">String</span> <span class="n">id</span><span class="o">,</span> <span class="n">IModel</span><span class="o"><</span><span class="n">T</span><span class="o">></span> <span class="n">model</span><span class="o">,</span> <span class="n">IModel</span><span class="o"><?</span> <span class="kd">extends</span> <span class="n">List</span><span class="o"><?</span> <span class="kd">extends</span> <span class="n">T</span><span class="o">>></span> <span class="n">choices</span><span class="o">)</span> + <span class="kd">public</span> <span class="n">DropDownChoice</span><span class="o">(</span><span class="n">String</span> <span class="n">id</span><span class="o">,</span> <span class="n">IModel</span><span class="o"><</span><span class="n">T</span><span class="o">></span> <span class="n">model</span><span class="o">,</span> <span class="n">IModel</span><span class="o"><?</span> <span class="kd">extends</span> <span class="n">List</span><span class="o"><?</span> <span class="kd">extends</span> <span class="n">T</span><span class="o">>></span> <span class="n">choices</span><span class="o">)</span> <span class="o">}</span></code></pre></figure> <p>Here we communicate that the first <code class="highlighter-rouge">IModel</code> parameter is a <code class="highlighter-rouge">T</code>, which is the single value that will be provided when the <code class="highlighter-rouge">DropDownChoice</code> selects one @@ -129,9 +129,9 @@ use a model or use two different model types: which one should be in the lead? We chose to generify only the components that clearly benefited from the extra type information, leading to clean code like this:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="n">ListView</span><span class="o"><</span><span class="n">Person</span><span class="o">></span> <span class="n">peopleListView</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ListView</span><span class="o"><</span><span class="n">Person</span><span class="o">>(</span><span class="s">"people"</span><span class="o">,</span> <span class="n">people</span><span class="o">)</span> <span class="o">{</span> - <span class="kd">protected</span> <span class="kt">void</span> <span class="nf">populateItem</span><span class="o">(</span><span class="n">ListItem</span><span class="o"><</span><span class="n">Person</span><span class="o">></span> <span class="n">item</span><span class="o">)</span> <span class="o">{</span> + <span class="kd">protected</span> <span class="kt">void</span> <span class="n">populateItem</span><span class="o">(</span><span class="n">ListItem</span><span class="o"><</span><span class="n">Person</span><span class="o">></span> <span class="n">item</span><span class="o">)</span> <span class="o">{</span> <span class="n">item</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">Link</span><span class="o"><</span><span class="n">Person</span><span class="o">>(</span><span class="s">"editPerson"</span><span class="o">,</span> <span class="n">item</span><span class="o">.</span><span class="na">getModel</span><span class="o">()){</span> - <span class="kd">public</span> <span class="kt">void</span> <span class="nf">onClick</span><span class="o">()</span> <span class="o">{</span> + <span class="kd">public</span> <span class="kt">void</span> <span class="n">onClick</span><span class="o">()</span> <span class="o">{</span> <span class="n">Person</span> <span class="n">p</span> <span class="o">=</span> <span class="n">getModelObject</span><span class="o">();</span> <span class="n">setResponsePage</span><span class="o">(</span><span class="k">new</span> <span class="n">EditPersonPage</span><span class="o">(</span><span class="n">p</span><span class="o">));</span> <span class="o">}</span> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2010/08/11/wicket-1.4.10-released.html ---------------------------------------------------------------------- diff --git a/content/news/2010/08/11/wicket-1.4.10-released.html b/content/news/2010/08/11/wicket-1.4.10-released.html index 2be7867..a06e97f 100644 --- a/content/news/2010/08/11/wicket-1.4.10-released.html +++ b/content/news/2010/08/11/wicket-1.4.10-released.html @@ -81,7 +81,7 @@ thirty bug fixes and improvements.</p> * </p> * */</span> - <span class="kd">protected</span> <span class="kt">void</span> <span class="nf">onInitialize</span><span class="o">()</span> <span class="o">{}</span> + <span class="kd">protected</span> <span class="kt">void</span> <span class="n">onInitialize</span><span class="o">()</span> <span class="o">{}</span> <span class="o">}</span></code></pre></figure> <p>Component configuration allows developers to easier configure component states such as visibility, enabled, etc. From the javadoc:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Component</span> <span class="o">{</span> @@ -143,7 +143,7 @@ thirty bug fixes and improvements.</p> * } * </pre> */</span> - <span class="kd">protected</span> <span class="kt">void</span> <span class="nf">onConfigure</span><span class="o">()</span> <span class="o">{}</span> + <span class="kd">protected</span> <span class="kt">void</span> <span class="n">onConfigure</span><span class="o">()</span> <span class="o">{}</span> <span class="o">}</span></code></pre></figure> <ul> <li><a href="http://svn.apache.org/repos/asf/wicket/releases/wicket-1.4.10/">Subversion tag</a></li> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2011/08/23/cve-2011-2712.html ---------------------------------------------------------------------- diff --git a/content/news/2011/08/23/cve-2011-2712.html b/content/news/2011/08/23/cve-2011-2712.html index 3f3c103..4fad250 100644 --- a/content/news/2011/08/23/cve-2011-2712.html +++ b/content/news/2011/08/23/cve-2011-2712.html @@ -61,7 +61,7 @@ With multi window support application configuration and special query parameters <p>Mitigation: Either disable multi window support with</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyApp</span> <span class="kd">extends</span> <span class="n">WebApplication</span> <span class="o">{</span> - <span class="kd">public</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> + <span class="kd">public</span> <span class="kt">void</span> <span class="n">init</span><span class="o">()</span> <span class="o">{</span> <span class="kd">super</span><span class="o">.</span><span class="na">init</span><span class="o">();</span> <span class="n">getPageSettings</span><span class="o">.</span><span class="na">setAutomaticMultiWindowSupport</span><span class="o">(</span><span class="kc">false</span><span class="o">);</span> <span class="o">}</span> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2011/09/07/wicket-1.5-released.html ---------------------------------------------------------------------- diff --git a/content/news/2011/09/07/wicket-1.5-released.html b/content/news/2011/09/07/wicket-1.5-released.html index 8fca8a5..565ca63 100644 --- a/content/news/2011/09/07/wicket-1.5-released.html +++ b/content/news/2011/09/07/wicket-1.5-released.html @@ -87,7 +87,7 @@ * Objects that can send events */</span> <span class="kd">public</span> <span class="kd">interface</span> <span class="nc">IEventSource</span> <span class="o">{</span> - <span class="o"><</span><span class="n">T</span><span class="o">></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><span class="n">T</span><span class="o">></span> <span class="kt">void</span> <span class="n">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></figure> <p>and</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="cm">/** @@ -98,7 +98,7 @@ <span class="cm">/** * Called when an event is sent to this sink */</span> - <span class="kt">void</span> <span class="nf">onEvent</span><span class="o">(</span><span class="n">IEvent</span><span class="o"><?></span> <span class="n">event</span><span class="o">);</span> + <span class="kt">void</span> <span class="n">onEvent</span><span class="o">(</span><span class="n">IEvent</span><span class="o"><?></span> <span class="n">event</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> <p>The classes that implement these interfaces, and can thus participate in the event mechanism are: <code class="highlighter-rouge">Component</code>, <code class="highlighter-rouge">RequestCycle</code>, <code class="highlighter-rouge">Session</code>, and <code class="highlighter-rouge">Application</code>.</p> <p>The mechanism allows for different event broadcast methods defined here:</p> @@ -115,14 +115,14 @@ <p>Applications can register custom event dispatchers in <code class="highlighter-rouge">FrameworkSettings</code>; the dispatchers can be used to build custom event delivery mechanisms. For example a custom <code class="highlighter-rouge">IEventDispatcher</code> mechanism can route events to annotated methods, for example:</p> <figure 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="kd">private</span> <span class="kt">void</span> <span class="n">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></figure> <p>where <code class="highlighter-rouge">UserAddedEvent</code> is the event payload object.</p> <p>The default <code class="highlighter-rouge">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 class="highlighter-rouge">AjaxRequestTarget</code> used for event. Sample implementation:</p> <figure 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="kd">public</span> <span class="kt">void</span> <span class="n">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> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2012/03/22/wicket-cve-2012-1089.html ---------------------------------------------------------------------- diff --git a/content/news/2012/03/22/wicket-cve-2012-1089.html b/content/news/2012/03/22/wicket-cve-2012-1089.html index f4d098b..1a98b7d 100644 --- a/content/news/2012/03/22/wicket-cve-2012-1089.html +++ b/content/news/2012/03/22/wicket-cve-2012-1089.html @@ -69,7 +69,7 @@ org.apache.wicket.markup.html.SecurePackageResourceGuard with a preconfigured list of allowed file extensions. Either setup SecurePackageResourceGuard with code like:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyApp</span> <span class="kd">extends</span> <span class="n">WebApplication</span> <span class="o">{</span> - <span class="kd">public</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> + <span class="kd">public</span> <span class="kt">void</span> <span class="n">init</span><span class="o">()</span> <span class="o">{</span> <span class="kd">super</span><span class="o">.</span><span class="na">init</span><span class="o">();</span> <span class="n">SecurePackageResourceGuard</span> <span class="n">guard</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SecurePackageResourceGuard</span><span class="o">();</span> <span class="n">guard</span><span class="o">.</span><span class="na">addPattern</span><span class="o">(...);</span> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2012/05/29/wicket-6.0.0-beta2-released.html ---------------------------------------------------------------------- diff --git a/content/news/2012/05/29/wicket-6.0.0-beta2-released.html b/content/news/2012/05/29/wicket-6.0.0-beta2-released.html index afcbb1e..8baf216 100644 --- a/content/news/2012/05/29/wicket-6.0.0-beta2-released.html +++ b/content/news/2012/05/29/wicket-6.0.0-beta2-released.html @@ -56,12 +56,12 @@ This release brings over many improvements over the 1.5.x series.</p> <h4 id="wicket-atmosphere">Wicket Atmosphere</h4> <p>The Beta 2 contains a new experimental module Wicket Atmosphere, which brings serverside push to Wicket and provides a great way to render serverside markup and send it to the browsers of your users. Check out the atmosphere example in our Examples project to see it in action.</p> <p>In your applicationâs init method you need to register the push event bus:</p> -<figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="k">new</span> <span class="n">EventBus</span><span class="o">(</span><span class="k">this</span><span class="o">);</span></code></pre></figure> +<figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="k">new</span> <span class="nf">EventBus</span><span class="p">(</span><span class="k">this</span><span class="o">);</span></code></pre></figure> <p>Somewhere where you want to push your changes to the client, you need to publish your event to the push <code class="highlighter-rouge">EventBus</code>:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="n">EventBus</span><span class="o">.</span><span class="na">get</span><span class="o">().</span><span class="na">post</span><span class="o">(</span><span class="n">input</span><span class="o">.</span><span class="na">getModelObject</span><span class="o">());</span></code></pre></figure> <p>And finally you need to subscribe your page (or component) to the <code class="highlighter-rouge">EventBus</code>âs events with <code class="highlighter-rouge">@Subscribe</code>, taking in the typed parameter you post to the EventBus (in this case a <code class="highlighter-rouge">String</code>):</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="nd">@Subscribe</span> -<span class="kd">public</span> <span class="kt">void</span> <span class="nf">receiveMessage</span><span class="o">(</span><span class="n">AjaxRequestTarget</span> <span class="n">target</span><span class="o">,</span> <span class="n">String</span> <span class="n">message</span><span class="o">)</span> <span class="o">{</span> +<span class="kd">public</span> <span class="kt">void</span> <span class="nf">receiveMessage</span><span class="p">(</span><span class="n">AjaxRequestTarget</span> <span class="n">target</span><span class="o">,</span> <span class="n">String</span> <span class="n">message</span><span class="o">)</span> <span class="o">{</span> <span class="n">label</span><span class="o">.</span><span class="na">setDefaultModelObject</span><span class="o">(</span><span class="n">message</span><span class="o">);</span> <span class="n">target</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">label</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2013/01/23/wicket-6.5.0-released.html ---------------------------------------------------------------------- diff --git a/content/news/2013/01/23/wicket-6.5.0-released.html b/content/news/2013/01/23/wicket-6.5.0-released.html index c9a8ceb..cf300f6 100644 --- a/content/news/2013/01/23/wicket-6.5.0-released.html +++ b/content/news/2013/01/23/wicket-6.5.0-released.html @@ -66,7 +66,7 @@ the attributes for all Ajax requests.</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="n">application</span><span class="o">.</span><span class="na">getAjaxRequestTargetListeners</span><span class="o">().</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">AjaxRequestTarget</span><span class="o">.</span><span class="na">AbstractListener</span><span class="o">()</span> <span class="o">{</span> <span class="nd">@Override</span> - <span class="kd">public</span> <span class="kt">void</span> <span class="nf">updateAjaxAttributes</span><span class="o">(</span><span class="n">AjaxRequestAttributes</span> <span class="n">attributes</span><span class="o">)</span> + <span class="kd">public</span> <span class="kt">void</span> <span class="n">updateAjaxAttributes</span><span class="o">(</span><span class="n">AjaxRequestAttributes</span> <span class="n">attributes</span><span class="o">)</span> <span class="o">{</span> <span class="kd">super</span><span class="o">.</span><span class="na">updateAjaxAttributes</span><span class="o">(</span><span class="n">attributes</span><span class="o">);</span> <span class="n">attributes</span><span class="o">.</span><span class="na">setChannel</span><span class="o">(</span><span class="k">new</span> <span class="n">AjaxChannel</span><span class="o">(</span><span class="s">"globalAjaxChannel"</span><span class="o">,</span> <span class="n">AjaxChannel</span><span class="o">.</span><span class="na">Type</span><span class="o">.</span><span class="na">ACTIVE</span><span class="o">));</span> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2013/06/27/wicket-6.9.0-released.html ---------------------------------------------------------------------- diff --git a/content/news/2013/06/27/wicket-6.9.0-released.html b/content/news/2013/06/27/wicket-6.9.0-released.html index b72af29..17275d2 100644 --- a/content/news/2013/06/27/wicket-6.9.0-released.html +++ b/content/news/2013/06/27/wicket-6.9.0-released.html @@ -59,7 +59,7 @@ compared to 6.0.0.</p> <p>Switch between jQuery 1.x and 2.x depending on the user agent. For IE 6/7/8 jQuery ver. 1.x will be used, for any other browser - ver. 2.x. To use this resource reference do in your applicationâs init method:</p> -<figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> +<figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="p">(</span><span class="o">)</span> <span class="o">{</span> <span class="n">getJavaScriptLibrarySettings</span><span class="o">()</span> <span class="o">.</span><span class="na">setJQueryReference</span><span class="o">(</span><span class="n">DynamicJQueryResourceReference</span><span class="o">.</span><span class="na">INSTANCE</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2013/07/10/wicket-6.9.1-released.html ---------------------------------------------------------------------- diff --git a/content/news/2013/07/10/wicket-6.9.1-released.html b/content/news/2013/07/10/wicket-6.9.1-released.html index 0516139..af78478 100644 --- a/content/news/2013/07/10/wicket-6.9.1-released.html +++ b/content/news/2013/07/10/wicket-6.9.1-released.html @@ -69,7 +69,7 @@ downgrade to JQuery 1.8.3-the previously provided JQuery that still contains these APIs. Download the 1.8.3 release of jquery and add it to your project in its applicationâs init method:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="nd">@Override</span> -<span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> +<span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="p">(</span><span class="o">)</span> <span class="o">{</span> <span class="n">getJavaScriptLibrarySettings</span><span class="o">()</span> <span class="o">.</span><span class="na">setJQueryReference</span><span class="o">(</span><span class="n">yourJquery183ResourceReference</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2013/08/18/wicket-6.10.0-released.html ---------------------------------------------------------------------- diff --git a/content/news/2013/08/18/wicket-6.10.0-released.html b/content/news/2013/08/18/wicket-6.10.0-released.html index 4b3ea37..26b8aa6 100644 --- a/content/news/2013/08/18/wicket-6.10.0-released.html +++ b/content/news/2013/08/18/wicket-6.10.0-released.html @@ -82,7 +82,7 @@ downgrade to JQuery 1.8.3-the previously provided JQuery that still contains these APIs. Download the 1.8.3 release of jquery and add it to your project in its applicationâs init method:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"><span class="nd">@Override</span> -<span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> +<span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="p">(</span><span class="o">)</span> <span class="o">{</span> <span class="n">getJavaScriptLibrarySettings</span><span class="o">()</span> <span class="o">.</span><span class="na">setJQueryReference</span><span class="o">(</span><span class="n">yourJquery183ResourceReference</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2013/09/20/wicket-6.11.0-released.html ---------------------------------------------------------------------- diff --git a/content/news/2013/09/20/wicket-6.11.0-released.html b/content/news/2013/09/20/wicket-6.11.0-released.html index f35df08..f62aeec 100644 --- a/content/news/2013/09/20/wicket-6.11.0-released.html +++ b/content/news/2013/09/20/wicket-6.11.0-released.html @@ -92,7 +92,7 @@ downgrade to JQuery 1.8.3-the previously provided JQuery that still contains these APIs. Download the 1.8.3 release of jquery and add it to your project in its applicationâs init method:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"> <span class="nd">@Override</span> - <span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> + <span class="kd">protected</span> <span class="kt">void</span> <span class="n">init</span><span class="o">()</span> <span class="o">{</span> <span class="n">getJavaScriptLibrarySettings</span><span class="o">()</span> <span class="o">.</span><span class="na">setJQueryReference</span><span class="o">(</span><span class="n">yourJquery183ResourceReference</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2013/11/01/wicket-6.12.0-released.html ---------------------------------------------------------------------- diff --git a/content/news/2013/11/01/wicket-6.12.0-released.html b/content/news/2013/11/01/wicket-6.12.0-released.html index 6b2aeb4..2c38681 100644 --- a/content/news/2013/11/01/wicket-6.12.0-released.html +++ b/content/news/2013/11/01/wicket-6.12.0-released.html @@ -78,7 +78,7 @@ downgrade to JQuery 1.8.3-the previously provided JQuery that still contains these APIs. Download the 1.8.3 release of jquery and add it to your project in its applicationâs init method:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"> <span class="nd">@Override</span> - <span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> + <span class="kd">protected</span> <span class="kt">void</span> <span class="n">init</span><span class="o">()</span> <span class="o">{</span> <span class="n">getJavaScriptLibrarySettings</span><span class="o">()</span> <span class="o">.</span><span class="na">setJQueryReference</span><span class="o">(</span><span class="n">yourJquery183ResourceReference</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2014/01/05/wicket-6.13.0-released.html ---------------------------------------------------------------------- diff --git a/content/news/2014/01/05/wicket-6.13.0-released.html b/content/news/2014/01/05/wicket-6.13.0-released.html index 4a1cc94..82c9fb5 100644 --- a/content/news/2014/01/05/wicket-6.13.0-released.html +++ b/content/news/2014/01/05/wicket-6.13.0-released.html @@ -131,7 +131,7 @@ downgrade to JQuery 1.8.3-the previously provided JQuery that still contains these APIs. Download the 1.8.3 release of jquery and add it to your project in its applicationâs init method:</p> <figure class="highlight"><pre><code class="language-java" data-lang="java"> <span class="nd">@Override</span> - <span class="kd">protected</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="o">{</span> + <span class="kd">protected</span> <span class="kt">void</span> <span class="n">init</span><span class="o">()</span> <span class="o">{</span> <span class="n">getJavaScriptLibrarySettings</span><span class="o">()</span> <span class="o">.</span><span class="na">setJQueryReference</span><span class="o">(</span><span class="n">yourJquery183ResourceReference</span><span class="o">);</span> <span class="o">}</span></code></pre></figure> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/news/2016/07/25/wicket-8.0.0-M1-released.html ---------------------------------------------------------------------- diff --git a/content/news/2016/07/25/wicket-8.0.0-M1-released.html b/content/news/2016/07/25/wicket-8.0.0-M1-released.html index 99db264..8356c14 100644 --- a/content/news/2016/07/25/wicket-8.0.0-M1-released.html +++ b/content/news/2016/07/25/wicket-8.0.0-M1-released.html @@ -223,7 +223,7 @@ cTwAn0jMYcafuw0aHDATKwbTv8U3uZX1 <li>[WICKET-5920] - roll a version of ListDataProvider implementing ISortableDetachable model</li> <li>[WICKET-5950] - Model and GenericBaseModel could both implement IObjectClassAwareModel</li> <li>[WICKET-5969] - Please give us access to PageTable.index pageId queue</li> - <li>[WICKET-5986] - NumberTextField<N> should use Models for minimum, maximum and step</N></li> + <li>[WICKET-5986] - NumberTextField<n> should use Models for minimum, maximum and step</n></li> <li>[WICKET-6015] - AjaxFallbackOrderByBorder/Link should support updateAjaxAttributes() idiom</li> <li>[WICKET-6019] - Remove âfinalâ modifier for Localizer#getStringIgnoreSettings() methods</li> <li>[WICKET-6023] - small tweak for component queuing for the AbstractRepeater</li> @@ -267,7 +267,7 @@ cTwAn0jMYcafuw0aHDATKwbTv8U3uZX1 <li>[WICKET-6183] - Improve stateless support for AJAX</li> <li>[WICKET-6184] - Remove form argument from AjaxButton and AjaxLink callbacks</li> <li>[WICKET-6188] - Use DynamicJQueryResourceReference by default</li> - <li>[WICKET-6189] - Return Optional<T> from RequestCycle.find(Class<T>)</T></T></li> + <li>[WICKET-6189] - Return Optional<t> from RequestCycle.find(Class<t>)</t></t></li> </ul> <h5 id="new-feature">New Feature</h5> <ul> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/content/start/quickstart.html ---------------------------------------------------------------------- diff --git a/content/start/quickstart.html b/content/start/quickstart.html index 32f55cf..1205fd5 100644 --- a/content/start/quickstart.html +++ b/content/start/quickstart.html @@ -153,9 +153,9 @@ generated (e.g. for Eclipse users this would be your workspace folder). Paste the command line into your terminal window and press «enter» to execute the command.</p> <p>You can create your quickstart interactively too with the following Maven command:</p> -<div class="language-shell highlighter-rouge"><pre class="highlight"><code> mvn archetype:generate -DarchetypeCatalog<span class="o">=</span>http://wicket.apache.org -</code></pre> -</div> +<p><code class="highlighter-rouge">shell + mvn archetype:generate -DarchetypeCatalog=http://wicket.apache.org +</code></p> <h4 id="result-of-the-maven-command">Result of the Maven command</h4> <p>Executing the Maven command line will result the following directory structure:</p> http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/learn/examples/index.md ---------------------------------------------------------------------- diff --git a/learn/examples/index.md b/learn/examples/index.md index a4a5be8..a32b50f 100644 --- a/learn/examples/index.md +++ b/learn/examples/index.md @@ -24,3 +24,5 @@ action (available for version [7.x](http://examples7x.wicket.apache.org/index.ht features building a counter. * [Using Fragments](usingfragments.html) - A short example explaining Wicket's fragments feature. Fragments are a type of inline panels. +* [Servlet 3.x with Spring Framework](servlet3x.html) - An example to show the configuration of + Wicket and Spring Framework without any XML definitions. http://git-wip-us.apache.org/repos/asf/wicket-site/blob/d1fa7a5d/learn/examples/servlet3x.md ---------------------------------------------------------------------- diff --git a/learn/examples/servlet3x.md b/learn/examples/servlet3x.md new file mode 100644 index 0000000..e5791cd --- /dev/null +++ b/learn/examples/servlet3x.md @@ -0,0 +1,105 @@ +--- +layout: default +title: Servlet 3.x with Spring Framework +--- + +This example shows you how to configure Wicket to run without any XML definitions. +It requires to use the Servlet 3.x API and a container which is able to load the +web component definitions via annotations defined within this standard. + +## Creating the web components + +### MyFilter.java ### + +First you have to configure the filter which was done within the web.xml in previous +of the Servlet specification. All initialization parameters are configured also via annotations. +The Application class is defined in the init param with the name applicationClassName. + +{% highlight java %} +@WebFilter(value = "/*", initParams = { + @WebInitParam(name = "applicationClassName", + value = "com.my.package.MyApplication"), + @WebInitParam(name = "configuration", value = "development") }) +public class MyFilter extends WicketFilter {} +{% endhighlight %} + +### MyContextLoaderListener.java ### + +Another important class is the ContextLoaderListener which in our case is going to initialize +the Spring Framework's context and effects a package scan for other Spring components. Usually +those Spring components are initialized with specific annotations like @Component or @Service for +example. You have to place in all your Spring Components in the scanned package or in subpackages +(com.my.package in this case) + + +{% highlight java %} +@WebListener +public class MyContextLoaderListener extends ContextLoaderListener { + + private static AnnotationConfigWebApplicationContext context; + + static { + context = new AnnotationConfigWebApplicationContext(); + context.scan("com.my.package"); + context.refresh(); + } + + public MyContextLoaderListener() { + super(context); + } + + public static AnnotationConfigWebApplicationContext getContext() { + return context; + } + + public static void setContext( + AnnotationConfigWebApplicationContext context) { + MyContextLoaderListener.context = context; + } +} +{% endhighlight %} + +### MyRequestContextListener.java ### + +To configure Spring Framework to recognize the request context a RequestContextListener needs to be +defined. This listener enables the web project to define beans with a scope. So if you want a bean +to remains in the session as long as the user is surfing on your web page you can do this by adding the +annotation @SessionScope together with @Component. + +{% highlight java %} +@WebListener +public class MyRequestContextListener extends RequestContextListener{} +{% endhighlight %} + +## Creating the web application class + +Within our application class it is required to hand over the Spring's application context to the +SpringComponentInjector so that beans are also injected into Wicket components - this can be done by using the +@SpringBean annotation. If you are interested in how to implement the home page have a look at the +corresponding example: [Hello World!](helloworld.html) + +{% highlight java %} +public class MyApplication extends WebApplication { + + @Override + public Class<? extends Page> getHomePage() { + return HelloWorld.class; + } + + @Override + protected void init() { + super.init(); + getComponentInstantiationListeners().add( + new SpringComponentInjector(this, + MyContextLoaderListener.getContext())); + } +} +{% endhighlight %} + +## Summary + +Since Servlet 3.x and the corresponding changes within the Spring Framework to configure web applications +without any XML definitions it is easily possible to increase the maintainability, because every configuration +is covered by the java compiler. Also you don't have to switch between various different initialization representations. +Required artifacts are: spring-web (required: >4.0), wicket-spring (recommend: >7.6.0), wicket-core (recommend: >7.6.0), +javax.servlet-api (required: >3.x) \ No newline at end of file
