<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>hasan&#039;s blog (বল্গ) &#187; java ee</title>
	<atom:link href="http://we4tech.wordpress.com/category/java-ee/feed/" rel="self" type="application/rss+xml" />
	<link>http://we4tech.wordpress.com</link>
	<description>work for fun!!!</description>
	<lastBuildDate>Wed, 25 Jan 2012 11:56:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='we4tech.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/77f5f3e5f84d83c83da12540728f5cb3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>hasan&#039;s blog (বল্গ) &#187; java ee</title>
		<link>http://we4tech.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://we4tech.wordpress.com/osd.xml" title="hasan&#039;s blog (বল্গ)" />
	<atom:link rel='hub' href='http://we4tech.wordpress.com/?pushpress=hub'/>
		<item>
		<title>semantic-repository-0.5.2: deploymet update</title>
		<link>http://we4tech.wordpress.com/2008/06/06/semantic-repository-052-deploymet-update/</link>
		<comments>http://we4tech.wordpress.com/2008/06/06/semantic-repository-052-deploymet-update/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 09:00:14 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[semantic repository]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/semantic-repository-052-deploymet-update/</guid>
		<description><![CDATA[hi, as some of you know, semantic repository version 0.5.2 has some problem with IOException (too many files open) which was stopping repository to perform further search. thats what was reason to get empty search result. after searching a while, we found the problem (which was also mentioned in lucene FAQ document). by default bash &#8230; <a href="http://we4tech.wordpress.com/2008/06/06/semantic-repository-052-deploymet-update/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=413&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>hi,<br />
as some of you know, semantic repository version 0.5.2 has some problem with IOException (too many files open)<br />
which was stopping repository to perform further search. thats what was reason to get empty search result.<br />
after searching a while, we found the problem (which was also mentioned in lucene FAQ document).</p>
<p>by default bash shell allow limited files to open, since we had many index files, lucene has to open them up during performing search.<br />
so when it exceeds the limit of 1025 files (which is default on our production environment). our application threw the following exception -<br />
Caused by: java.io.FileNotFoundException: /var/indexes/ads-index/_gm.tvd (Too many open files)<br />
at java.io.RandomAccessFile.open(Native Method)<br />
at java.io.RandomAccessFile.(RandomAccessFile.java:212)<br />
at org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor.(FSDirectory.java:506)<br />
at org.apache.lucene.store.FSDirectory$FSIndexInput.(FSDirectory.java:536)<br />
at org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:445)<br />
at org.apache.lucene.index.TermVectorsReader.(TermVectorsReader.java:70)</p>
<p>after increasing this limit to 10,000 we didn&#8217;t find such problem exists. we had to apply &#8220;ulimit -n 10000&#8243; command on bash shell to make it works.</p>
<p>TODO: possible bug, probable our system is opening up several index searcher.</p>
<div style="background:lightYellow none repeat scroll 0 0;font-size:10px;padding:10px;">
<div class="line" id="LC60"><a href="http://github.com/we4tech/semantic-repository/tree"><em><strong>about semantic repositroy &#8211; </strong></em></a></div>
<div class="line" id="LC60"><span title="Click to edit!" class="edit">semantic repository service is intended for indexing content from different sources and maintain multi indexes for different types of content and perform different types of search. yet another solr type indexing service on top of lucene but it will gradually support content versioning and more semantic search result.</span></div>
</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/413/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/413/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/413/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=413&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2008/06/06/semantic-repository-052-deploymet-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>lucene based semantic-repository 0.5.2: major performance improvement now 24,000 items imported in 19 minutes</title>
		<link>http://we4tech.wordpress.com/2008/06/02/lucene-based-semantic-repository-052-major-performance-improvement-now-24000-items-imported-in-19-minutes/</link>
		<comments>http://we4tech.wordpress.com/2008/06/02/lucene-based-semantic-repository-052-major-performance-improvement-now-24000-items-imported-in-19-minutes/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 15:29:01 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[benchmark]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[Java SE]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[semantic repository]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/lucene-based-semantic-repository-052-major-performance-improvement-now-24000-items-imported-in-19-minutes/</guid>
		<description><![CDATA[when we started using semantic repository, we had only one lucene index to make our content search able, later we came up with another integration with one php based service aawaj. on aawaj service they had  more than 150,000 items to index. we tried with our current release 0.5.1 to index all contents but we &#8230; <a href="http://we4tech.wordpress.com/2008/06/02/lucene-based-semantic-repository-052-major-performance-improvement-now-24000-items-imported-in-19-minutes/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=412&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>when we started using semantic repository, we had only one lucene index to make our content search able,<br />
later we came up with another integration with one php based service <a href="http://aawaj.com">aawaj</a>.</p>
<p>on aawaj service they had  more than 150,000 items to index. we tried with our current release 0.5.1 to index all contents but we ended with extremely performance outage. later we released another version 0.5.2, where we added queued request handling and threw index optimization over an restful service uri &#8211; /rest/service/optimize/</p>
<p>here is the simple benchmark report -</p>
<blockquote><p>version &#8211; 0.5.1 &#8211; first 100 items  ended in &#8211; 13.611 seconds.<br />
version &#8211; 0.5.2 &#8211; first 100 items  ended in &#8211; 5.6152 seconds.</p></blockquote>
<p>the change is really different and significant, later today we had anoter import on our repository, interestingly it took 1 hour to index 150,000 items. which was bit surprising since we were unable to do it with 0.5.1</p>
<p>actually we added single thread executor which keeps everything in queue and execute one by one. so we could remove  synchronized method.</p>
<p>here is an example code -</p>
<blockquote>
<div class="line" id="LC52">
<div class="line" id="LC45"><span class="k">private</span> <span class="k">final</span> <span class="n">Executor</span> <span class="n">mIndexTaskExecutor</span> <span class="o">=</span></div>
<div class="line" id="LC46"><span class="n">Executors</span><span class="o">.</span><span class="na">newSingleThreadExecutor</span><span class="o">();</span></div>
</div>
<div class="line" id="LC52"><span class="k">public</span> <span class="kt">void</span> <span class="nf">addDocument</span><span class="o">(</span><span class="k">final</span> <span class="n">Document</span> <span class="n">pDocument</span><span class="o">)</span> <span class="o">{</span></div>
<div class="line" id="LC53"><span class="n">mIndexTaskExecutor</span><span class="o">.</span><span class="na">execute</span><span class="o">(</span></div>
<div class="line" id="LC54"><span class="k">new</span> <span class="nf">Runnable</span><span class="o">()</span> <span class="o">{</span></div>
<div class="line" id="LC55"><span class="k">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span></div>
<div class="line" id="LC56"><span class="n">getLuceneIndexTemplate</span><span class="o">().</span><span class="na">addDocument</span><span class="o">(</span><span class="n">pDocument</span><span class="o">);</span></div>
<div class="line" id="LC57"><span class="o">}</span></div>
<div class="line" id="LC58"><span class="o">}</span></div>
<div class="line" id="LC59"><span class="o">);</span></div>
<div class="line" id="LC60"><span class="o">}</span></div>
<div class="line" id="LC60"><a href="http://github.com/we4tech/semantic-repository/tree/master/development/idea-repository-core/src/main/java/com/ideabase/repository/core/index/impl/RepositoryItemIndexImpl.java"> </a></div>
</blockquote>
<div style="background:lightYellow none repeat scroll 0 0;font-size:12px;padding:5px;">
<div class="line" id="LC60"><a href="http://github.com/we4tech/semantic-repository/tree"><em><strong>about semantic repositroy &#8211; </strong></em></a></div>
<div class="line" id="LC60"><span title="Click to edit!" class="edit">semantic repository service is intended for indexing content from different sources and maintain multi indexes for different types of content and perform different types of search. yet another solr type indexing service on top of lucene but it will gradually support content versioning and more semantic search result.</span></div>
</div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/412/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/412/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=412&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2008/06/02/lucene-based-semantic-repository-052-major-performance-improvement-now-24000-items-imported-in-19-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>create new url protocol to load spring configuration resource from the relative path</title>
		<link>http://we4tech.wordpress.com/2008/04/18/create-new-url-protocol-to-load-spring-configuration-resource-from-the-relative-path/</link>
		<comments>http://we4tech.wordpress.com/2008/04/18/create-new-url-protocol-to-load-spring-configuration-resource-from-the-relative-path/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 18:17:42 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[spring framework]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/create-new-url-protocol-to-load-spring-configuration-resource-from-the-relative-path/</guid>
		<description><![CDATA[i had a problem with spring framework, as you know while we are defining dependency over the xml documents, it becomes less changeable unless you know about my recent post about ext-util namespace handler and if you know any other alternatives. before digging inside the problem better i clarify my context - i have been &#8230; <a href="http://we4tech.wordpress.com/2008/04/18/create-new-url-protocol-to-load-spring-configuration-resource-from-the-relative-path/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=405&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>i had a problem with spring framework, as you know while we are defining dependency over the xml documents, it becomes less changeable unless you know about my recent post about <a href="http://hasan.we4tech.com/ext-utilresource-new-spring-namespace-for-loading-property-from-different-scope-ie-system-test-dev/">ext-util namespace handler</a> and if you know any other alternatives.</p>
<p>before digging inside the problem better i clarify my context -</p>
<p>i have been working with one of my projects, where i have a several configurations which suppose to be different in different deployment environment, for example &#8211; to make my service avail, user has to define his database, his content index directory, server port, ip address and few more.</p>
<p>all these configurations were kept within the spring bean declaration scope. though few of them were moved to the properties file through <a href="http://hasan.we4tech.com/ext-utilresource-new-spring-namespace-for-loading-property-from-different-scope-ie-system-test-dev/">ext-util namespace handler</a>.</p>
<p>previously to make those configuration changeable i kept those files under WEB-INF/classes so it overrides the default bundled resource.</p>
<p>but still it wasn&#8217;t user friendly, since my user has to change one xml document to add more index services also he has to edit different configurations from java properties file.</p>
<p>again when i started bundling jetty with my whole application i found it is tricker to keep those xml outside of application, since i don&#8217;t wanna make my user confused with lot of xml files. and i have to keep few xml out of  my classpath context, so spring has to load my configuration from my &#8220;config/index-configuration/&#8221; directory.</p>
<p>though by default spring can do it over &#8220;file:///absolute/path/to/file.xml&#8221; since spring is using java URL class to locate this resource.  but in my case i can&#8217;t put any aboslute path.<br />
so i found a simple way out there to support relative path reference.</p>
<p>previously i had the following xml document -</p>
<p><!-- import index services --></p>
<p><!-- available item index services --></p>
<p>now i have replaced them with the following change -</p>
<p><!-- import index services --><br />
<strong><br />
</strong></p>
<p><!-- available item index services --></p>
<p>if you observe closely you will find &#8220;extfile:///&#8221; protocol reference, which is not standard url protocol. so to make it work i used the following bunch of code and configuration -</p>
<p>1. i have created a class &#8220;Handler&#8221; under the &#8220;com.ideabase.repository.core.protocols.extfile&#8221; package.<br />
this package and class name is conventional, though you can change them lets sun <a href="http://java.sun.com/developer/onlineTraining/protocolhandlers/">explain about it.</a></p>
<p>2. i wrote the following code -</p>
<p>public class Handler extends URLStreamHandler {<br />
protected URLConnection openConnection(final URL pURL) throws IOException {<br />
final String path = pURL.getPath();<br />
final URL resourceUrl;<br />
if (path.startsWith(&#8220;/./&#8221;)) {<br />
resourceUrl = new File(path.substring(1, path.length())).toURL();<br />
} else {<br />
throw new RuntimeException(&#8220;Unsupported url schema. currently you can &#8221; +<br />
&#8220;use only extfile:///./path/to/somewhere/in&#8221;);<br />
}<br />
return resourceUrl.openConnection();<br />
}<br />
}<br />
3. i registered my protocol package through the system property -</p>
<p>System.setProperty(&#8220;java.protocol.handler.pkgs&#8221;, &#8220;com.ideabase.repository.core.protocols&#8221;);</p>
<p>now have a look on the main applicationContext.xml</p>
<p><strong><br />
</strong><br />
if you observe closely again you could find the difference, on the normal case i have used relative path reference. so it must be from classloader or if it is loaded through file system based resource locator it will be located from the file system.</p>
<p>but now i can use cross context (relative file system and class loader path reference) resource file path reference. you can see i have imported &#8220;indexer-beans.xml&#8221; from the application relative path &#8220;config/index-configuration/&#8230;&#8221; where &#8220;data-access-layer-beans.xml&#8221; is loaded from the class loader.<br />
now have a quick look on my configuration directory, to get an idea how i have improved configuration ability.<br />
<img class="alignleft size-medium wp-image-431" title="picture-1" src="http://we4tech.files.wordpress.com/2008/04/picture-1.png?w=300&#038;h=66" alt="picture-1" width="300" height="66" /></p>
<p>hope this will help you to solve similar problem.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/405/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/405/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/405/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=405&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2008/04/18/create-new-url-protocol-to-load-spring-configuration-resource-from-the-relative-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2008/04/picture-1.png?w=300" medium="image">
			<media:title type="html">picture-1</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;ext-util:resource&#8221; new spring namespace for loading property from different scope i.e. system, test, dev</title>
		<link>http://we4tech.wordpress.com/2007/12/02/ext-utilresource-new-spring-namespace-for-loading-property-from-different-scope-ie-system-test-dev/</link>
		<comments>http://we4tech.wordpress.com/2007/12/02/ext-utilresource-new-spring-namespace-for-loading-property-from-different-scope-ie-system-test-dev/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 08:46:24 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[spring framework]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/ext-utilresource-new-spring-namespace-for-loading-property-from-different-scope-ie-system-test-dev/</guid>
		<description><![CDATA[within spring container i was getting problem with managing multi level configuration. for example while i am developing i got a specific filesystem path, database configuration and so on. this configuration are mostly get changed while i an deploying them on the test or production environment. this type of scenario is common on most of &#8230; <a href="http://we4tech.wordpress.com/2007/12/02/ext-utilresource-new-spring-namespace-for-loading-property-from-different-scope-ie-system-test-dev/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=389&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>within spring container i was getting problem with managing multi level configuration.<br />
for example while i am developing i got a specific filesystem path, database configuration and so on.<br />
this configuration are mostly get changed while i an deploying them on the test or production environment.</p>
<p>this type of scenario is common on most of the projects. managing different scoped configuration is one of the bothering stuff. so i was always thinking some simpler way with in spring container.</p>
<p>so i wrote &#8220;ext-util&#8221; namespace handler, which is locating property from multi scoped resource.<br />
lets give you a more details use case -</p>
<p>in my test environment i have a property &#8220;index.directory=/Users/&#8230;/index&#8221;<br />
in my test server i use &#8220;index.directory=/var/index&#8221;<br />
in my production server i use &#8220;index.directory=/nfs/index&#8221;</p>
<p>here i have a bean which need this property.</p>
<blockquote></blockquote>
<p>you can see the hardcoded configuration. which is not easy to manage.<br />
thats why here my &#8220;ext-util&#8221; goes with the simplest solution -</p>
<blockquote></blockquote>
<p>now my property resource is locating from &#8220;test&#8221; scope.</p>
<p>you might think, this &#8220;scope=&#8217;test&#8217;&#8221; is again hardcoded stuff, so i also support the following value -<br />
scope=&#8221;sys:env&#8221;, now you have to define &#8220;-Denv=test&#8221; while you running your application, and spring bean will find the right property.</p>
<p>so what ever you put over your spring are no longer hardcoded as long as you locate them through &#8220;ext-util&#8221; which is stands for &#8220;extended utility&#8221;.</p>
<p><a title="spring namespace ext-util for locating system or scoped properties" href="http://hasan.we4tech.com/files/spring-namespace-ext-util.zip">here is my attached source code &#8211; (i just extracted them from my on going project, thats why no build script or prebuilt package or maven artifact is bundled)</a></p>
<p><strong>how to use -</strong><br />
include the source file with in your project<br />
keep &#8220;META-INF&#8221; while you building your jar or keep them inside your classpath.<br />
change your spring configuration -</p>
<p>xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221;<br />
xmlns:lang=&#8221;http://www.springframework.org/schema/lang&#8221;<br />
xmlns:aop=&#8221;http://www.springframework.org/schema/aop&#8221;<br />
<em><strong>xmlns:ext-util=&#8221;http://dev.somewherein.net/schema/ext-util&#8221;</strong></em><br />
xsi:schemaLocation=&#8221;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd<br />
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd<br />
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd<br />
<strong><em>http://dev.somewherein.net/schema/ext-util http://dev.somewherein.net/resources/schemas/ext-util-0.1.xsd</em></strong>&#8220;/&gt;<br />
<strong>basic properties of ext-util -</strong></p>
<blockquote><p>1. <strong>from-property</strong> &#8211; which property you are looking for.</p>
<p>2. <strong>or-default</strong> &#8211; define default value if no property is found from default scope (system properties) this value is returned.</p>
<p>3. <strong>scope</strong> &#8211; define scope name, by default whatever you set except &#8220;sys:&#8221; prefixed string, will search for &#8220;classpath:&#8221;. also you can use &#8220;sys:abc&#8221; where abc is located from system properties.</p>
<p>4. <strong>path-prefix</strong> &#8211; you can define scope properties path prefix, this prefix can be &#8220;file:///, classpath:&#8221;. this value also can be prefixed by &#8220;sys:abc&#8221; where abc is located from system properties.</p></blockquote>
<p><a title="spring namespace ext-util for locating system or scoped properties" href="http://hasan.we4tech.com/files/spring-namespace-ext-util.zip">[download source code]</a><br />
<a href="http://hasan.we4tech.com/files/ext-util-01xsd.zip">[download missing xsd file]</a></p>
<p>best wishes,</p>
<p><!--fc37dc39b783d0125ea3aa50675127f9--></p>
<p><!--e9927b35c96f3a5d11179320bda2993b--></p>
<p><!--b0ea32c2559a8e05ab2f7fc04e0ff6b5--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/389/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/389/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/389/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=389&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/12/02/ext-utilresource-new-spring-namespace-for-loading-property-from-different-scope-ie-system-test-dev/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>JETTY RUNNER version 0.2</title>
		<link>http://we4tech.wordpress.com/2007/10/15/jetty-runner-version-02/</link>
		<comments>http://we4tech.wordpress.com/2007/10/15/jetty-runner-version-02/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 06:50:06 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[Introduction]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[java swing]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/jetty-runner-version-02</guid>
		<description><![CDATA[those who doesn&#8217;t know about JETTY RUNNER: JETTY RUNNER is a standalone swing based application which is used to bundle java ee based application along with jetty container. it comes with simple web app configuration xml file and global properties manager through a simple properties file. actually i have been using this project for my &#8230; <a href="http://we4tech.wordpress.com/2007/10/15/jetty-runner-version-02/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=368&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>those who doesn&#8217;t know about JETTY RUNNER:</strong><br />
JETTY RUNNER is a standalone swing based application which is used to bundle java ee based application along with jetty container. it comes with simple web app configuration xml file and global properties manager through a simple properties file.</p>
<p><em>actually i have been using this project for my own development solution, so i belief this project will become a great strengthen feature  gradually.<br />
</em></p>
<p>JETTY RUNNER is now running on max OSX, i have removed system try support in new tag v-0.2, soon i will release *.dmg package for mac osx. here are few screen snaps -</p>
<p><a class="imagelink" title="jetty runner v0.2" href="http://hasan.we4tech.com/wp-content/uploads/2007/10/jetty_runner_02_main.gif"><img src="http://hasan.we4tech.com/wp-content/uploads/2007/10/jetty_runner_02_main.gif" alt="jetty runner v0.2" /></a><br />
figure &#8211; 1: server console main window<br />
<a class="imagelink" title="jetty_runner_02_settings.gif" href="http://hasan.we4tech.com/wp-content/uploads/2007/10/jetty_runner_02_settings.gif"><br />
<img class="alignnone size-medium wp-image-445" title="jetty_runner_02_settings" src="http://we4tech.files.wordpress.com/2007/10/jetty_runner_02_settings.gif?w=300&#038;h=264" alt="jetty_runner_02_settings" width="300" height="264" /><br />
</a></p>
<p>figure &#8211; 2: global properties editor<strong></strong></p>
<p>change logs -<br />
1. removed system tray support<br />
2. removed default jmx configuration<br />
3. added &#8220;start.sh&#8221; to launch JETTY RUNNER on *nix based platform where ruby script is installed.<br />
here are few screen snaps, which i have taken from the newly added ruby script! -<br />
<span class="imagelink"><img class="alignnone size-medium wp-image-446" title="jetty_runner_02_ruby_script" src="http://we4tech.files.wordpress.com/2007/10/jetty_runner_02_ruby_script.gif?w=300&#038;h=157" alt="jetty_runner_02_ruby_script" width="300" height="157" /><br />
figure &#8211; 3: newly added jetty runner on ruby</span></p>
<p><img class="alignnone size-medium wp-image-448" title="jetty_runner_02_ruby_class" src="http://we4tech.files.wordpress.com/2007/10/jetty_runner_02_ruby_class.gif?w=228&#038;h=300" alt="jetty_runner_02_ruby_class" width="228" height="300" /><br />
figure &#8211; 4: newly added jetty runner implementation in ruby</p>
<p>this script really great <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> , at least i like it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <!--c82dba895f8889446523b8cdcdc3ed69--><!--58e72d18e19c83075072f92fd663767b--></p>
<p><!--d2d5c28daa9950f44c955f557cfff203--></p>
<p><!--9944f2ccdefec3d746e9eb8b0445663b--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/368/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/368/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/368/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=368&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/10/15/jetty-runner-version-02/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>

		<media:content url="http://hasan.we4tech.com/wp-content/uploads/2007/10/jetty_runner_02_main.gif" medium="image">
			<media:title type="html">jetty runner v0.2</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2007/10/jetty_runner_02_settings.gif?w=300" medium="image">
			<media:title type="html">jetty_runner_02_settings</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2007/10/jetty_runner_02_ruby_script.gif?w=300" medium="image">
			<media:title type="html">jetty_runner_02_ruby_script</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2007/10/jetty_runner_02_ruby_class.gif?w=228" medium="image">
			<media:title type="html">jetty_runner_02_ruby_class</media:title>
		</media:content>
	</item>
		<item>
		<title>Performance issue with tomcat 5.x.x series</title>
		<link>http://we4tech.wordpress.com/2007/08/06/performance-issue-with-tomcat-5xx-series/</link>
		<comments>http://we4tech.wordpress.com/2007/08/06/performance-issue-with-tomcat-5xx-series/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 02:36:28 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[Fix]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/performance-issue-with-tomcat-5xx-series</guid>
		<description><![CDATA[one of our escenic colleagues (Simen L. Haagenrud) just noticed a bottleneck with tomcat 5.x.x series containers. so we had a details digging to let find the reason. as he mentioned it was because of recurring invocation of &#8220;getAttribute&#8221;, and tomcat 5.x.x series is using synchornization block inside &#8220;getAttribute&#8221; method, where lock is kept on &#8230; <a href="http://we4tech.wordpress.com/2007/08/06/performance-issue-with-tomcat-5xx-series/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=353&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>one of our escenic colleagues (Simen L. Haagenrud) just noticed a bottleneck with tomcat 5.x.x series containers. so we had a details digging to let find the reason.</p>
<p>as he mentioned it was because of recurring invocation of &#8220;getAttribute&#8221;, and tomcat 5.x.x series is using synchornization block inside &#8220;getAttribute&#8221; method, where lock is kept on &#8220;attributes&#8221; variable.<br />
so i had a quick look on the source code of the 3 recent series -</p>
<p>1. 5.0.28<br />
<a class="moz-txt-link-freetext" href="http://svn.apache.org/repos/asf/tomcat/container/tags/tc5.0.x/TOMCAT_5_0_28/catalina/src/share/org/apache/catalina/core/ApplicationContext.java">http://svn.apache.org/repos/asf/tomcat/container/tags/tc5.0.x/TOMCAT_5_0_28/catalina/src/share/org/apache/catalina/core/ApplicationContext.java</a></p>
<p>2. 5.5.24 (the last version from 5.5.x series)<br />
<a class="moz-txt-link-freetext" href="http://svn.apache.org/repos/asf/tomcat/container/tags/tc5.5.x/TOMCAT_5_5_24/catalina/src/share/org/apache/catalina/core/ApplicationContext.java">http://svn.apache.org/repos/asf/tomcat/container/tags/tc5.5.x/TOMCAT_5_5_24/catalina/src/share/org/apache/catalina/core/ApplicationContext.java</a></p>
<p>3. 6.0.x (trunk)<br />
<a class="moz-txt-link-freetext" href="http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java">http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java</a></p>
<p>so the code says 6.0.x series came with the fixes, the fix is the replacement of HashMap with ConcurrentHashMap.</p>
<p>in his case, recurring invocation of &#8220;getAttribute&#8221; was nearly reduced 50% server request handling capability.<br />
best wishes,<!--137c3d73b634e2b7db7984c1809a9410--></p>
</p>
<p><!--d08ebbc2672727d617f93141dba010bc-->
</p>
<p><!--2a8ea631e9057d352f87cafa5ec6c2f5--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/353/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/353/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/353/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/353/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/353/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=353&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/08/06/performance-issue-with-tomcat-5xx-series/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>Open Search Servlet &#8211; build open search configuration on the fly</title>
		<link>http://we4tech.wordpress.com/2007/05/20/open-search-servlet-build-open-search-configuration-on-the-fly/</link>
		<comments>http://we4tech.wordpress.com/2007/05/20/open-search-servlet-build-open-search-configuration-on-the-fly/#comments</comments>
		<pubDate>Sat, 19 May 2007 23:58:43 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/open-search-servlet-build-open-search-configuration-on-the-fly</guid>
		<description><![CDATA[Here is open search specification &#8211; http://www.opensearch.org/Specifications/OpenSearch/1.1 Let’s enable your browser to detect your search engine automatically; using open search servlet you can generate open search configuration file on the fly. Download information is here &#8211; Binary library Source maven project Binary war file (includes example usages) Usages: Copy “open-search-x.jar” file on your WEB-INF/lib/ directory &#8230; <a href="http://we4tech.wordpress.com/2007/05/20/open-search-servlet-build-open-search-configuration-on-the-fly/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=331&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is open search specification &#8211; http://www.opensearch.org/Specifications/OpenSearch/1.1</p>
<p class="MsoNormal">Let’s enable your browser to detect your search engine automatically; using open search servlet you can generate open search configuration file on the fly.</p>
<p class="MsoNormal"><strong><u>Download information is here &#8211; </u></strong></p>
<p class="MsoNormal"><a href="http://hasan.we4tech.com//projects/open-search/open-search-webapp.war">Binary library</a></p>
<p class="MsoNormal"><a href="http://hasan.we4tech.com//projects/open-search/open-search-src.zip">Source maven project</a></p>
<p class="MsoNormal"><a href="http://hasan.we4tech.com//projects/open-search/open-search-webapp.war">Binary war file (includes example usages)</a></p>
<p class="MsoNormal"><strong><u>Usages:</u></strong></p>
<ol type="1" style="margin-top:0;" start="1">
<li class="MsoNormal">Copy “open-search-x.jar”      file on your WEB-INF/lib/ directory</li>
<li class="MsoNormal">Edit      web.xml file.</li>
<li class="MsoNormal">add      these entries -</li>
</ol>
<div style="border:1px solid #cccccc;background:lightYellow none repeat scroll 0 50%;padding:5px;">
<pre>
&lt; servlet &gt;
    &lt; servlet-name &gt;openSearch&lt; /servlet-name &gt;
    &lt; servlet-class &gt;com.we4tech.openSearch.servlet.OpenSearchServlet&lt; /servlet-class &gt;
    &lt; !-- URL matching pattern -- &gt;
    &lt; init-param &gt;
      &lt; param-name &gt;url-match&lt; /param-name &gt;
      &lt; param-value &gt;.*/(.+).osd&lt; /param-value &gt;
      &lt; !--&lt; param-value &gt;.*/search/(.+)&lt; /param-value &gt;-- &gt;
    &lt; /init-param &gt;
    &lt; !-- map open search configuration with url -- &gt;
    &lt; init-param &gt;
      &lt; param-name &gt;open-search&lt; /param-name &gt;
      &lt; param-value &gt;open-search.properties&lt; /param-value &gt;
    &lt; /init-param &gt;
    &lt; init-param &gt;
      &lt; param-name &gt;somewherein-blog&lt; /param-name &gt;
      &lt; param-value &gt;somewherein-blog.properties&lt; /param-value &gt;
    &lt; /init-param &gt;
  &lt; /servlet &gt;

  &lt; servlet-mapping &gt;
    &lt; servlet-name &gt;openSearch&lt; /servlet-name &gt;
    &lt; !--&lt; url-pattern &gt;/search/*&lt; /url-pattern &gt;-- &gt;
    &lt; url-pattern &gt;*.osd&lt; /url-pattern &gt;
  &lt; /servlet-mapping &gt;
</pre>
</div>
<ol type="1" style="margin-top:0;" start="4">
<li class="MsoNormal">Now      place configuration properties file with in your WEB-INF/classes/</li>
<li class="MsoNormal">for      example: “open-search.properties”</li>
</ol>
<div style="border:1px solid #cccccc;background:lightYellow none repeat scroll 0 50%;padding:5px;">
<pre>
# Default open-search. properties
shortName=colorful moment.
description=somewhere in blog
contact=hasan@somewherein.net

url.1=text/html,get,http://www.somewherein.net/blog/index.php?s={searchTerms}&amp;submit=
image.1=16,16,image/x-icon,http://www.searchmash.com/favicon.ico
</pre>
</div>
<ol type="1" style="margin-top:0;" start="6">
<li class="MsoNormal">Congratulations      you have completed all steps <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ol>
<p class="MsoNormal">
<p class="MsoNormal"><strong><u>Sample usages on your web site can be found here – </u></strong></p>
<p class="MsoNormal">http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML</p>
<p class="MsoNormal">
<p class="MsoNormal">Best wishes,</p>
<p><!--1cc63eded0101fdfec3574f1fa923706--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/331/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/331/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/331/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/331/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/331/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/331/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/331/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/331/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/331/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/331/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/331/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/331/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/331/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/331/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/331/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/331/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=331&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/05/20/open-search-servlet-build-open-search-configuration-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>Remind me: servlet, Jsp performance tuning note</title>
		<link>http://we4tech.wordpress.com/2007/05/14/remind-me-servlet-jsp-performance-tuning-note/</link>
		<comments>http://we4tech.wordpress.com/2007/05/14/remind-me-servlet-jsp-performance-tuning-note/#comments</comments>
		<pubDate>Sun, 13 May 2007 18:02:57 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[remind me]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/remind-me-servlet-jsp-performance-tuning-note</guid>
		<description><![CDATA[hi, here is a great collection on servlet jsp performance related stuffs. http://www.javaperformancetuning.com/tips/j2ee_srvlt.shtml best wishes,<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=329&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>hi,<br />
here is a great collection on servlet jsp performance related stuffs.<br />
http://www.javaperformancetuning.com/tips/j2ee_srvlt.shtml</p>
<p>best wishes,
</p>
<p><!--813d63b83f94196cfcdbf8223c79b731--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/329/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/329/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/329/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=329&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/05/14/remind-me-servlet-jsp-performance-tuning-note/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>struts rewrite, link rewrites url with &#8220;;jsessionid=&#8221; session id.</title>
		<link>http://we4tech.wordpress.com/2007/05/07/struts-rewrite-link-rewrites-url-with-jsessionid-session-id/</link>
		<comments>http://we4tech.wordpress.com/2007/05/07/struts-rewrite-link-rewrites-url-with-jsessionid-session-id/#comments</comments>
		<pubDate>Mon, 07 May 2007 02:34:28 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[Introduction]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[jsp]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/struts-rewrite-link-rewrites-url-with-jsessionid-session-id</guid>
		<description><![CDATA[hi, on my server i found some strange problem. it was actually related with tag. the problem was with the url rewriting, which was performed by struts tag library. struts tag library was creating an invalid URL. for example i wrote the following code: &#60; img src=&#8221;my-image.gif&#8221; /&#62; as i have only wrapped &#8220;${urlPrefix}&#8221; with in html:rewrite tag. so struts tag library wrote the following output. which is totally a &#8230; <a href="http://we4tech.wordpress.com/2007/05/07/struts-rewrite-link-rewrites-url-with-jsessionid-session-id/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=326&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>hi,<br />
on my server i found some strange problem. it was actually related with  tag. the problem was with the url rewriting, which was performed by struts tag library. struts tag library was creating an invalid URL.<br />
<strong><em><u>for example i wrote the following code:</u></em></strong><br />
&lt; img src=&#8221;my-image.gif&#8221; /&gt;</p>
<p>as i have only wrapped &#8220;${urlPrefix}&#8221; with in html:rewrite tag. so struts tag library wrote the following output.</p>
<p><img src="/mycontext/gfx/;jsessionid=825A15A08BE76581B356D6225B1A9265my-image.gif" /></p>
<p>which is totally a wrong url.</p>
<p><strong><em><u>so how i resolved it?</u></em></strong><br />
very simple just fixing my weired code. now it looks like the following -<br />
&lt; img src=&#8221;" /&gt;</p>
<p><strong><em><u>the generated output looks like -</u></em></strong><br />
<img src="/mycontext/gfx/my-image.gif;jsessionid=825A15A08BE76581B356D6225B1A9265" /></p>
<p><strong><u><em>here is a regex which may help you to find out the error tags:</em></u></strong><br />
&#8220;(.+)&#8221;</p>
<p>yeap it is working now <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</p>
<p><!--0b29f44b0a8513c0ca77ed21110a8b08-->
</p>
<p><!--57d59da76c1f577b3c3cc0849ea43a13--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/326/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/326/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/326/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/326/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/326/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/326/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/326/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/326/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/326/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/326/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/326/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/326/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/326/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/326/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/326/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/326/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=326&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/05/07/struts-rewrite-link-rewrites-url-with-jsessionid-session-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>A RESTful url using Stripes.</title>
		<link>http://we4tech.wordpress.com/2007/02/23/a-restful-url-using-stripes/</link>
		<comments>http://we4tech.wordpress.com/2007/02/23/a-restful-url-using-stripes/#comments</comments>
		<pubDate>Thu, 22 Feb 2007 20:34:15 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[framework]]></category>
		<category><![CDATA[Introduction]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[java ee]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/a-restful-url-using-stripes</guid>
		<description><![CDATA[RESTful url may contain the content type with in the url string. For example: http://host/action/xml/bookmark. Here “xml” is content type, this content type can be changed to “text, json” or etc… So following urls are valid too. http://host/action/text/bookmark, http://host/action/json/bookmark etc… these days I am playing with “Stripes” web framework a lot. Those who didn’t get &#8230; <a href="http://we4tech.wordpress.com/2007/02/23/a-restful-url-using-stripes/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=316&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>RESTful </strong>url may contain the content type with in the url string. For example: http://host/action/xml/bookmark. Here “xml” is content type, this content type can be changed to “text, json” or etc…</p>
<p class="MsoNormal">So following urls are valid too. http://host/action/text/bookmark, http://host/action/json/bookmark etc…</p>
<p class="MsoNormal">these days I am playing with “Stripes” web framework a lot. Those who didn’t get in touch with “Stripes” have a look on the following URL &#8211; http://stripes.mc4j.org, hope you will enjoy it.</p>
<p class="MsoNormal">stripes has fantastic flexibility, it enables a lot of customization. Now my tutorial will demonstrate how you can enable this url pattern, where your single “ActionBean” will be invoked on the following url patterns:</p>
<p class="MsoNormal">http://host/action/xml/bookmark, http://host/action/text/bookmark, http://host/action/json/bookmark etc…</p>
<p class="MsoNormal"><strong><u>My target audience:</u></strong><br />
Who has already been introduced with Stripes or those who are interested on stripes framework.</p>
<p class="MsoNormal"><strong><u>Routing plan:</u></strong><br />
<em>Request Dispatch</em><br />
[visitor] &#8212;  &gt; http://host/action/xml/bookmark &#8212; &gt; [web server] &#8212; &gt; [Stripe servlet] &#8212; &gt; [Custom Action resolver] &#8212; &gt; [remove user defined content type “xml” and retrieve action bean]</p>
<p class="MsoNormal"><em>Response Dispatch</em><br />
[clean url (after removing content type)] &#8212; &gt; http://host/action/bookmark &#8212; &gt; [BookmarkActionBean] &#8212; &gt; [Resolution] &#8212; &gt; </p>
<p class="MsoNormal"><strong><u>Pre requisite:</u></strong><br />
Stripes servlet is configured and web context is up and running.</p>
<p class="MsoNormal"><strong><u>ActionBean code:</u></strong><br />
<em>*  create an ActionBean, for example “BookmarkActionBean”</em>
</p>
<p class="MsoNormal">
<blockquote>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">@UrlBinding(&#8220;/action/bookmark&#8221;)</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">public class BookmarkAction implements ActionBean {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    private final Log LOG = LogFactory.getLog(getClass());</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    private ActionBeanContext mActionBeanContext;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    private String mContentType = &#8220;text/xml&#8221;;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    public void setContext(ActionBeanContext actionBeanContext) {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        mActionBeanContext = actionBeanContext;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        // retrieve user requested content type constant for example &#8220;text,json, xml&#8221;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        // convert consts to mime type &#8220;text, text/xml, application/JSON&#8221;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        mContentType = URLHelper.getMimeType(URLHelper.getContentType(getContext().getRequest().getPathInfo()));</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    }</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    public ActionBeanContext getContext() {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        return mActionBeanContext;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    }</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    @DefaultHandler</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    public Resolution save() {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        if (LOG.isDebugEnabled())</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            LOG.debug( &#8220;storing bookmark object on the data store, &#8221; +</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">                       &#8220;response content type is requested &#8211; &#8221; + mContentType );</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        return new StreamingResolution( mContentType, new StringReader(&#8220;&#8221;) );</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    }</span></font></p>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="courier new">}</font></span></p>
</blockquote>
<p class="MsoNormal">
<p class="MsoNormal"><strong><u>Description:</u></strong><br />
Here i have set our action on “/action/bookmark” url, but our user requested url pattern is “/action//actionBean”
</p>
<p class="MsoNormal">Look on the “setContext” method, I have added an extra line</p>
<blockquote>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="courier new">mContentType = URLHelper.getMimeType(URLHelper.getContentType(getContext().getRequest().getPathInfo()));</font></span></p>
</blockquote>
<p class="MsoNormal">now have a look on the URLHelper class.</p>
<blockquote>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">public static String getContentType( String pRequestedUrl ) {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        String contentType = CACHED_URL_CONTENT_TYPE.get(pRequestedUrl);</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        if (contentType == null) {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            contentType = DEFAULT_CONTENT_TYPE;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            Perl5Util util = new Perl5Util();</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            if (util.match( REGEX_ACTION_CONTENT_TYPE, pRequestedUrl ))</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">                contentType = util.group(1)+&#8221;";</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            CACHED_URL_CONTENT_TYPE.put( pRequestedUrl, contentType );</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        }</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        return contentType;</span></font></p>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="courier new">    }</font></span></p>
</blockquote>
<p class="MsoNormal">This method is responsible to retrieve user requested content type constants.<br />
for example “text, xml, json”</p>
<blockquote>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">public static String getMimeType( String pContentType ) {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        // convert content type to MIME Type</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        if (pContentType.equalsIgnoreCase(CONTENT_TYPE_CONST_XML))</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            pContentType = CONTENT_TYPE_XML;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        else if (pContentType.equalsIgnoreCase(CONTENT_TYPE_CONST_JSON))</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            pContentType = CONTENT_TYPE_JSON;</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        return pContentType;</span></font></p>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="courier new">    }</font></span></p>
</blockquote>
<p class="MsoNormal">This method is also converting constant to MIME content type.<br />
For example “xml &#8211;&gt; text/xml”
</p>
<p class="MsoNormal">Now return to my base action bean. I have added the following method, which is defined as default handler.</p>
<blockquote>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">@DefaultHandler<br />
public Resolution save() {</span></font>
</p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        ….</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        return new StreamingResolution( mContentType, new StringReader(&#8220;&#8221;) );</span></font></p>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="courier new">    }</font></span></p>
</blockquote>
<p class="MsoNormal">Here “mContentType” is repopulate when “setContext” is invoked.</p>
<p class="MsoNormal"><strong><u>ActionResolver code:</u></strong><br />
This is my action resolver.</p>
<blockquote>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">public class NBookmarkSystemActionResolver extends NameBasedActionResolver {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">     // ………    </span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    @Override</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    public ActionBean getActionBean(ActionBeanContext pActionBeanContext, String pRequestedUrl) throws StripesServletException {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        String cleanUrl = URLHelper.getCleanUrl(pRequestedUrl);</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        if (LOG.isDebugEnabled())</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">            LOG.debug( &#8220;user requested url &#8211; &#8221; + pRequestedUrl + &#8221; clean url &#8211; &#8221; + cleanUrl);</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        return super.getActionBean(actionBeanContext, cleanUrl);</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">    }</span></font></p>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="courier new">}</font></span></p>
</blockquote>
<p class="MsoNormal">Now let’s have a look on “getCleanUrl” method.</p>
<blockquote>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">public static String getCleanUrl( String pRequestedUrl ) {</span></font></p>
<p class="MsoNormal"><font face="courier new"><span style="font-size:9pt;">        return pRequestedUrl.replaceAll(&#8220;/&#8221;+getContentType(pRequestedUrl),&#8221;");</span></font></p>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="courier new">    }</font></span></p>
</blockquote>
<p class="MsoNormal">
<p class="MsoNormal"><strong><u>Custom ActionResolver configuration:</u></strong></p>
<blockquote>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;"></span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        Stripes Filter</span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        StripesFilter</span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        net.sourceforge.stripes.controller.StripesFilter</span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        </span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">            ActionResolver.UrlFilters</span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">            /WEB-INF/classes/</span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        </span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        </span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">            ActionResolver.PackageFilters</span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">            com.we4tech.nBookmarkSystem.service.webService/*</span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        </span></font></p>
<p class="MsoNormal"><font face="arial"><span style="font-size:9pt;">        <em></em></span></font></p>
<p class="MsoNormal"><font face="arial"><em><span style="font-size:9pt;">            ActionResolver.Class</span></em></font></p>
<p class="MsoNormal"><font face="arial"><em><span style="font-size:9pt;">            com.we4tech.nBookmarkSystem.configuration.NBookmarkSystemActionResolver</span></em></font></p>
<p class="MsoNormal"><font face="arial"><em><span style="font-size:9pt;">        </span></em></font></p>
<p class="MsoNormal"><span style="font-size:9pt;"><font face="arial">    </font></span></p>
</blockquote>
<p class="MsoNormal">
<p class="MsoNormal">That’s all for today,</p>
<p class="MsoNormal">Hope you will enjoy stripes. Best of luck…</p>
<p class="MsoNormal">
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/316/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/316/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/316/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=316&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/02/23/a-restful-url-using-stripes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
