<?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>javablog.ch&#187; Webapplikation Workout</title>
	<atom:link href="http://www.javablog.ch/category/webapplikation-workout/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javablog.ch</link>
	<description>Keep on learning...</description>
	<lastBuildDate>Sun, 04 Dec 2011 17:15:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Private Methoden in JavaScript dank Closures</title>
		<link>http://www.javablog.ch/2008/07/22/private-methoden-in-javascript-dank-closures/</link>
		<comments>http://www.javablog.ch/2008/07/22/private-methoden-in-javascript-dank-closures/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 13:42:22 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Webapplikation Workout]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2008/07/22/private-methoden-in-javascript-dank-closures/</guid>
		<description><![CDATA[Momentan lese ich das Buch &#8220;JavaScript: The Good Parts&#8221; von Douglas Crockford. Ein durchweg empfehlenswertes Buch, das eine klare und kompakte Übersicht über die Stärken (und Schwächen) von JavaScript bietet. Sehr interessant ist das &#8220;Functional&#8221;-Pattern: Mit Hilfe von Closures können private Instanzvariablen und Methoden definiert werden. In 4 Schritten erstellt eine sogenannte &#8220;Maker&#8221;-Methode eine neue [...]]]></description>
			<content:encoded><![CDATA[<p>Momentan lese ich das Buch &#8220;JavaScript: The Good Parts&#8221; von <a href="http://www.crockford.com">Douglas Crockford</a>. Ein durchweg empfehlenswertes Buch, das eine klare und kompakte Übersicht über die Stärken (und Schwächen) von JavaScript bietet. Sehr interessant ist das &#8220;Functional&#8221;-Pattern: Mit Hilfe von Closures können private Instanzvariablen und Methoden definiert werden. In 4 Schritten erstellt eine sogenannte &#8220;Maker&#8221;-Methode eine neue Objekt-Instanz. </p>
<ol>
<li>Erzeuge ein neues Objekt</li>
<li>Definiere in der Methode die (privaten) Instanzvariablen und Methoden.</li>
<li>Hänge an das neue Objekt die öffentlichen Methoden. Dank dem &#8220;Closure&#8221;-Prinzip haben nur diese Methoden Zugriff auf die vorher definierten Instanzvariablen und Methoden.</li>
<li>Gebe das neue Objekt zurück.</li>
<p>Hier das Beispiel:</p>
<div class="codeblock">
<div class="javascript" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> vehicle = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>spec<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #009900; font-style: italic;">// the spec object contains all attributes needed to create the object.</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #009900; font-style: italic;">// create a new empty object using the object literal</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> o = <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>; &nbsp; &nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #009900; font-style: italic;">// vars of this function are the private variables of the new object</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> age &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color: #CC0000;">0</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> maxSpeed &nbsp; &nbsp; &nbsp; = spec.<span style="color: #006600;">maxSpeed</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = spec.<span style="color: #000066;">name</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> price &nbsp; &nbsp; &nbsp;= spec.<span style="color: #006600;">price</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #009900; font-style: italic;">// private methods</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> calculateDegradation = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> age * price / <span style="color: #CC0000;">10</span> ; <span style="color: #009900; font-style: italic;">// assuming linear degradation</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>; &nbsp; &nbsp; </div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #009900; font-style: italic;">// public methods</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;o.<span style="color: #006600;">getName</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066;">name</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;o.<span style="color: #006600;">getMaxSpeed</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> maxSpeed;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;o.<span style="color: #006600;">setAge</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>v<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;age = v;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> o; <span style="color: #009900; font-style: italic;">// cascade pattern</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;o.<span style="color: #006600;">getResidualValue</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> price - calculateDegradation<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> o;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> myVehicle = vehicle<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #000066;">name</span>: <span style="color: #3366CC;">'Audi R8'</span>,</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; price: <span style="color: #3366CC;">'106400'</span>,</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxSpeed: <span style="color: #3366CC;">'301'</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>myVehicle.<span style="color: #006600;">getMaxSpeed</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// 301</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>myVehicle.<span style="color: #006600;">getResidualValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// 106400;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>myVehicle.<span style="color: #006600;">setAge</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getResidualValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// 85120;</span></div></li></ol></div>
</div>
<p>Interessant ist die Ansicht im Firebug: Keine Spur von den privaten Methoden oder Instanzvariablen. Sie werden durch das  &#8220;Closure&#8221; geschützt.</p>
<p><img src="http://www.javablog.ch/wp-content/uploads/2008/07/firebug.jpg" alt="myVehicle Ansicht im Firebug zeigt nur die öffentlichen Methoden." /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2008/07/22/private-methoden-in-javascript-dank-closures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Caching mit OSCache Teil 3</title>
		<link>http://www.javablog.ch/2007/08/21/caching-mit-os-cache-teil-3/</link>
		<comments>http://www.javablog.ch/2007/08/21/caching-mit-os-cache-teil-3/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 22:27:39 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Webapplikation Workout]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2007/08/21/caching-mit-os-cache-teil-3/</guid>
		<description><![CDATA[Mit der Taglibrary von OSCache können einzelne Segmente innerhalb einer JSP gecached werden. Das &#8220;cache&#8221;-Tag führt den Tag-Body aus und cached anschliessend das Ergebnis (also den Output). Dabei kann der JSP-Entwickler entscheiden, wie lange und in welchem Scope (Application oder Session) der Body Content gecached werden soll. Die Konfiguration des Algorithmus sowie die maximale Anzahl [...]]]></description>
			<content:encoded><![CDATA[<p>Mit der Taglibrary von OSCache können einzelne Segmente innerhalb einer JSP gecached werden. Das &#8220;cache&#8221;-Tag führt den Tag-Body aus und cached anschliessend das Ergebnis (also den Output). Dabei kann der JSP-Entwickler entscheiden, wie lange und in welchem Scope (Application oder Session) der Body Content gecached werden soll.</p>
<p>Die Konfiguration des Algorithmus sowie die maximale Anzahl Objekte im Cache werden in einem property-File (<code>oscache.properties</code>) vorgenommen, welches in das <code>WEB-INF/classes</code> Verzeichnis platziert wird.</p>
<p>Das nachfolgende Beispiel cached zwei Datumsobjekte. Das erste wird für 5 Sekunden im Application Scope gecached. Das zweite für 10 Sekunden im Session Scope (jede Session bekommt also ein eigenes gecachetes Objekt).</p>
<div class="codeblock">
<div class="java" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;head&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;meta http-equiv=<span style="color: #CF6F35;">&quot;Content-Type&quot;</span> content=<span style="color: #CF6F35;">&quot;text/html; charset=UTF-8&quot;</span>&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/head&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;body&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1&gt;Cached <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AObject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #415D77; ">Object</span></a> <span style="color: #cc66cc;">1</span>&lt;/h1&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cache:cache time=<span style="color: #CF6F35;">&quot;5&quot;</span> &gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;jsp:useBean id=<span style="color: #CF6F35;">&quot;now&quot;</span> scope=<span style="color: #CF6F35;">&quot;page&quot;</span> <span style="color: #222222; font-weight: bold;">class</span>=<span style="color: #CF6F35;">&quot;java.util.Date&quot;</span>/&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;c:out value=<span style="color: #CF6F35;">&quot;${now}&quot;</span>/&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/cache:cache&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;-- now ist nur dann vorhanden, wenn der Body des obigen Cache Tag ausgewertet wird <span style="color: #111111;">&#40;</span>beim ersten Mal und nach Ablauf der Cache Zeit<span style="color: #111111;">&#41;</span> --&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;c:out value=<span style="color: #CF6F35;">&quot;${now}&quot;</span>/&gt; &nbsp; &nbsp; </div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;h1&gt;Cached <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AObject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #415D77; ">Object</span></a> <span style="color: #cc66cc;">2</span>&lt;/h1&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;cache:cache time=<span style="color: #CF6F35;">&quot;10&quot;</span> scope=<span style="color: #CF6F35;">&quot;session&quot;</span> &gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;jsp:useBean id=<span style="color: #CF6F35;">&quot;nowInSession&quot;</span> scope=<span style="color: #CF6F35;">&quot;page&quot;</span> <span style="color: #222222; font-weight: bold;">class</span>=<span style="color: #CF6F35;">&quot;java.util.Date&quot;</span>/&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;c:out value=<span style="color: #CF6F35;">&quot;${nowInSession}&quot;</span>/&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/cache:cache&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/body&gt;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/html&gt;</div></li></ol></div>
</div>
<p>Die (sehr gute Dokumentation) der Taglibrary gibts unter<br />
<a href="http://www.opensymphony.com/oscache/wiki/JSP%20Tags.html#JSPTags-cache">http://www.opensymphony.com/oscache/wiki/JSP%20Tags.html#JSPTags-cache</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2007/08/21/caching-mit-os-cache-teil-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Caching mit OSCache Teil 2</title>
		<link>http://www.javablog.ch/2007/07/01/caching-mit-oscache-teil-2/</link>
		<comments>http://www.javablog.ch/2007/07/01/caching-mit-oscache-teil-2/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 20:37:42 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Webapplikation Workout]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2007/07/01/caching-mit-oscache-teil-2/</guid>
		<description><![CDATA[Zentrales Element im OSCache sind die konkreten Implementierungen der AbstractCacheAdministrators Klasse. OSCache bietet zwei Implementierungen: GeneralCacheAdministrator Eine generelle Implementierung, die auch für Desktopanwendungen eingesetzt werden kann. ServletCacheAdministrator Spezialisiert auf Caching im Servlet-Umfeld, kann unter anderem auf Session oder ServletContext-Ebene cachen. Die Funktionsweise eines CacheAdministrators ähnelt einer HashMap, geht aber weit darüber hinaus. So können Cache-Einträge [...]]]></description>
			<content:encoded><![CDATA[<p>Zentrales Element im OSCache sind die konkreten Implementierungen der <code>AbstractCacheAdministrators </code>Klasse. OSCache bietet zwei Implementierungen: </p>
<ul>
<li><code><a href="http://www.opensymphony.com/oscache/api/com/opensymphony/oscache/general/GeneralCacheAdministrator.html">GeneralCacheAdministrator </a></code><br />
Eine generelle Implementierung, die auch für Desktopanwendungen eingesetzt werden kann.</li>
<li><code><a href="http://www.opensymphony.com/oscache/api/com/opensymphony/oscache/web/ServletCacheAdministrator.html">ServletCacheAdministrator </a></code><br />
Spezialisiert auf Caching im Servlet-Umfeld, kann unter anderem auf <code>Session </code>oder <code>ServletContext</code>-Ebene cachen.
</li>
</ul>
<p>Die Funktionsweise eines CacheAdministrators ähnelt einer HashMap, geht aber weit darüber hinaus. So können Cache-Einträge ablaufen und müssen bei erneuten Zugriffsversuch erneuert werden. Auch die Anzahl von Cache-Einträgen soll limitiert werden. Mit der Methode <code>setAlgorithmClass(String clazz)</code> kann der Algorithmus konfiguriert werden.<br />
Zur Verfügung stehen:</p>
<ul>
<li>FIFOCache</li>
<li>LRUCache</li>
<li>UnlimitedCache</li>
</ul>
<p><strong>Beispiel:</strong><br />
Das nachfolgende Beispiel verwendetet einen FIFOCache mit max. 20 Cache-Einträgen. Unter dem Key &#8220;myKey&#8221; wird ein String in den Cache abgelegt und anschliessend 2x darauf zugegriffen. Beim zweiten Mal ist dieses Objekt &#8220;abgelaufen&#8221; und muss erneuert werden.</p>
<div class="codeblock">
<div class="java" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GeneralCacheAdministrator cAdmin = <span style="color: #222222; font-weight: bold;">new</span> GeneralCacheAdministrator<span style="color: #111111;">&#40;</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; cAdmin.<span style="color: #537799;font-weight: bold;">setAlgorithmClass</span><span style="color: #111111;">&#40;</span><span style="color: #CF6F35;">&quot;com.opensymphony.oscache.base.algorithm.FIFOCache&quot;</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; cAdmin.<span style="color: #537799;font-weight: bold;">setCacheCapacity</span><span style="color: #111111;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; cAdmin.<span style="color: #537799;font-weight: bold;">putInCache</span><span style="color: #111111;">&#40;</span><span style="color: #CF6F35;">&quot;myKey&quot;</span>, <span style="color: #CF6F35;">&quot;myObject&quot;</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// first attempt to access the cache object</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #222222; font-weight: bold;">try</span> <span style="color: #111111;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #415D77; ">System</span></a>.<span style="color: #537799;font-weight: bold;">out</span>.<span style="color: #537799;font-weight: bold;">println</span><span style="color: #111111;">&#40;</span>cAdmin.<span style="color: #537799;font-weight: bold;">getFromCache</span><span style="color: #111111;">&#40;</span><span style="color: #CF6F35;">&quot;myKey&quot;</span>, <span style="color: #cc66cc;">2</span><span style="color: #111111;">&#41;</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// OK, object is not &quot;older&quot; than 2 seconds</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #111111;">&#125;</span> <span style="color: #222222; font-weight: bold;">catch</span> <span style="color: #111111;">&#40;</span>NeedsRefreshException nre<span style="color: #111111;">&#41;</span> <span style="color: #111111;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #415D77; ">System</span></a>.<span style="color: #537799;font-weight: bold;">out</span>.<span style="color: #537799;font-weight: bold;">println</span><span style="color: #111111;">&#40;</span><span style="color: #CF6F35;">&quot;expired object:=&quot;</span> + nre.<span style="color: #537799;font-weight: bold;">getCacheContent</span><span style="color: #111111;">&#40;</span><span style="color: #111111;">&#41;</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #111111;">&#125;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Sleep 3 seconds</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AThread+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #415D77; ">Thread</span></a>.<span style="color: #537799;font-weight: bold;">currentThread</span><span style="color: #111111;">&#40;</span><span style="color: #111111;">&#41;</span>.<span style="color: #537799;font-weight: bold;">sleep</span><span style="color: #111111;">&#40;</span><span style="color: #cc66cc;">3000</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #222222; font-weight: bold;">try</span> <span style="color: #111111;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #415D77; ">System</span></a>.<span style="color: #537799;font-weight: bold;">out</span>.<span style="color: #537799;font-weight: bold;">println</span><span style="color: #111111;">&#40;</span>cAdmin.<span style="color: #537799;font-weight: bold;">getFromCache</span><span style="color: #111111;">&#40;</span><span style="color: #CF6F35;">&quot;myKey&quot;</span>, <span style="color: #cc66cc;">2</span><span style="color: #111111;">&#41;</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// NOT OK, object is definately older than 2 seconds</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// --&gt; NeedsRefreshException will be thrown</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #111111;">&#125;</span> <span style="color: #222222; font-weight: bold;">catch</span> <span style="color: #111111;">&#40;</span>NeedsRefreshException nre<span style="color: #111111;">&#41;</span> <span style="color: #111111;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #415D77; ">System</span></a>.<span style="color: #537799;font-weight: bold;">out</span>.<span style="color: #537799;font-weight: bold;">println</span><span style="color: #111111;">&#40;</span><span style="color: #CF6F35;">&quot;expired object:=&quot;</span> + nre.<span style="color: #537799;font-weight: bold;">getCacheContent</span><span style="color: #111111;">&#40;</span><span style="color: #111111;">&#41;</span><span style="color: #111111;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #111111;">&#125;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; cAdmin.<span style="color: #537799;font-weight: bold;">destroy</span><span style="color: #111111;">&#40;</span><span style="color: #111111;">&#41;</span>;</div></li></ol></div>
</div>
<p><strong>Ausgabe:</strong><br />
<code>myObject<br />
expired object:=myObject</code></p>
<p>Das Cachingframework bietet zusätzlich eine eigene JSP-Taglibrary und einen Servlet-Filter, der transparent für die Applikation ganze Seiten oder binäre Dateien cachen kann. Mehr dazu im 3. Teil.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2007/07/01/caching-mit-oscache-teil-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Caching mit OSCache Teil 1</title>
		<link>http://www.javablog.ch/2007/06/18/caching-mit-oscache-teil-1/</link>
		<comments>http://www.javablog.ch/2007/06/18/caching-mit-oscache-teil-1/#comments</comments>
		<pubDate>Mon, 18 Jun 2007 21:36:41 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Webapplikation Workout]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2007/06/18/caching-mit-oscache-teil-1/</guid>
		<description><![CDATA[Caching spielt bei der Entwicklung von Webapplikation eine entscheidende Rolle. Nicht jedes Element auf einer Seite soll bei einem Request komplett neu generiert werden. Beispiel dafür sind RSS-Feeds, die in Form einer Newsliste auf einer Homepage dargestellt werden. Hier soll nicht bei jedem Request der RSS-Feed vom anderen Server abgeholt und neu geparst werden, da [...]]]></description>
			<content:encoded><![CDATA[<p>Caching spielt bei der Entwicklung von Webapplikation eine entscheidende Rolle. Nicht jedes Element auf einer Seite soll bei einem Request komplett neu generiert werden. Beispiel dafür sind RSS-Feeds, die in Form einer Newsliste auf einer Homepage dargestellt werden. Hier soll nicht bei jedem Request der RSS-Feed vom anderen Server abgeholt und neu geparst werden, da jedes Einlesen mit erheblichen Zeitaufwand verbunden ist.</p>
<p>Eine typische Lösung ist, den RSS-Feed nach dem ersten eintreffenden Request für eine Zeitspanne (z.B. für eine Stunde) im RAM zu halten. Jeder weitere Request innerhalb dieser Zeitspanne verwendet das gecachte Objekt. Nach Ablauf dieser Zeitspanne verfällt der Cacheeintrag und der nächste Request sorgt dafür, dass der RSS-Feed neu generiert wird und wieder in den Cache abgelegt wird.</p>
<p>Man kann sich so einen Cachingmechanismus mit Hilfe einer HashMap und einem Object-Wrapper selber bauen. Oder man spart sich die Arbeit und nutzt ein vorhandenes Caching-Framework wie <a href="http://wiki.opensymphony.com/display/CACHE/Home">OSCache </a>von <a href="http://www.opensymphony.com/">OpenSymphony</a>.</p>
<p>OSCache bietet generische Caching-Klassen mit unterschiedlichen Cache-Algorithmen wie Least Recently Used oder FIFO. Die Cache-Einträge können zudem persistiert werden, damit sie einen Webserver Neustart überleben und nicht neu generiert werden müssen.</p>
<p>Mehr zum Einsatz dieser Cache-Bibliothek gibts im zweiten Teil.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2007/06/18/caching-mit-oscache-teil-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JavaScript Verifier: JSLint</title>
		<link>http://www.javablog.ch/2007/05/03/javascript-verifier-jslint/</link>
		<comments>http://www.javablog.ch/2007/05/03/javascript-verifier-jslint/#comments</comments>
		<pubDate>Thu, 03 May 2007 20:21:02 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Webapplikation Workout]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2007/05/03/javascript-verifier-jslint/</guid>
		<description><![CDATA[Manchmal darf man als Java-Entwickler auch JavaScript programmieren. Dabei stört mich der fehlende Compiler, der den Code auf Tippfehler oder versehentlich definierte globale Variablen überprüft. Abhilfe schafft JSLint, ein JavaScript Programm, das JavaScript validiert. Neben Fehlern werden auch Coderichtlinien wie Klammersetzung oder Variablennamen berücksichtigt. Abschliessend noch ein Zitat von Douglas Crockford (Entwickler von JSLint): JSLint [...]]]></description>
			<content:encoded><![CDATA[<p>Manchmal darf man als Java-Entwickler auch JavaScript programmieren. Dabei stört mich der fehlende Compiler, der den Code auf Tippfehler oder versehentlich definierte globale Variablen überprüft. Abhilfe schafft <a href="http://www.jslint.com">JSLint</a>, ein JavaScript Programm, das JavaScript validiert. Neben Fehlern werden auch Coderichtlinien wie Klammersetzung oder Variablennamen berücksichtigt. </p>
<p>Abschliessend noch ein Zitat von Douglas Crockford (Entwickler von JSLint):</p>
<blockquote><p>
JSLint will hurt your feelings</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2007/05/03/javascript-verifier-jslint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yahoo! User Interface Library(YUI)</title>
		<link>http://www.javablog.ch/2006/12/28/yahoo-user-interface-libraryyui/</link>
		<comments>http://www.javablog.ch/2006/12/28/yahoo-user-interface-libraryyui/#comments</comments>
		<pubDate>Thu, 28 Dec 2006 11:12:47 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Webapplikation Workout]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2006/12/28/yahoo-user-interface-libraryyui/</guid>
		<description><![CDATA[Mit dem Web 2.0 Hype kam eine Vielzahl von Javascript Frameworks. Neben der obligatorischen Unterstützung für asynchrone Requests bieten diese Frameworks auch zusätzliche Features wie Animation oder eigene UI-Controls. Diese Woche habe ich mir die Yahoo! User Interface Library (YUI) genauer angeschaut und bin bis jetzt begeistert. Typischerweise zeichnen sich die bisherigen JavaScript Frameworks wie [...]]]></description>
			<content:encoded><![CDATA[<p>Mit dem Web 2.0 Hype kam eine <a href="http://ajaxpatterns.org/Javascript_Multipurpose_Frameworks">Vielzahl von Javascript Frameworks</a>. Neben der obligatorischen Unterstützung für asynchrone Requests bieten diese Frameworks auch zusätzliche Features wie Animation oder eigene UI-Controls. Diese Woche habe ich mir die <a href="http://developer.yahoo.com/yui/">Yahoo! User Interface Library (YUI)</a> genauer angeschaut und bin bis jetzt begeistert.</p>
<p>Typischerweise zeichnen sich die bisherigen JavaScript Frameworks wie <a href="http://www.dojotoolkit.org/">Dojo </a>oder <a href="http://openrico.org">Rico</a> durch eine eher dürftige Dokumentation aus. Dagegen ist die YUI Library von Yahoo vorbildlich dokumentiert. Besonders gefällt mir die hohe Anzahl an Code-Beispielen und die &#8220;Cheat Sheets&#8221;, die eine sehr schnelle Einarbeitung in die Library ermöglichen. </p>
<p><strong>Beispiele:</strong><br />
<a href="http://developer.yahoo.com/yui/docs/assets/cheatsheets/animation.pdf">Cheat Sheet für das &#8220;Animation&#8221; Modul</a><br />
<a href="http://developer.yahoo.com/yui/autocomplete/">Dokumentation für das &#8220;Autocomplete&#8221; Modul</a>  </p>
<p>Ach ja: Die Library ist Open Source (unter der BSD Lizenz). </p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2006/12/28/yahoo-user-interface-libraryyui/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HttpSession über mehrere Webapplikationen?</title>
		<link>http://www.javablog.ch/2006/12/10/httpsession-uber-mehrere-webapplikationen/</link>
		<comments>http://www.javablog.ch/2006/12/10/httpsession-uber-mehrere-webapplikationen/#comments</comments>
		<pubDate>Sun, 10 Dec 2006 17:09:38 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Webapplikation Workout]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2006/12/10/httpsession-uber-mehrere-webapplikationen/</guid>
		<description><![CDATA[Webapplikationen können über die HttpSession keine Daten austauschen, da eine HttpSession immer an einen ServletContext gebunden ist. Wenn eine Webapplikation eine andere Webapplikation über den RequestDispatcher inkludiert, wird zwar eine Session mit der gleichen(!) SessionID erzeugt, es sind aber effektiv zwei HttpSession Objekte vorhanden. Vergleiche Servlet Specification 2.4. (Kapitel 15.1.7) Session information is scoped only [...]]]></description>
			<content:encoded><![CDATA[<p>Webapplikationen können über die <code>HttpSession </code>keine Daten austauschen, da eine <code>HttpSession </code>immer an einen <code>ServletContext </code>gebunden ist. Wenn eine Webapplikation eine andere Webapplikation über den <code>RequestDispatcher </code>inkludiert, wird zwar eine Session mit der gleichen(!) SessionID erzeugt, es sind aber effektiv zwei <code>HttpSession </code>Objekte vorhanden.</p>
<p>Vergleiche Servlet Specification 2.4. (Kapitel 15.1.7)</p>
<blockquote><p>Session information is scoped only to the current web application<br />
(ServletContext), so information stored in one context will not be directly visible<br />
in another.</p></blockquote>
<p>Auch für JSR 168-konforme Portlets gelten diese Restriktionen. So konnen Portlets nur innerhalb der gleichen PortletApplication gemeinsame Daten austauschen. (Eine PortletApplication wird mit Hilfe einer Webapplikation realisiert). Diese Restriktion soll mit JSR 286 aufgehoben werden. Im <a href="http://jcp.org/aboutJava/communityprocess/edr/jsr286/">Early Draft Review</a> werden sogenannte &#8220;Shared Session Attribute&#8221; vorgestellt. Hier definiert der Portlet-Entwickler die gemeinsamen Session Attribute in der portlet.xml. Das JAXB Framework (Java Architecture for XML Binding) wird verwendet, um den Typ des Session Attributes zu beschreiben. Konkret bedeutet dass, das die Klasse für das Shared Attribut mit JAXB Annotations versehen wird. So kann das Attribut auch in anderen VMs ausgelesen werden, da die Klasse mit Hilfe von JAXB wieder zusammengebaut wird (Stichwort &#8220;marshalling&#8221;).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2006/12/10/httpsession-uber-mehrere-webapplikationen/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

