<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Molindo Techblog &#187; wicketstuff-merged-resources</title>
	<atom:link href="http://techblog.molindo.at/category/java/wicket/wicketstuff-merged-resources/feed" rel="self" type="application/rss+xml" />
	<link>http://techblog.molindo.at</link>
	<description>Molindo Techblog – formerly known as talk-on-tech.blogspot.com</description>
	<lastBuildDate>Tue, 20 Dec 2011 10:22:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Serving Wicket Resources from CDN</title>
		<link>http://techblog.molindo.at/2011/03/serving-wicket-resources-from-cdn.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=serving-wicket-resources-from-cdn</link>
		<comments>http://techblog.molindo.at/2011/03/serving-wicket-resources-from-cdn.html#comments</comments>
		<pubDate>Wed, 16 Mar 2011 11:53:47 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[wicketstuff-merged-resources]]></category>

		<guid isPermaLink="false">http://techblog.molindo.at/?p=182</guid>
		<description><![CDATA[This post is short but still just amazing. Now it&#8217;s possible to serve Wicket resources from CDNs supporting custom orgins within just a few minutes (at least if you are already using wicketstuff-merged-resources). First of all, you&#8217;ll need the latest version (3.1-alpha-1) of wicketstuff-merged-resources (which is now available from Maven Central!). If you haven&#8217;t already done so, add [...]]]></description>
			<content:encoded><![CDATA[<p>This post is short but still just amazing. Now it&#8217;s possible to serve <a href="http://wicket.apache.org/">Wicket</a> resources from <a href="http://en.wikipedia.org/wiki/Content_delivery_network">CDNs</a> supporting custom orgins within just a few minutes (at least if you are already using <a href="https://github.com/molindo/wicketstuff-merged-resources">wicketstuff-merged-resources</a>). First of all, you&#8217;ll need the latest version (3.1-alpha-1) of wicketstuff-merged-resources (which is now <a href="http://repo1.maven.org/maven2/at/molindo/wicketstuff-merged-resources/">available from Maven Central!</a>).<br />
<span id="more-182"></span><br />
If you haven&#8217;t already done so, add the dependency and read articles in the <a href="http://techblog.molindo.at/category/java/wicket/wicketstuff-merged-resources">wicketstuff-merged-resources category</a> to get started.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #808080; font-style: italic;">&lt;!-- changed groupId to at.molindo --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>at.molindo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wicketstuff-merged-resources<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3.1-alpha-1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Then simply replace ResourceMount with RemoteHostResourceMount:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ResourceMount mount <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> RemoteHostResourceMount<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://cdn.example.org/&quot;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #006633;">setResourceVersionProvider</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RevisionVersionProvider<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #006633;">setPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/style/all.css&quot;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #006633;">addResourceSpecsMatchingSuffix</span><span style="color: #009900;">&#40;</span>PanelOne.<span style="color: #000000; font-weight: bold;">class</span>, ComponentB.<span style="color: #000000; font-weight: bold;">class</span>, MyForm.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #006633;">mount</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And that&#8217;s it. Cool, eh? All you have to do now is configuring your CDN to fetch resources from your server. We are using <a href="http://aws.amazon.com/cloudfront/">Amazon CloudFront</a> since it <a href="http://aws.amazon.com/about-aws/whats-new/2010/11/09/cloudfront-adds-support-for-custom-origins-and-sla/">supports custom origins</a>. See <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/index.html?CreatingDistributions.html">&#8220;Creating a Distribution with a Custom Origin&#8221;</a> and <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/index.html?CustomOriginBestPractices.html">&#8220;Custom Origins Best Practices&#8221;</a> for configuration instructions.</p>
<p>By the way, RemoteHostResourceMount uses RemoteHostUrlCodingStrategy (also part of wicketstuff-merged-resources) internally. This URL coding strategy may easily be used on its own:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ResourceReference ref <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ResourceReference<span style="color: #009900;">&#40;</span>CssScope.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;all.css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">URL</span> root <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://cdn.example.org&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> mountPoint <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/scripts/all.css&quot;</span><span style="color: #339933;">;</span>
mount<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RemoteHostUrlCodingStrategy<span style="color: #009900;">&#40;</span>root, mountPoint, ref<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>PS: if you haven&#8217;t already noticed, <a href="https://github.com/molindo/wicketstuff-merged-resources">wicketstuff-merged-resources (that is source, its admittedly sparse documentation and issues) is now hosted on GitHub</a>.</p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2011/03/serving-wicket-resources-from-cdn.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>wicketstuff-merged-resources: 2.1 and 3.0 released!</title>
		<link>http://techblog.molindo.at/2010/02/wicketstuff-merged-resources-2-1-and-3-0-released.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wicketstuff-merged-resources-2-1-and-3-0-released</link>
		<comments>http://techblog.molindo.at/2010/02/wicketstuff-merged-resources-2-1-and-3-0-released.html#comments</comments>
		<pubDate>Fri, 05 Feb 2010 13:57:34 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[wicketstuff-merged-resources]]></category>

		<guid isPermaLink="false">http://techblog.molindo.at/?p=172</guid>
		<description><![CDATA[I&#8217;m happy to announce the releases of wicketstuff-merged-resources 2.1 and 3.0. Changes from 2.0 to 2.1 (Wicket 1.3.x): Annotation-based Mounting of Resources [WMR-7] Failure to load resources if this library is provided in a parent classloader [WMR-9] Make it possible to define some sort of order in the way files are included in the overall [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy to announce the releases of <a href="http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-merged-resources" target="_blank">wicketstuff-merged-resources</a> 2.1 and 3.0.</p>
<p><span id="more-172"></span><strong>Changes from 2.0 to 2.1 (Wicket 1.3.x):</strong></p>
<ul>
<li><a href="http://techblog.molindo.at/2009/10/wicket-annotation-based-mounting-of-resources.html">Annotation-based Mounting of Resources</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-7" target="_blank">[WMR-7] Failure to load resources if this library is provided in a parent classloader</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-9" target="_blank">[WMR-9] Make it possible to define some sort of order in the way files are included in the overall file</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-10" target="_blank">[WMR-10] wicketstuff-merged-resources does not compile; missing jetty plugin artifact</a></li>
<li>and a few minor bug fixes and performance improvements: <a href="http://fisheye3.atlassian.com/changelog/~branchConstraint=wicket-1.3.x,startDate=2009-08-24T00:00:00,endDate=2010-02-02T23:59:59/wicket-stuff/branches/wicket-1.3.x/wicketstuff-merged-resources" target="_blank">See full FishEye Activity report</a></li>
</ul>
<p>(Note: <a href="http://wicketstuff.org/jira/browse/WMR-12" target="_blank">[WMR-12]</a> and <a href="http://wicketstuff.org/jira/browse/WMR-14" target="_blank">[WMR-14]</a> already went into <a href="http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-merged-resources/2.2-SNAPSHOT/" target="_blank">2.2-SNAPSHOT</a>)</p>
<p><strong>Changes for 3.0 (Wicket 1.4.x):</strong></p>
<ul>
<li><a href="http://techblog.molindo.at/2009/10/wicket-annotation-based-mounting-of-resources.html">Annotation-based Mounting of Resources</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-6" target="_blank">[WMR-6] Compatibility to wicket 1.4</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-7" target="_blank">[WMR-7] Failure to load resources if this library is provided in a parent classloader</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-7" target="_blank"></a><a href="http://wicketstuff.org/jira/browse/WMR-9">[WMR-9] Make it possible to define some sort of order in the way files are included in the overall file</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-9" target="_blank"></a><a href="http://wicketstuff.org/jira/browse/WMR-10">[WMR-10] wicketstuff-merged-resources does not compile; missing jetty plugin artifact</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-12" target="_blank">[WMR-12] Allow CSS media to be specified in ResourceMount, and honored by build()</a></li>
<li><a href="http://wicketstuff.org/jira/browse/WMR-14" target="_blank">[WMR-14] Error detection for adding CSS and JavaScript resources to ResourceMount</a></li>
<li>and a few minor bug fixes and performance improvements: <a href="http://fisheye3.atlassian.com/changelog/~branchConstraint=trunk,startDate=2009-08-06T00:00:00,endDate=2010-02-05T23:59:59/wicket-stuff/trunk/wicketstuff-merged-resources" target="_blank">See full FishEye Activity report</a></li>
</ul>
<p><strong>Downloads:</strong></p>
<ul>
<li>wicketstuff-merged-resources 2.1: <a href="http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-merged-resources/2.1/wicketstuff-merged-resources-2.1.jar" target="_blank">Jar</a> <a href="http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-merged-resources/2.1/wicketstuff-merged-resources-2.1-sources.jar" target="_blank">Sources</a></li>
<li>wicketstuff-merged-resources 3.0: <a href="http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-merged-resources/3.0/wicketstuff-merged-resources-3.0.jar" target="_blank">Jar</a> <a href="http://wicketstuff.org/maven/repository/org/wicketstuff/wicketstuff-merged-resources/3.0/wicketstuff-merged-resources-3.0-sources.jar" target="_blank">Sources</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2010/02/wicketstuff-merged-resources-2-1-and-3-0-released.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Wicket: Annotation-based Mounting of Resources</title>
		<link>http://techblog.molindo.at/2009/10/wicket-annotation-based-mounting-of-resources.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wicket-annotation-based-mounting-of-resources</link>
		<comments>http://techblog.molindo.at/2009/10/wicket-annotation-based-mounting-of-resources.html#comments</comments>
		<pubDate>Tue, 13 Oct 2009 12:05:48 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[wicketstuff-merged-resources]]></category>

		<guid isPermaLink="false">http://techblog.molindo.at/?p=128</guid>
		<description><![CDATA[Today, I&#8217;m happy to announce the availability of annotation-based mounting and merging of resources in wicketstuff-merged-resources (version 3.0-SNAPSHOT for Wicket 1.4, version 2.1-SNAPSHOT for Wicket 1.3). In order to mount resources, all that&#8217;s needed is adding annotations to component classes: @JsContribution @CssContribution&#40;media = &#34;print&#34;&#41; @ResourceContribution&#40;value = &#34;accept.png&#34;, path = &#34;/img/accept.png&#34;&#41; public class PanelOne extends Panel [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I&#8217;m happy to announce the availability of annotation-based mounting and merging of resources in <a title="Wicketstuff Wiki: wicketstuff-merged-resources" href="http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-merged-resources" target="_blank">wicketstuff-merged-resources</a> (version 3.0-SNAPSHOT for Wicket 1.4, version 2.1-SNAPSHOT for Wicket 1.3). In order to mount resources, all that&#8217;s needed is adding annotations to component classes:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@JsContribution
@CssContribution<span style="color: #009900;">&#40;</span>media <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;print&quot;</span><span style="color: #009900;">&#41;</span>
@ResourceContribution<span style="color: #009900;">&#40;</span>value <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;accept.png&quot;</span>, path <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/img/accept.png&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PanelOne <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">Panel</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> PanelOne<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// ...</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span id="more-128"></span><br />
The example above mounts and merges PanelOne.js (default is simple name of class + &#8220;.js&#8221;) into all.js (another default) and PanelOne-print.css into print.css which will be included with scope print. Additionally, accept.png will be mounted to /img/accept.png (as path starts with a &#8216;/&#8217;) which makes it easy to use from css files.</p>
<p>There&#8217;s not much left for this to work. All it takes is a single method call in your Application&#8217;s init code:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ResourceMount.<span style="color: #006633;">mountAnnotatedPackageResources</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/files&quot;</span>, <span style="color: #0000ff;">&quot;com.example.components&quot;</span>, <span style="color: #000000; font-weight: bold;">this</span>, mount<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In this example, all components in package com.example.components (including sub-packages) will be scanned for annotations. If not defined otherwise, all resources will be merged into  single files for JS (/files/all.js) and all CSS media types (/files/all.css, /files/screen.css, /files/print.css, &#8230;).</p>
<p>As an added benefit, you&#8217;ll get all the other features of wicketstuff-merged-resources:</p>
<ul>
<li>merging of multiple files into one for less HTTP requests</li>
<li>adding of versions to resource paths for aggressive caching</li>
<li>pre-processing of resources (e.g. replacing colors in CSS files)</li>
<li>optionally uploading them to Amazon Cloudfront (well, at least you can expect this feature soon &#8211; <a title="setlist.fm - the setlist wiki" href="http://www.setlist.fm/" target="_blank">we are using it already</a>)</li>
</ul>
<p>So you will <a title="Molindo Techblog: Wicket Interface Speed-Up" href="http://techblog.molindo.at/2008/08/wicket-interface-speed-up.html" target="_blank">speed up rendering of your pages</a> while simplifying and reducing your code (there&#8217;s no need to merge, mount or add HeaderContributors manually anymore)!</p>
<p><a title="wicketstuff-merged-resources on Wicket Stuff Wiki" href="http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-merged-resources" target="_blank">Further instructions are available on wicketstfuff-merged-resources&#8217; page on Wicket Stuff Wiki</a>.</p>
<p>(This new feature is mainly based on the idea and code of <a title="Jörn Zaefferer's profile at LinkedIn" href="http://www.linkedin.com/in/joernzaefferer" target="_blank">Jörn Zaefferer</a> &#8211; Tanks!)</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2009/10/wicket-annotation-based-mounting-of-resources.html/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>wicketstuff-merged-resources: New (much simpler) Version</title>
		<link>http://techblog.molindo.at/2009/09/wicketstuff-merged-resources-new-much-simpler-version.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wicketstuff-merged-resources-new-much-simpler-version</link>
		<comments>http://techblog.molindo.at/2009/09/wicketstuff-merged-resources-new-much-simpler-version.html#comments</comments>
		<pubDate>Thu, 24 Sep 2009 19:17:56 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[wicketstuff-merged-resources]]></category>

		<guid isPermaLink="false">http://techblog.molindo.at/?p=113</guid>
		<description><![CDATA[It&#8217;s been a while since I&#8217;ve last posted here. Nevertheless, I&#8217;ve been busy working on some (yet to be released) Open Source projects. Others are already released but not documented/promoted yet. One of these unpromoted releases is the new version of wicketstuff-merged-resources.  wicketstuff-merged-resources was the result of my &#8220;Wicket Interface Speed-up&#8221; series where I investigate [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I&#8217;ve last posted here. Nevertheless, I&#8217;ve been busy working on some (yet to be released) Open Source projects. Others are <a title="groovy-mb-mysql - Groovy port of MB_MySQL - the &quot;MusicBrainz Database for MySQL&quot;" href="http://code.google.com/p/groovy-mb-mysql/" target="_blank">already released but not documented/promoted yet</a>. One of these unpromoted releases is the <a title="wicketstuff-merged-resources - a set of simple helper classes to improve Wicket interface loading performance" href="http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-merged-resources" target="_blank">new version of wicketstuff-merged-resources</a>.  wicketstuff-merged-resources was the result of my <a href="http://techblog.molindo.at/2008/08/wicket-interface-speed-up.html">&#8220;Wicket Interface Speed-up&#8221; series</a> where I investigate how to reduce time spent rendering Wicket pages on the client side. wicketstuff-merged-resources has two main purposes: reducing the number of HTTP requests by merging resources (i.e. JS and CSS files) and enabling aggressive caching (up to a year) by adding a version number to mounted resources (e.g. /css/all-42.css instead of /css/all.css). While wicket has the <a title="IResourceSettings#getAddLastModifiedTimeToResourceReferenceUrl()" href="http://wicket.apache.org/docs/1.4/org/apache/wicket/settings/IResourceSettings.html#getAddLastModifiedTimeToResourceReferenceUrl()" target="_blank">option to add a timestamp</a> to references (something like /css/all.css?t=20090924), <a href="http://developer.yahoo.com/performance/rules.html#expires" target="_blank">adding the version to the name is preferred</a> over adding a query string. This said, let&#8217;s see how to use wicketstuff-merged-resources&#8217; new version.<span id="more-113"></span></p>
<p>The main class now is <a title="SVN: ResourceMount.java" href="https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-merged-resources/src/main/java/org/wicketstuff/mergedresources/ResourceMount.java" target="_blank">ResourceMount</a> which replaces the deprecated <a title="SVN: ResourceMountHelper.java" href="https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/branches/wicket-1.3.x/wicketstuff-merged-resources/src/main/java/org/wicketstuff/mergedresources/ResourceMountHelper.java" target="_blank">ResourceMountHelper (already removed in trunk version)</a>. Mounting is now much simpler. Just see this example:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ResourceMount mount <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ResourceMount<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
.<span style="color: #006633;">setResourceVersionProvider</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RevisionVersionProvider<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
.<span style="color: #006633;">setPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/style/all.css&quot;</span><span style="color: #009900;">&#41;</span>
.<span style="color: #006633;">addResourceSpecsMatchingSuffix</span><span style="color: #009900;">&#40;</span>PanelOne.<span style="color: #000000; font-weight: bold;">class</span>, ComponentB.<span style="color: #000000; font-weight: bold;">class</span>, MyForm.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
.<span style="color: #006633;">mount</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Note that you still use the resources as you are used to, e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">add<span style="color: #009900;">&#40;</span>HeaderContributor.<span style="color: #006633;">forCss</span><span style="color: #009900;">&#40;</span>MyForm.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;MyForm.css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add<span style="color: #009900;">&#40;</span>HeaderContributor.<span style="color: #006633;">forJavaScript</span><span style="color: #009900;">&#40;</span>MyForm.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;MyForm.js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This example simply mounts PanelOne.css, ComponentB.css and MyForm.css into a single file at /style/all.css (the suffix &#8220;.css&#8221; is determined from the path &#8211; &#8220;/style/all.js&#8221; would mount all &#8220;.js&#8221; files). Additionally, the <a title="SVN: RevisionVersionProvider.java" href="https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-merged-resources/src/main/java/org/wicketstuff/mergedresources/versioning/RevisionVersionProvider.java">RevisionVersionProvider</a> is used to determine which version to append (you may implement your own <a title="SVN: IResourceVersionProvider.java" href="https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-merged-resources/src/main/java/org/wicketstuff/mergedresources/versioning/IResourceVersionProvider.java" target="_blank">IResourceVersionProvider</a> that best fits your environment). For example, the merged file may be mounted at /style/all-42.css (while still being available at /style/all.css through a permanent redirect).</p>
<p>While ResourceMount tries to autodetect most properties of the merged resource (e.g. style, locale, compression) it comes with a ton of customization options. For instance, it&#8217;s possible to use a custom <a title="JavaDoc: IRequestTargetUrlCodingStrategy" href="http://wicket.apache.org/docs/1.4/org/apache/wicket/request/target/coding/IRequestTargetUrlCodingStrategy.html" target="_blank">IRequestTargetUrlCodingStrategy</a>. Doesn&#8217;t that sound interesting to you? Well, we used this option to upload all resources to <a title="Amazon S3" href="https://s3.amazonaws.com/" target="_blank">Amazon Simple Storage Service</a>/<a title="Amazon CloudFront" href="http://aws.amazon.com/cloudfront/" target="_blank">CloudFront</a> in order to transparently leverage Amazon&#8217;s <a title="Wikipedia: Content Delivery Network" href="http://en.wikipedia.org/wiki/Content_delivery_network" target="_blank">CDN</a> by simply mounting them in <a title="Setlist.fm - A Molindo Wicket Application" href="http://www.setlist.fm/" target="_blank">our applications</a> (Isn&#8217;t that awesome? Stay tuned for another blog post!).</p>
<p><a title="Jörn Zäfferer's Blog" href="http://bassistance.de/" target="_blank">Jörn Zaefferer</a> suggested adding <a title="Wicketstuff Wiki: wicketstuff-annotations" href="http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-annotation" target="_blank">wicketstuff-annotations</a>-like mounting of (merged) resources using <a title="Java language guide: Annotations" href="http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html" target="_blank">annotations</a>, which will hopefully be added in a later version. In the meantime, I may provide Jörn&#8217;s solution for those interested (Jörn, you don&#8217;t mind, do you?) &#8211; just leave a message.</p>
<p>Additional feature include CSS compression using <a title="YUI Compressor" href="http://developer.yahoo.com/yui/compressor/" target="_blank">Yahoo&#8217;s YUI Compressor</a> and resource preprocessing. The later is particularly interesting, as you might implement things like replacing colors in CSS files or add internationalization from .properties files to JS files &#8211; just implement the <a title="SVN: IResourcePreProcessor" href="https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-merged-resources/src/main/java/org/wicketstuff/mergedresources/preprocess/IResourcePreProcessor.java" target="_blank">IResourcePreProcessor</a> interface (or use <a title="SVN: StringResourcePreProcessor" href="https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-merged-resources/src/main/java/org/wicketstuff/mergedresources/preprocess/StringResourcePreProcessor.java" target="_blank">StringResourcePreProcessor</a> if your only dealing with Strings).</p>
<p>I think I&#8217;ve mentioned the most important features now. Just <a title="WicketStuff Wiki: wicketstuff-merged-resources" href="http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-merged-resources" target="_blank">see wicketstuff-merged-resources in WicketStuff&#8217;s Wiki for more (and possibly up-to-date) documentation</a>. If you have any questions, don&#8217;t hesitate to post a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2009/09/wicketstuff-merged-resources-new-much-simpler-version.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

