• Home
  • About
  • Contact
  • Who’s online?
  • Rss

Java agent to get an rss feed behind a proxy server

Posted By: Ken  Permalink in Ajax, Groupwave, Java, JavaScript, Lotus Notes

10

Sep

I just finished developing the integration of this blog in our company website (under ‘Portfolio’ on the right).

This site is running on domino. This is how I accomplished this:

  1. Create a java agent to read the rss feed.
  2. On the web page, use an XmlHttpRequest to call the agent and get the XML.
  3. Also in javascript: parse the XML to HTML and put in a div on the website.

The code for step 2 and 3, you can see on our website: just download the javascript code (we use dojo as a framework).

Step 1 is also fairly simple. Here is the most important part of the code:

Session session = getSession();
AgentContext agentContext = session.getAgentContext();
PrintWriter pw = 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();

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.

Then I found out that the java.policy file (in the ‘jvm/lib/security’ folder) has to be modified to allow java to modify system settings. And that’s what’s needed to set up the proxy server in java:

java.util.Properties sysProps = System.getProperties();
sysProps.put("proxySet", "true");
sysProps.put("proxyHost", "proxy.iconos.be");
sysProps.put("proxyPort", "8080");
(this is the code I inserted in the first piece of code to get it to work with the proxy server)

This is what you need to add in the java.policy file to get this to work (in the ‘grant’ section – “default permissions granted to all domains”):

permission java.security.AllPermission
permission java.util.PropertyPermission "proxySet", "write";
permission java.util.PropertyPermission "proxyHost", "write";
permission java.util.PropertyPermission "proxyPort", "write";

Hope this helps some of you…

Bookmark:

Add to Del.icio.us Add to digg Add to Facebook Add to Google Bookmarks Add to Stumble Upon Add to Technorati Add to Twitter
1 comment

Categories

  • Adobe
  • Ajax
  • eMarketing
  • Excel
  • Google
  • Groupwave
  • IBM
  • J2EE
  • Java
  • JavaScript
  • Lotus
    • Blackberry
    • Lotus Foundations
  • Lotus Notes
    • Lotusscript
  • Microsoft
  • Open Source
  • PhP
  • Web Services

Archives

  • July 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • November 2008
  • October 2008
  • June 2008
  • March 2008
  • February 2008
  • December 2007
  • October 2007
  • September 2007
  • August 2007

Meta

  • Log in
  • Main Entries Rss
  • Comments Rss
  • XFN Network
  • Wordpress
  • Web Developement Blogs - BlogCatalog Blog Directory
July 2010
M T W T F S S
« May    
 1234
567891011
12131415161718
19202122232425
262728293031  

Links

  • 1 – Groupwave - Web Technology Partner & Solutions
  • 2 – Boulevart - Rich Media Creations Winner of Adobe AIR Summercap Benelux 2007
  • 3 – Ed Brill - Lotus Notes
  • 4 – Labs.Boulevart - Flash & RIA

Recent Visitors

Recent Entries

  • Searching in Domino Designer
  • I cannot access my Lotus Connections homepage any more.
  • Domino 8.5.1 Fix Pack 2 Interim Fix 1
  • Week numbers in Notes 8.0, 8.5 and 8.5.1
  • Moving the Domino data directory in 8.X (Windows)
  • How to develop a Lotus Notes Client plug-in
  • Mindoo – 2 additional plugins for Lotus Notes 8.5.1
  • Mobile Collaboration – Supported devices chart
  • Lotus Notes Traveler in 2010
  • Godmode for windows 7

Recent Comments

  • palmi in Searching in Domino Designer
  • ZEFel in Exporting .kyr certificate for Apac…
  • ZEFel in Exporting .kyr certificate for Apac…
  • Kevin in Moving the Domino data directory in…
  • Ulrich Krause in Moving the Domino data directory in…
  • Tim E. Brown in Mobile Collaboration - Supported de…
  • resveratrol in Lotus Symphony vs OpenOffice
  • Raden Beletz in Enable lotus domino applications on…
  • Ken in Godmode for windows 7
  • Theo Heselmans in Godmode for windows 7

2007-2010 Groupwave

Valid XHTML | Valid CSS 3.0