<?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>wicket praxis &#187; jetty</title>
	<atom:link href="http://www.wicket-praxis.de/blog/tag/jetty/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wicket-praxis.de/blog</link>
	<description>erfahrungen mit wicket aus dem projektalltag</description>
	<lastBuildDate>Fri, 26 Aug 2011 11:14:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Wicket Tipps: Markup</title>
		<link>http://www.wicket-praxis.de/blog/2009/10/27/wicket-tipps-markup/</link>
		<comments>http://www.wicket-praxis.de/blog/2009/10/27/wicket-tipps-markup/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 07:05:16 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[reload]]></category>
		<category><![CDATA[resource]]></category>

		<guid isPermaLink="false">http://www.wicket-praxis.de/blog/?p=172</guid>
		<description><![CDATA[Ich benutze für alle Projekte Maven. Der eine oder andere mag mit Maven auf dem Kriegsfuß stehen (was ich zwar nicht verstehe, aber akzeptiere). Bisher war ich (und an anderer Stelle war es auch nicht notwendig, darüber nachzudenken) für eine saubere Trennung von Code und Resourcen. Das bedeutet z.B. das der Code einer Wicket-Komponente z.B. [...]]]></description>
			<content:encoded><![CDATA[<p>Ich benutze für alle Projekte Maven. Der eine oder andere mag mit Maven auf dem Kriegsfuß stehen (was ich zwar nicht verstehe, aber akzeptiere). Bisher war ich (und an anderer Stelle war es auch nicht notwendig, darüber nachzudenken) für eine saubere Trennung von Code und Resourcen. Das bedeutet z.B. das der Code einer Wicket-Komponente z.B. im Pfad src/main/java/de/wicketpraxis/ zu finden ist und das Markup in src/main/resources/de/wicketpraxis.</p>
<p>Das Projekt wächst und gedeiht und es entstehen unzählige Komponenten (ein Zeichen dafür, dass man mit Wicket sehr sehr einfach eigene Komponenten erstellen kann).&nbsp; Im Laufe der Zeit hat es sich als unpraktisch herausgestellt, in der IDE immer zwischen diesen beiden Verzeichnissen zu wechseln. Auch beim Refactoring kann es sich als lästig erweisen, weil man an zwei Stellen die selbe Operation anwenden muss (zumindest in Eclipse).</p>
<p>Ich habe daher alle Projekte umgestellt und kann nun die Markup-Dateien in das selbe Verzeichnis/Package wie die Komponente legen. Die Angst, dass die Übersichtlichkeit leidet, hat sich als unbegründet erwiesen, die Produktivität ist spürbar besser. Folgende Anpassung muss man daher in einem Projekt vornehmen. In der pom.xml ist folgender Block einzufügen:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="XML"><div class="devcodeoverflow"><ol><li>&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>...</li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/main/resources<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/main/java<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exclude<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>**/*.java<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exclude<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li>...</li><li>&nbsp;&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Wenn man nun die Anwendung über Jetty aus dem Projekt heraus starten möchte, empfiehlt sich ein Ansatz, den ich bereits im folgenden Beitrag erwähnt habe: <a href="http://www.wicket-praxis.de/blog/2008/12/31/wicket-resourcen-mit-jetty-nachladen/" target="_blank">Wicket Resourcen mit Jetty nachladen</a>. Allerdings müssen wir dazu den angepassten ResourceStreamLocator entsprechend erweitern. Am besten wir schreiben eine neue Klasse:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wicketpraxis.wicket.util.resource</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.util.file.File</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.util.resource.FileResourceStream</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.util.resource.IResourceStream</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.util.resource.locator.ResourceStreamLocator</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.Logger</span><span style="color: #339933;">;</span></li><li><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.LoggerFactory</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MavenDevResourceAndSourceStreamLocator <span style="color: #000000; font-weight: bold;">extends</span> ResourceStreamLocator</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399; font-weight: bold;">Logger</span> _logger = LoggerFactory.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>MavenDevResourceAndSourceStreamLocator.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399; font-weight: bold;">String</span> MAVEN_RESOURCE_PATH=<span style="color: #0000ff;">&quot;src/main/resources/&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399; font-weight: bold;">String</span> MAVEN_JAVASOURCE_PATH=<span style="color: #0000ff;">&quot;src/main/java/&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;@<span style="color: #003399; font-weight: bold;">Override</span></li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> IResourceStream locate<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399; font-weight: bold;">Class</span><span style="color: #339933;">&lt;?&gt;</span> clazz, <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399; font-weight: bold;">String</span> path<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;IResourceStream located=getFileSysResourceStream<span style="color: #009900;">&#40;</span>MAVEN_RESOURCE_PATH,path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>located==<span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;located=getFileSysResourceStream<span style="color: #009900;">&#40;</span>MAVEN_JAVASOURCE_PATH,path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>located <span style="color: #339933;">!</span>= <span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_logger.<span style="color: #006633;">isInfoEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> _logger.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Locate: &quot;</span> + clazz + <span style="color: #0000ff;">&quot; in &quot;</span> + path+<span style="color: #0000ff;">&quot; -&gt; &quot;</span>+located<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> located<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;located=<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">locate</span><span style="color: #009900;">&#40;</span>clazz, path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_logger.<span style="color: #006633;">isInfoEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> _logger.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Locate: &quot;</span> + clazz + <span style="color: #0000ff;">&quot; in &quot;</span> + path+<span style="color: #0000ff;">&quot; -&gt; &quot;</span>+located+<span style="color: #0000ff;">&quot;(Fallback)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp;&nbsp;&nbsp;&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> located<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> IResourceStream getFileSysResourceStream<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> prefix, <span style="color: #003399; font-weight: bold;">String</span> path<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399; font-weight: bold;">File</span> f=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">File</span><span style="color: #009900;">&#40;</span>prefix+path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>f.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>f.<span style="color: #006633;">isFile</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> FileResourceStream<span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #006600; font-weight: bold;">null</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Die Einbindung funktioniert wie beim letzten Mal:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Java(TM) 2 Platform Standard Edition 5.0"><div class="devcodeoverflow"><ol><li><span style="color: #000000;&nbsp;&nbsp;font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>DEVELOPMENT.<span style="color: #006633;">equalsIgnoreCase</span><span style="color: #009900;">&#40;</span>configurationType<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;getResourceSettings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setResourceStreamLocator</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MavenDevResourceAndSourceStreamLocator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Jetzt sollte man (wenn alles andere entsprechend vorbereitet ist) mit <strong>mvn jetty:run -Dwicket.configuration=development</strong> Jetty aus dem Projekt heraus starten können. Sobald man Änderungen am Markup vorgenommen hat, werden diese neu geladen.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F10%2F27%2Fwicket-tipps-markup%2F&amp;title=Wicket%20Tipps%3A%20Markup&amp;bodytext=Ich%20benutze%20f%C3%BCr%20alle%20Projekte%20Maven.%20Der%20eine%20oder%20andere%20mag%20mit%20Maven%20auf%20dem%20Kriegsfu%C3%9F%20stehen%20%28was%20ich%20zwar%20nicht%20verstehe%2C%20aber%20akzeptiere%29.%20Bisher%20war%20ich%20%28und%20an%20anderer%20Stelle%20war%20es%20auch%20nicht%20notwendig%2C%20dar%C3%BCber%20nachzudenken%29%20f%C3%BCr%20eine%20sau" title="Digg"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F10%2F27%2Fwicket-tipps-markup%2F" title="Sphinn"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F10%2F27%2Fwicket-tipps-markup%2F&amp;title=Wicket%20Tipps%3A%20Markup&amp;notes=Ich%20benutze%20f%C3%BCr%20alle%20Projekte%20Maven.%20Der%20eine%20oder%20andere%20mag%20mit%20Maven%20auf%20dem%20Kriegsfu%C3%9F%20stehen%20%28was%20ich%20zwar%20nicht%20verstehe%2C%20aber%20akzeptiere%29.%20Bisher%20war%20ich%20%28und%20an%20anderer%20Stelle%20war%20es%20auch%20nicht%20notwendig%2C%20dar%C3%BCber%20nachzudenken%29%20f%C3%BCr%20eine%20sau" title="del.icio.us"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F10%2F27%2Fwicket-tipps-markup%2F&amp;t=Wicket%20Tipps%3A%20Markup" title="Facebook"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F10%2F27%2Fwicket-tipps-markup%2F&amp;title=Wicket%20Tipps%3A%20Markup" title="Mixx"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2009%2F10%2F27%2Fwicket-tipps-markup%2F&amp;title=Wicket%20Tipps%3A%20Markup&amp;annotation=Ich%20benutze%20f%C3%BCr%20alle%20Projekte%20Maven.%20Der%20eine%20oder%20andere%20mag%20mit%20Maven%20auf%20dem%20Kriegsfu%C3%9F%20stehen%20%28was%20ich%20zwar%20nicht%20verstehe%2C%20aber%20akzeptiere%29.%20Bisher%20war%20ich%20%28und%20an%20anderer%20Stelle%20war%20es%20auch%20nicht%20notwendig%2C%20dar%C3%BCber%20nachzudenken%29%20f%C3%BCr%20eine%20sau" title="Google Bookmarks"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
<div id="vgwpixel"></div><h3  class="related_post_title">Andere Beiträge</h3><ul class="related_post"><li>31. Dezember 2008 -- <a href="http://www.wicket-praxis.de/blog/2008/12/31/wicket-resourcen-mit-jetty-nachladen/" title="Wicket Resourcen mit Jetty nachladen">Wicket Resourcen mit Jetty nachladen</a></li><li>13. Januar 2010 -- <a href="http://www.wicket-praxis.de/blog/2010/01/13/wicket-und-eclipse/" title="Wicket und Eclipse">Wicket und Eclipse</a></li><li>29. April 2011 -- <a href="http://www.wicket-praxis.de/blog/2011/04/29/wicket-back-button-detect/" title="Wicket &#8211; Back Button zuverlässig erkennen">Wicket &#8211; Back Button zuverlässig erkennen</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wicket-praxis.de/blog/2009/10/27/wicket-tipps-markup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wicket Resourcen mit Jetty nachladen</title>
		<link>http://www.wicket-praxis.de/blog/2008/12/31/wicket-resourcen-mit-jetty-nachladen/</link>
		<comments>http://www.wicket-praxis.de/blog/2008/12/31/wicket-resourcen-mit-jetty-nachladen/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 14:56:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[hotdeploy]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[reload]]></category>
		<category><![CDATA[resource]]></category>

		<guid isPermaLink="false">http://www.wicket-praxis.de/blog/?p=4</guid>
		<description><![CDATA[Bei großen Wicket-Projekten kann das hotdeployment des maven jetty plugins schonmal dazu führen, dass aus dem Vorteil ein Nachteil wird. Dabei ist das Ziel recht einfach: Nur die Html-Templates für die Wicket-Komponenten sollen neu geladen werden, wenn sich da was verändert hat. Alle Vorschläge aus den Foren sind mir zu aufwendig Außerdem mag ich die [...]]]></description>
			<content:encoded><![CDATA[<p>Bei großen Wicket-Projekten kann das hotdeployment des maven jetty plugins schonmal dazu führen, dass aus dem Vorteil ein Nachteil wird. Dabei ist das Ziel recht einfach: Nur die Html-Templates für die Wicket-Komponenten sollen neu geladen werden, wenn sich da was verändert hat. Alle Vorschläge aus den Foren sind mir zu aufwendig Außerdem mag ich die Html-Dateien nicht in das selbe Verzeichnis wie die Quelltexte legen. Ich habe mir daher einen für das Problem angepassten ResourceStreamLocator geschrieben:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Java"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MavenDevResourceStreamLocator <span style="color: #000000; font-weight: bold;">extends</span> ResourceStreamLocator</li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;<span style="color: #003399;">String</span> _prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;src/main/resources/&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> IResourceStream locate<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">Class</span> clazz, <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> path<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;IResourceStream located<span style="color: #339933;">=</span>getFileSysResourceStream<span style="color: #009900;">&#40;</span>path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>located <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">// alles ok</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> located<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #666666; font-style: italic;">// fallback</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;located<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">locate</span><span style="color: #009900;">&#40;</span>clazz, path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> located<span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;</li><li>&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> IResourceStream getFileSysResourceStream<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> path<span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #003399;">File</span> f<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>_prefix<span style="color: #339933;">+</span>path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>f.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>f.<span style="color: #006633;">isFile</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> FileResourceStream<span style="color: #009900;">&#40;</span>f<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--><br />
Eingebaut wird das dann in die init-Methode der Application-Klasse wie folgt:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Java"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>DEVELOPMENT.<span style="color: #006633;">equalsIgnoreCase</span><span style="color: #009900;">&#40;</span>configurationType<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li><span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;getResourceSettings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setResourceStreamLocator</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MavenDevResourceStreamLocator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--><br />
Und schon werden alle Änderungen an den Html-Dateien sichtbar.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2008%2F12%2F31%2Fwicket-resourcen-mit-jetty-nachladen%2F&amp;title=Wicket%20Resourcen%20mit%20Jetty%20nachladen&amp;bodytext=Bei%20gro%C3%9Fen%20Wicket-Projekten%20kann%20das%20hotdeployment%20des%20maven%20jetty%20plugins%20schonmal%20dazu%20f%C3%BChren%2C%20dass%20aus%20dem%20Vorteil%20ein%20Nachteil%20wird.%20Dabei%20ist%20das%20Ziel%20recht%20einfach%3A%20Nur%20die%20Html-Templates%20f%C3%BCr%20die%20Wicket-Komponenten%20sollen%20neu%20geladen%20werden%2C" title="Digg"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2008%2F12%2F31%2Fwicket-resourcen-mit-jetty-nachladen%2F" title="Sphinn"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2008%2F12%2F31%2Fwicket-resourcen-mit-jetty-nachladen%2F&amp;title=Wicket%20Resourcen%20mit%20Jetty%20nachladen&amp;notes=Bei%20gro%C3%9Fen%20Wicket-Projekten%20kann%20das%20hotdeployment%20des%20maven%20jetty%20plugins%20schonmal%20dazu%20f%C3%BChren%2C%20dass%20aus%20dem%20Vorteil%20ein%20Nachteil%20wird.%20Dabei%20ist%20das%20Ziel%20recht%20einfach%3A%20Nur%20die%20Html-Templates%20f%C3%BCr%20die%20Wicket-Komponenten%20sollen%20neu%20geladen%20werden%2C" title="del.icio.us"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2008%2F12%2F31%2Fwicket-resourcen-mit-jetty-nachladen%2F&amp;t=Wicket%20Resourcen%20mit%20Jetty%20nachladen" title="Facebook"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2008%2F12%2F31%2Fwicket-resourcen-mit-jetty-nachladen%2F&amp;title=Wicket%20Resourcen%20mit%20Jetty%20nachladen" title="Mixx"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.wicket-praxis.de%2Fblog%2F2008%2F12%2F31%2Fwicket-resourcen-mit-jetty-nachladen%2F&amp;title=Wicket%20Resourcen%20mit%20Jetty%20nachladen&amp;annotation=Bei%20gro%C3%9Fen%20Wicket-Projekten%20kann%20das%20hotdeployment%20des%20maven%20jetty%20plugins%20schonmal%20dazu%20f%C3%BChren%2C%20dass%20aus%20dem%20Vorteil%20ein%20Nachteil%20wird.%20Dabei%20ist%20das%20Ziel%20recht%20einfach%3A%20Nur%20die%20Html-Templates%20f%C3%BCr%20die%20Wicket-Komponenten%20sollen%20neu%20geladen%20werden%2C" title="Google Bookmarks"><img src="http://www.wicket-praxis.de/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
</ul>
</div>
<div id="vgwpixel"></div><h3  class="related_post_title">Andere Beiträge</h3><ul class="related_post"><li>27. Oktober 2009 -- <a href="http://www.wicket-praxis.de/blog/2009/10/27/wicket-tipps-markup/" title="Wicket Tipps: Markup">Wicket Tipps: Markup</a></li><li>29. April 2011 -- <a href="http://www.wicket-praxis.de/blog/2011/04/29/wicket-back-button-detect/" title="Wicket &#8211; Back Button zuverlässig erkennen">Wicket &#8211; Back Button zuverlässig erkennen</a></li><li>24. Oktober 2010 -- <a href="http://www.wicket-praxis.de/blog/2010/10/24/wicket-mainstream-github-mongodb/" title="Wicket &#8211; Mainstream, Github, MongoDB">Wicket &#8211; Mainstream, Github, MongoDB</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wicket-praxis.de/blog/2008/12/31/wicket-resourcen-mit-jetty-nachladen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 14/31 queries in 0.023 seconds using disk: basic
Object Caching 854/855 objects using disk: basic

Served from: www.wicket-praxis.de @ 2012-02-06 20:12:15 -->
