<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:series="http://unfoldingneurons.com/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Cemre Ceren Akkan</title>
	
	<link>http://www.cemreceren.com</link>
	<description />
	<lastBuildDate>Tue, 19 Jul 2011 08:54:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CemreCeren" /><feedburner:info uri="cemreceren" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Spring MVC/JPA2 Quick Startup Projects</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/fFbkxwxccIM/</link>
		<comments>http://www.cemreceren.com/2011/07/19/spring-mvcjpa2-quick-startup-projects/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 08:52:23 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[JPA2]]></category>
		<category><![CDATA[spring 3]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=379</guid>
		<description><![CDATA[I know there are many Spring MVC/JPA2 tutorials and projects out there, and in the previous years I have forgotten how many new projects I have started projects using Spring MVC and JPA2, so I added two template projects to Google Code, mainly for myself. Spring MVC Quick Startup: This project is a simple template [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div class="wp-caption alignright" style="width: 310px"><a href="http://en.wikipedia.org/wiki/File:You_Must_Believe_in_Spring_-_Bill_Evans.jpg"><img title="You Must Believe in Spring" src="http://upload.wikimedia.org/wikipedia/en/5/5a/You_Must_Believe_in_Spring_-_Bill_Evans.jpg" alt="You Must Believe in Spring" width="300" height="298" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
</div>
<p>I know there are many Spring MVC/JPA2 tutorials and projects out there, and in the previous years I have forgotten how many new projects I have started projects using Spring MVC and JPA2, so I added two template projects to Google Code, mainly for myself.</p>
<p><strong><a href="http://code.google.com/p/spring-mvc-startup/">Spring MVC Quick Startup</a></strong>: This project is a simple template project for Spring 3 MVC.</p>
<p><strong><a href="http://code.google.com/p/spring-mvc-jpa-startup/">Spring MVC-JPA2 Quick Startup</a></strong>: This project is a simple template project for Spring 3 MVC, JPA2(I favor JPA2 over Hibernate) and also the basic Spring Security.</p>
<p>These projects are really quick startup template projects, I changed some of my projects in 10 min. So there might be some issues but at least it should be enough for the initial setup.</p>
<p>Please feel free to use.</p>
<p>&nbsp;</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=c946bee0-abee-477b-86bf-954425d9c94b" alt="Enhanced by Zemanta" /></a></div>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/fFbkxwxccIM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2011/07/19/spring-mvcjpa2-quick-startup-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2011/07/19/spring-mvcjpa2-quick-startup-projects/</feedburner:origLink></item>
		<item>
		<title>Amsterdam Startup Weekend is over!</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/JckyhzF_pxw/</link>
		<comments>http://www.cemreceren.com/2011/07/11/amsterdam-startup-weekend-is-over/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 09:38:14 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[startup]]></category>
		<category><![CDATA[Amsterdam]]></category>
		<category><![CDATA[StartupWeekend]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=354</guid>
		<description><![CDATA[Wow, what an amazing weekend and Amsterdam Startup Weekend is now over. Here are the projects that pitched and their websites/projects. Most of these projects were launched in less than 54 hours! The Winners: Goddess Alert Shuffle Wear SNTMNT The other projects that pitched: Legal Toolkit tipNtrip Party with a Local UnslothMe THE RACING APP [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, what an amazing weekend and Amsterdam Startup Weekend is now over. Here are the projects that pitched and their websites/projects. Most of these projects were launched in less than 54 hours!</p>
<p style="text-align: center;"><a href="http://www.cemreceren.com/wp-content/uploads/2011/07/Startup-Weekend-Amsterdam.png"></a><a href="http://amsterdam.startupweekend.org"><img class="aligncenter size-full wp-image-359" title="amsterdamstartupweekend" src="http://www.cemreceren.com/wp-content/uploads/2011/07/amsterdamstartupweekend.bmp" alt="" width="477" height="179" /></a></p>
<p>The Winners:</p>
<ol>
<li><a href="http://www.goddessalert.com/">Goddess Alert</a></li>
<li><a href="http://www.shufflewear.com/">Shuffle Wear</a></li>
<li><a href="http://www.sntmnt.com/">SNTMNT</a></li>
</ol>
<p>The other projects that pitched:</p>
<ul>
<li>Legal Toolkit</li>
<li><a href="http://www.tipntrip.com/">tipNtrip</a></li>
<li><a href="http://partywithalocal.com/">Party with a Local</a></li>
<li>UnslothMe</li>
<li>THE RACING APP</li>
<li><a href="http://www.gocaramba.com/">GoCaramba</a> (Sustainability Award)</li>
<li>Diet Community</li>
<li>Fuzzle.fm</li>
<li><a href="http://sixlegends.com/">Six Legends</a></li>
<li><a href="http://tinyurl.com/twuppetapp">Twuppets</a></li>
<li>BLINKER</li>
<li>Suggest.it</li>
<li>Joink</li>
<li><a href="http://www.cedarsuniversity.com/">Cedars University</a></li>
<li><a href="http://www.getaskbox.com">Askbox</a></li>
<li>Prep Board</li>
<li><a href="http://www.tweepfeed.com/">TweepFeed.com</a></li>
<li>Delicify</li>
<li><a href="http://paygle.net/">Project Paygle</a></li>
<li><a href="http://www.rankvote.com/">RankVote</a></li>
<li><a href="http://www.didoo.nl">Didoo</a></li>
</ul>
<p>Congratulations to the winners and all the startups! Thanks to the <a href="http://amsterdam.startupweekend.org/organizers/">organizers</a> of Amsterdam Startup Weekend it was an amazing and inspiring weekend!</p>
<p>Here is Mike Lee&#8217;s post <a href="http://mur.mu.rs/?p=243">How to Win: Lessons from Startup Weekend Amsterdam</a>.</p>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/JckyhzF_pxw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2011/07/11/amsterdam-startup-weekend-is-over/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2011/07/11/amsterdam-startup-weekend-is-over/</feedburner:origLink></item>
		<item>
		<title>Maven JAXB plugin for code generation from XSD</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/OMlOxCkO5m0/</link>
		<comments>http://www.cemreceren.com/2011/03/01/maven-jaxb-plugin-for-code-generation-from-xsd/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 09:38:04 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[jaxb]]></category>
		<category><![CDATA[maven plugin]]></category>
		<category><![CDATA[xsd]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=331</guid>
		<description><![CDATA[We can use Maven JAXB 2.1 Plugin to easily generate JAXB2 code from XSDs at build. Here are the maven dependencies for JAXB at pom.xml: and here is the JAXB xjc plugin settings at pom.xml, of course you can change the output directory configuration, I wanted to generate the code at build to target/generated-sources folder: [...]]]></description>
			<content:encoded><![CDATA[<p>We can use <a href="http://mojo.codehaus.org/jaxb2-maven-plugin/index.html">Maven JAXB 2.1 Plugin</a> to easily generate JAXB2 code from XSDs at build.</p>
<p>Here are the maven dependencies for JAXB at pom.xml:</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;dependencies&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
			&lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
		&lt;/dependency&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
			&lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
		&lt;/dependency&gt;
	&lt;/dependencies&gt;
</pre>
<p>and here is the JAXB xjc plugin settings at pom.xml, of course you can change the output directory configuration, I wanted to generate the code at build to target/generated-sources folder:</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;build&gt;
		&lt;plugins&gt;
			&lt;!-- JAXB xjc plugin that invokes the xjc compiler to compile XML schema into Java classes.--&gt;
			&lt;plugin&gt;
				&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
				&lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt;
				&lt;executions&gt;
					&lt;execution&gt;
						&lt;goals&gt;
							&lt;goal&gt;xjc&lt;/goal&gt;
						&lt;/goals&gt;
					&lt;/execution&gt;
				&lt;/executions&gt;
				&lt;configuration&gt;
					&lt;!-- The schema directory or xsd files. --&gt;
					&lt;schemaDirectory&gt;${basedir}/src/main/resources/xsd&lt;/schemaDirectory&gt;
					&lt;!-- The package in which the source files will be generated. --&gt;
					&lt;packageName&gt;com.mypackage&lt;/packageName&gt;
					&lt;!-- The working directory to create the generated java source files. --&gt;
					&lt;outputDirectory&gt;${build.directory}/generated-sources/jaxb&lt;/outputDirectory&gt;
				&lt;/configuration&gt;
			&lt;/plugin&gt;
		&lt;/plugins&gt;
</pre>
<p>As a side note for code generation: code generation convention is using &#8220;target/generated-sources/&#8221; folder, it is added as source folder by default.</p>
<p>After adding your XSD file at &#8220;resources/xsd&#8221; you can generate your code with <strong>mvn jaxb2:xjc</strong> or <strong>mvn clean install</strong> commands.</p>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/OMlOxCkO5m0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2011/03/01/maven-jaxb-plugin-for-code-generation-from-xsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2011/03/01/maven-jaxb-plugin-for-code-generation-from-xsd/</feedburner:origLink></item>
		<item>
		<title>Jericho HTML Parser</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/IP9pDoiSnJs/</link>
		<comments>http://www.cemreceren.com/2010/12/07/jericho-html-parser/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 21:53:30 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Html parser]]></category>
		<category><![CDATA[Jericho]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=317</guid>
		<description><![CDATA[I needed to parse and merge HTML for the current project I am working on. After searching and playing with several HTML parsers I decided to use Jericho which is a light-weight and easy HTML Parser. I also checked the CyberNeko HTML Parser which is another strong alternative but here is the simple reason why [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to parse and merge HTML for the current project I am working on. After searching and playing with several HTML parsers I decided to use <a href="http://jericho.htmlparser.net/">Jericho</a> which is a light-weight and easy HTML Parser. I also checked the <a href="http://nekohtml.sourceforge.net/">CyberNeko HTML Parser</a> which is another strong alternative but here is the simple reason why I did not choose it <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: center;"><a href="http://www.cemreceren.com/wp-content/uploads/2010/12/dependency.jpg"><img class="aligncenter size-full wp-image-318" title="dependency" src="http://www.cemreceren.com/wp-content/uploads/2010/12/dependency.jpg" alt="" width="668" height="98" /></a></p>
<p>The maven dependency is:</p>
<pre class="brush: xml; title: ; notranslate">
        &lt;dependency&gt;
            &lt;groupId&gt;net.htmlparser.jericho&lt;/groupId&gt;
            &lt;artifactId&gt;jericho-html&lt;/artifactId&gt;
            &lt;version&gt;3.1&lt;/version&gt;
        &lt;/dependency&gt;
</pre>
<p>Here is a simple code using <a href="http://jericho.htmlparser.net/docs/javadoc/index.html">Source</a> to construct the source data, which can be a String, Reader, InputStream, URLConnection or URL.</p>
<pre class="brush: java; title: ; notranslate">
    public String read(InputStream is) throws IOException {
        Source source = new Source(is);
        return source.getTextExtractor().toString();
    }
</pre>
<p>and you can merge the HTML using <a href="http://jericho.htmlparser.net/docs/javadoc/index.html">StreamedSource</a> which is preferred for performance with the memory. Now let&#8217;s insert a title at the <em>head</em> segment:</p>
<pre class="brush: java; title: ; notranslate">
    public String merge(InputStream is) {
        Writer writer = new StringWriter();
        try {
            StreamedSource source = new StreamedSource(is);
            for (Segment s : source) {
                if (s instanceof StartTag) {
                    writer.write(s.toString());
                    if (((StartTag) s).getName().equals(HTMLElementName.HEAD)) {
                        writer.write(&quot;&lt;title&gt;TEST&lt;/title&gt;&quot;);
                    }
                } else {
                    writer.write(s.toString());
                }
            }
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return writer.toString();
    }
</pre>
<p>As you can see Jericho is really easy to use!</p>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/IP9pDoiSnJs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2010/12/07/jericho-html-parser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2010/12/07/jericho-html-parser/</feedburner:origLink></item>
		<item>
		<title>Getting content type from file extension</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/3q1sPBVgd30/</link>
		<comments>http://www.cemreceren.com/2010/10/27/getting-content-type-from-file-extension/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 21:11:22 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=301</guid>
		<description><![CDATA[There are several ways to get the content-type from a file using the extension, you can also use Spring&#8217;s ConfigurableMimeFileTypeMap which uses javax.activation. There is also a great article about Getting the Mime Type from a File.]]></description>
			<content:encoded><![CDATA[<p>There are several ways to get the content-type from a file using the extension, you can also use Spring&#8217;s <em>ConfigurableMimeFileTypeMap</em> which uses javax.activation.</p>
<pre class="brush: java; title: ; notranslate">
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap;

import javax.activation.FileTypeMap;
import java.io.IOException;

public class ResourceContentTypeResolver {

    private FileTypeMap fileTypeMap;

    public ResourceContentTypeResolver() {
        fileTypeMap = new ConfigurableMimeFileTypeMap();
    }

    public String getContentType(String fileName) throws IOException {
        if (fileName == null) {
            return null;
        }
        return fileTypeMap.getContentType(fileName.toLowerCase());
    }

}</pre>
<p>There is also a great article about <strong><a href="http://www.rgagnon.com/javadetails/java-0487.html">Getting the Mime Type from a File</a></strong>.</p>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/3q1sPBVgd30" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2010/10/27/getting-content-type-from-file-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2010/10/27/getting-content-type-from-file-extension/</feedburner:origLink></item>
		<item>
		<title>Winter cleaning :)</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/eEuuqEnmKW8/</link>
		<comments>http://www.cemreceren.com/2010/10/27/winter-cleaning/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 21:10:56 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=308</guid>
		<description><![CDATA[Image via Wikipedia Hi again after 1 year I updated my blog&#8217;s theme, which is not very girly now I also removed some old posts, especially about JSF, because actually it has been a long time since I used JSF, and they were really very old&#8230;]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 202px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/File:Girlysound.jpg"><img title="Girly Sound" src="http://upload.wikimedia.org/wikipedia/en/f/fe/Girlysound.jpg" alt="Girly Sound" width="192" height="360" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/File:Girlysound.jpg">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>Hi again after 1 year <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I updated my blog&#8217;s theme, which is not very girly now <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I also removed some old posts, especially about JSF, because actually it has been a long time since I used JSF, and they were really very old&#8230;</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=60e0ef19-844d-4c16-b52c-5592df07683a" alt="Enhanced by Zemanta" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/eEuuqEnmKW8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2010/10/27/winter-cleaning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2010/10/27/winter-cleaning/</feedburner:origLink></item>
		<item>
		<title>log4j Custom Appender For Separate Log Files</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/55wWEX0a33U/</link>
		<comments>http://www.cemreceren.com/2009/10/21/log4j-custom-appender-for-separate-log-files/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 09:58:54 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[custom appender]]></category>
		<category><![CDATA[log4j]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=266</guid>
		<description><![CDATA[We needed different log files for a common web project, this gateway project simply loads web services dynamically and generates the wsdd files at runtime, but the problem was huge size of the common log file used by all services. So we needed different log files for different services. Here is the step by step [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="display: block;">
<div class="wp-caption alignright" style="width: 140px"><a href="http://en.wikipedia.org/wiki/Image:Lucania_Log_Book.jpg"><img title="Handbook issued to passengers on Campania" src="http://upload.wikimedia.org/wikipedia/en/thumb/c/ca/Lucania_Log_Book.jpg/300px-Lucania_Log_Book.jpg" alt="Handbook issued to passengers on Campania" width="130" height="215" /></a><p class="wp-caption-text">Image via Wikipedia</p></div>
</div>
<p>We needed different log files for a common web project, this gateway project simply loads web services dynamically and generates the wsdd files at runtime, but the problem was huge size of the common log file used by all services. So we needed different log files for different services.</p>
<p>Here is the step by step solution to separate&amp;customize the log files:</p>
<ul>
<li>The first step is adding a filter to web.xml file so we can set the service names:
<pre class="brush: xml; title: ; notranslate">&lt;filter&gt;
&lt;filter-name&gt;WSLoggerFilter&lt;/filter-name&gt;
&lt;filter-class&gt;com.logger.WSLoggerFilter&lt;/filter-class&gt;
&lt;description&gt;&lt;/description&gt;
&lt;/filter&gt;

&lt;filter-mapping&gt;
&lt;filter-name&gt;WSLoggerFilter&lt;/filter-name&gt;
&lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;
</pre>
<p><span id="more-266"></span></pre>
</li>
<li>Here is the simple filter - WSLoggerFilter.java:
<pre class="brush: java; title: ; notranslate">public final class WSLoggerFilter implements Filter {
private static final String SERVICE_NAME = &quot;serviceName&quot;;

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
String[] url = ((HttpServletRequest)request).getRequestURI().split(&quot;/&quot;);
MDC.put(SERVICE_NAME, url != null ? url[url.length - 1] : &quot;&quot;);
// Forward the request to the next resource in the chain
chain.doFilter(request, response);
MDC.remove(SERVICE_NAME);
}  .....
</pre>
</li>
</ul>
<ul>
<li>The next step is adding a custom adapter that uses the MDC "serviceName" parameter to separate the log files, we just alter the name of the default logging file by adding the serviceName parameter we set at the filter. We add the custom adapter to the log4j.properties file:
<pre class="brush: xml; title: ; notranslate"># custom file appender
log4j.appender.F=com.logger.WSLoggerAppender
log4j.appender.F.mdcName=serviceName</pre>
</li>
</ul>
<ul>
<li>Next step is implementing the custom appender. I used DailyRollingFileAppender to change the name of the logging file, simply by adding service name. Simply do not forget to override close method to close all the appenders we used. The custom adapter file WSLoggerAppender.java:
<pre class="brush: java; title: ; notranslate">public class WSLoggerAppender extends DailyRollingFileAppender {
private String mdcName;

private Map&lt;string, dailyrollingfileappender=&quot;&quot;&gt; map = new HashMap&lt;string, dailyrollingfileappender=&quot;&quot;&gt;();

@Override
public synchronized void doAppend(LoggingEvent event) {
Object key = MDC.get(getMdcName());
if (key == null) {
super.doAppend(event);
return;
}
String serviceName = key.toString();
if (serviceName != null &amp;amp;&amp;amp; serviceName.length() &gt; 0 &amp;amp;&amp;amp; !map.containsKey(serviceName)) {
try {
DailyRollingFileAppender dailyRollingFileAppender = new DailyRollingFileAppender(layout, fileName + &quot;.&quot; + serviceName, getDatePattern());
map.put(serviceName, dailyRollingFileAppender);
} catch (IOException e) {
}
}
DailyRollingFileAppender ap = (DailyRollingFileAppender) map.get(serviceName);
if (ap != null)
ap.doAppend(event);
else
super.append(event);
}

@Override
public void close() {
for (Iterator iter = map.values().iterator(); iter.hasNext();) {
DailyRollingFileAppender appender = (DailyRollingFileAppender) iter.next();
appender.close();
}
super.close();
}

public void setMdcName(String mdcName) {
this.mdcName = mdcName;
}

public String getMdcName() {
return mdcName;
}
}</pre>
</li>
</ul>
<p>That was all!</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=33298b56-ded3-486c-8d66-f9cc614e2561" alt="Enhanced by Zemanta" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/55wWEX0a33U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2009/10/21/log4j-custom-appender-for-separate-log-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2009/10/21/log4j-custom-appender-for-separate-log-files/</feedburner:origLink></item>
		<item>
		<title>Grails Startup with IntelliJ IDEA</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/oSoI6kBRWq8/</link>
		<comments>http://www.cemreceren.com/2009/01/08/grails-startup-with-intellij-idea/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 08:45:50 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[IntelliJ IDEA]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=61</guid>
		<description><![CDATA[I started a toy project just to give Grails a try and want to share the project setup, and other steps. I were really impressed by the demo applications: painless, easy startup and CRUD applications, but yes a bit too late but I were really busy at my new job, and also trying to get [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-77" title="welcome-to-grails" src="http://www.cemreceren.com/wp-content/uploads/2008/12/welcome-to-grails-300x148.jpg" alt="welcome-to-grails" width="300" height="154" />I started a toy project just to give Grails a try and want to share the project setup, and other steps. I were really impressed by the <a href="http://grails.org/Grails+Screencasts">demo applications</a>: painless, easy startup and CRUD applications, but yes a bit too late but I were really busy at my new job, and also trying to get used to my new country, and of course I admit that I am a bit lazy too <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
After reading the <a href="http://www.infoq.com/minibooks/grails">Getting Started with Grails</a> free booklet, and well prepared <a href="http://grails.org/doc/1.0.x/">Grails Documentation</a> I started playing with it <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-61"></span></p>
<p>Well startup steps with IntelliJ IDEA:</p>
<ul>
<li>Download the <a href="http://grails.org/Installation">Grails</a></li>
<li>Set the GRAILS_HOME and add it to path environment variable</li>
<li>Download the Grails IntelliJ plugin <a href="http://www.jetbrains.net/confluence/pages/viewpageattachments.action?pageId=27731">JetGroovy</a> (If you use IntelliJ IDEA 8 you should skip this step, since JetGroovy plugin is bundled in this version otherwise IDE would crash)<a href="http://www.jetbrains.net/confluence/pages/viewpageattachments.action?pageId=27731"><br />
</a></li>
<li>Just unzip the JetGroovy to plugins folder</li>
<li>Change the installation directory for Grails from Settings/Groovy&amp;Grails</li>
<li>Update the JetGroovy plugin from Settings/Plugins (There were some mysterious errors at IntelliJ like crashing at Backspace key <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  )</li>
</ul>
<p>My first <a href="http://grails.org/doc/1.0.x/">HelloGrails</a> application had the below error, after playing with the Grails version and trying an older version: grails-1.0.4, I realized that the Groovy was also necessary for JetGroovy plugin. I had already installed groovy but GROOVY_HOME environment setting was missing, but still I could not get the point: Why can&#8217;t I use Grails without Groovy @IntelliJ?</p>
<p><code>java.lang.ClassNotFoundException: org.codehaus.groovy.grails.cli.GrailsScriptRunner<br />
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)<br />
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)<br />
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)<br />
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)<br />
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:98)<br />
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
at java.lang.reflect.Method.invoke(Method.java:597)<br />
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)<br />
Process finished with exit code 1<br />
</code></p>
<p>Anyway, you can add two more steps for Grails startup for IntelliJ IDEA users:</p>
<ul>
<li>Download the <a href="http://groovy.codehaus.org/Download">Groovy</a></li>
<li>Set the GROOVY_HOME and add it to path environment variable</li>
</ul>
<p>My startup configuration:<br />
grails-1.0.4<br />
groovy-1.5.7<br />
jdk1.6.0_07<br />
IntelliJ IDEA 7.0.4</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/51b81433-4df9-4297-b277-a9879f68f03e/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=51b81433-4df9-4297-b277-a9879f68f03e" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/oSoI6kBRWq8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2009/01/08/grails-startup-with-intellij-idea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2009/01/08/grails-startup-with-intellij-idea/</feedburner:origLink></item>
		<item>
		<title>New Year Gifts :)</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/b_Rv3aIdHJE/</link>
		<comments>http://www.cemreceren.com/2008/12/31/new-year-gifts/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 05:00:37 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[books]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=98</guid>
		<description><![CDATA[Cover via Amazon The books we ordered have just arrived: great gifts for the new year The Mythical Man-Month: Essays on Software Engineering I will start with classic book of software engineering &#8211; The Mythical Man-Month: Essays on Software Engineering first which was first published in 1975 by Fred Brooks. This anniversary edition includes four [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img zemanta-action-dragged">
<div>
<dl class="wp-caption alignright" style="margin: 1em; float: right; display: block; width: 144px;">
<dt class="wp-caption-dt"><a href="http://www.amazon.com/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959%3FSubscriptionId%3D0G81C5DAZ03ZR9WH9X82%26tag%3Dzemanta-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0201835959"><img title="Cover of " src="http://ecx.images-amazon.com/images/I/51esG7-GjbL._SL200_.jpg" alt="Cover of " width="134" height="200" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;"><a href="http://www.amazon.com/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959%3FSubscriptionId%3D0G81C5DAZ03ZR9WH9X82%26tag%3Dzemanta-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0201835959">Cover via Amazon</a></dd>
</dl>
</div>
</div>
<p>The books we ordered have just arrived: great gifts for the new year <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ul>
<li><a class="zem_slink" title="The Mythical Man-Month: Essays on Software Engineering, Anniversary Edition (2nd Edition)" rel="amazon" href="http://www.amazon.com/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959%3FSubscriptionId%3D0G81C5DAZ03ZR9WH9X82%26tag%3Dzemanta-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0201835959">The Mythical Man-Month: Essays on Software Engineering</a></li>
</ul>
<p>I will start with classic book of software engineering &#8211; <em><strong>The Mythical Man-Month: Essays on Software Engineering</strong></em> first which was first published in 1975 by Fred Brooks. This anniversary edition includes four new chapters and I really wonder about the evolution of software engineering and the human factor in the past 33 years. I can&#8217;t wait especially for the legendary The Mythical-Man Month and No Silver Bullet essays.</p>
<p><span id="more-98"></span></p>
<ul>
<li><a class="zem_slink" title="Peopleware: Productive Projects and Teams   (Second Edition)" rel="amazon" href="http://www.amazon.com/Peopleware-Productive-Projects-Teams-Second/dp/0932633439%3FSubscriptionId%3D0G81C5DAZ03ZR9WH9X82%26tag%3Dzemanta-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0932633439">Peopleware: Productive Projects and Teams</a></li>
</ul>
<p>Peopleware is another oldies/goldies project management book, first published in 1987, described as <em>&#8220;Anti-Dilbert Manifesto&#8221;</em> <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ul>
<li><a class="zem_slink" title="Agile Project Management with Scrum (Microsoft Professional)" rel="amazon" href="http://www.amazon.com/Agile-Project-Management-Microsoft-Professional/dp/073561993X%3FSubscriptionId%3D0G81C5DAZ03ZR9WH9X82%26tag%3Dzemanta-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D073561993X">Agile Project Management With Scrum</a></li>
</ul>
<p>Agile Project Management book from Ken Schwaber, one of the originators of the Scrum process. Agile development process explained with lots of examples, success and failure projects.</p>
<p>I wish you a Happy New Year! <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><span style="font-size: 10pt;"><br />
</span></p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/63ce801a-58ac-4aa3-8ee7-edd316e50287/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=63ce801a-58ac-4aa3-8ee7-edd316e50287" alt="Reblog this post [with Zemanta]" /></a></div>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/b_Rv3aIdHJE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2008/12/31/new-year-gifts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2008/12/31/new-year-gifts/</feedburner:origLink></item>
		<item>
		<title>Eclipse Tip – Converting Java Project to Dynamic Web Project</title>
		<link>http://feedproxy.google.com/~r/CemreCeren/~3/fyCw1RxEvuY/</link>
		<comments>http://www.cemreceren.com/2008/12/09/eclipse-tip-converting-java-project-to-dynamic-web-project/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 09:24:13 +0000</pubDate>
		<dc:creator>Cemre Ceren</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://www.cemreceren.com/?p=24</guid>
		<description><![CDATA[We started to work on some projects, and after getting the source code, we could not use the web projects in eclipse because they were not defined as Eclipse Dynamic Web projects. Here is a small trick to convert these general projects to Dynamic Web projects. First change your perspective to Resource and check your [...]]]></description>
			<content:encoded><![CDATA[<p>We started to work on some projects, and after getting the source code, we could not use the web projects in eclipse because they were not defined as Eclipse Dynamic Web projects. Here is a small trick to convert these general projects to Dynamic Web projects.</p>
<p><span id="more-24"></span><br />
First change your perspective to Resource and check your .project file if natures tag also contains <em>facet </em>nature:</p>
<pre class="brush: xml; title: ; notranslate">
    &lt;natures&gt;
        &lt;nature&gt;org.eclipse.jdt.core.javanature&lt;/nature&gt;
        &lt;nature&gt;org.eclipse.wst.common.project.facet.core.nature&lt;/nature&gt;
    &lt;/natures&gt;
</pre>
<p>And second update your project facets by Project Properties/Project Facets/Add Remove Project Facets:</p>
<p><a href="http://www.cemreceren.com/wp-content/uploads/2008/12/eclipse_prj_facet.bmp"><img class="aligncenter size-full wp-image-51" title="eclipse_prj_facet" src="http://www.cemreceren.com/wp-content/uploads/2008/12/eclipse_prj_facet.bmp" alt="eclipse_prj_facet" /></a></p>
<p>So you can use and add this new web project to Tomcat server.</p>
<p>Note: We still use older Eclipse version 3.2.2 because of some custom plugin problems <img src='http://www.cemreceren.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/CemreCeren/~4/fyCw1RxEvuY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.cemreceren.com/2008/12/09/eclipse-tip-converting-java-project-to-dynamic-web-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.cemreceren.com/2008/12/09/eclipse-tip-converting-java-project-to-dynamic-web-project/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic Page Served (once) in 1.514 seconds -->

