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

<channel>
	<title>Alessandro Melandri &#187; J2EE</title>
	<atom:link href="http://www.melandri.net/tag/j2ee/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.melandri.net</link>
	<description>J2EE Developer &#38; Photography enthusiast</description>
	<lastBuildDate>Tue, 27 Jul 2010 19:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Get the WEB-INF folder path</title>
		<link>http://www.melandri.net/2009/05/28/get-the-web-inf-folder-path/</link>
		<comments>http://www.melandri.net/2009/05/28/get-the-web-inf-folder-path/#comments</comments>
		<pubDate>Thu, 28 May 2009 07:15:00 +0000</pubDate>
		<dc:creator>amelandri</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=14</guid>
		<description><![CDATA[This is a simple example on how to get the WEB-INF directory path in a J2EE web application. public class MyClassName&#123; &#160; private static final String WEBINF = &#34;WEB-INF&#34;; &#160; public String getWebInfPath&#40;&#41;&#123; &#160; String filePath = &#34;&#34;; &#160; URL url = MyClassName.class.getResource&#40;&#34;MyClassName.class&#34;&#41;; String className = url.getFile&#40;&#41;; &#160; filePath = className.substring&#40;0,className.indexOf&#40;WEBINF&#41; + WEBINF.length&#40;&#41;&#41;; return filePath; [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple example on how to get the WEB-INF directory path in a J2EE web application.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyClassName<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> WEBINF <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;WEB-INF&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getWebInfPath<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #003399;">String</span> filePath <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003399;">URL</span> url <span style="color: #339933;">=</span> MyClassName.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MyClassName.class&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> className <span style="color: #339933;">=</span> url.<span style="color: #006633;">getFile</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    filePath <span style="color: #339933;">=</span> className.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>,className.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span>WEBINF<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> WEBINF.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> filePath<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.melandri.net/2009/05/28/get-the-web-inf-folder-path/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
