<?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>labs.groupwave &#187; Java</title>
	<atom:link href="http://labs.groupwave.be/index.php/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.groupwave.be</link>
	<description>Lotus, PhP, J2EE Technology Partner</description>
	<lastBuildDate>Thu, 01 Jul 2010 12:33:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Java agent to get an rss feed behind a proxy server</title>
		<link>http://labs.groupwave.be/index.php/2009/09/10/java-agent-to-get-an-rss-feed-behind-a-proxy-server/</link>
		<comments>http://labs.groupwave.be/index.php/2009/09/10/java-agent-to-get-an-rss-feed-behind-a-proxy-server/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 15:18:54 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Groupwave]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Lotus Notes]]></category>

		<guid isPermaLink="false">http://labs.groupwave.be/?p=102</guid>
		<description><![CDATA[I just finished developing the integration of this blog in our company website (under &#8216;Portfolio&#8217; on the right).
This site is running on domino. This is how I accomplished this:

Create a java agent to read the rss feed.
On the web page, use an XmlHttpRequest to call the agent and get the XML.
Also in javascript: parse the [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished developing the integration of this blog in <a href="http://www.groupwave.be" target="_new">our company website</a> (under &#8216;Portfolio&#8217; on the right).</p>
<p>This site is running on domino. This is how I accomplished this:</p>
<ol>
<li>Create a java agent to read the rss feed.</li>
<li>On the web page, use an XmlHttpRequest to call the agent and get the XML.</li>
<li>Also in javascript: parse the XML to HTML and put in a div on the website.</li>
</ol>
<p>The code for step 2 and 3, you can see on our website: just download the javascript code (we use dojo as a framework).</p>
<p>Step 1 is also fairly simple. Here is the most important part of the code:</p>
<pre><span style="color: #3366ff;">Session session = getSession();
AgentContext agentContext = session.getAgentContext();
</span><span style="color: #3366ff;">PrintWriter p</span><span style="color: #3366ff;"><span style="color: #3366ff;">w </span>= getAgentOutput();
pw.println("Content-type: text/xml; charset=utf-8");
URL labs = new URL("http://labs.groupwave.be/index.php/feed/");
BufferedReader in = new BufferedReader(new InputStreamReader(labs.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
pw.println(inputLine);
in.close();</span></pre>
<p>The tricky part for me was the get past our proxy server. I was testing this code on my local domino server meaning that the proxy server had to be used to access the internet (and the feed). I tried modifying the server document and setting the agent security to allow unrestricted operations. To no avail.</p>
<p>Then I found out that the <strong>java.policy</strong> file (in the &#8216;jvm/lib/security&#8217; folder) has to be modified to allow java to modify system settings. And that&#8217;s what&#8217;s needed  to set up the proxy server in java:</p>
<pre><span style="color: #3366ff;">java.util.Properties sysProps = System.getProperties();
sysProps.put("proxySet", "true");</span><span style="color: #3366ff;">
sysProps.put("proxyHost", "proxy.iconos.be");
sysProps.put("proxyPort", "8080");</span></pre>
<address>(this is the code I inserted in the first piece of code to get it to work with the proxy server)</address>
<p>This is what you need to add in the <strong>java.policy</strong> file to get this to work (in the &#8216;grant&#8217; section &#8211; &#8220;default permissions granted to all domains&#8221;):</p>
<pre>permission java.security.AllPermission
permission java.util.PropertyPermission "proxySet", "write";
permission java.util.PropertyPermission "proxyHost", "write";
permission java.util.PropertyPermission "proxyPort", "write";</pre>
<p>Hope this helps some of you&#8230;</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark:</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Flabs.groupwave.be%2Findex.php%2F2009%2F09%2F10%2Fjava-agent-to-get-an-rss-feed-behind-a-proxy-server%2F&amp;title=Java+agent+to+get+an+rss+feed+behind+a+proxy+server" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://labs.groupwave.be/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Flabs.groupwave.be%2Findex.php%2F2009%2F09%2F10%2Fjava-agent-to-get-an-rss-feed-behind-a-proxy-server%2F&amp;title=Java+agent+to+get+an+rss+feed+behind+a+proxy+server" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://labs.groupwave.be/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Flabs.groupwave.be%2Findex.php%2F2009%2F09%2F10%2Fjava-agent-to-get-an-rss-feed-behind-a-proxy-server%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://labs.groupwave.be/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Flabs.groupwave.be%2Findex.php%2F2009%2F09%2F10%2Fjava-agent-to-get-an-rss-feed-behind-a-proxy-server%2F&amp;title=Java+agent+to+get+an+rss+feed+behind+a+proxy+server" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://labs.groupwave.be/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Flabs.groupwave.be%2Findex.php%2F2009%2F09%2F10%2Fjava-agent-to-get-an-rss-feed-behind-a-proxy-server%2F&amp;title=Java+agent+to+get+an+rss+feed+behind+a+proxy+server" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://labs.groupwave.be/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Flabs.groupwave.be%2Findex.php%2F2009%2F09%2F10%2Fjava-agent-to-get-an-rss-feed-behind-a-proxy-server%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://labs.groupwave.be/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Java+agent+to+get+an+rss+feed+behind+a+proxy+server+@+http%3A%2F%2Flabs.groupwave.be%2Findex.php%2F2009%2F09%2F10%2Fjava-agent-to-get-an-rss-feed-behind-a-proxy-server%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://labs.groupwave.be/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://labs.groupwave.be/index.php/2009/09/10/java-agent-to-get-an-rss-feed-behind-a-proxy-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
