• 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 LinkedIn 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 Development
  • Web Services

Archives

  • October 2011
  • September 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • 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
February 2012
M T W T F S S
« Oct    
 12345
6789101112
13141516171819
20212223242526
272829  

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

  • Purge Interval Replication Control (PIRC) prevents unwanted replication of deleted documents
  • BES Express admin interface no longer available after changing Windows services account
  • Domino 8.5.2 fixpack 3 iNotes error
  • Lotus Traveler 8.5.2.3 maintenance release
  • Tips for moving from Microsoft Outlook to IBM Lotus Notes 8.5.2

Recent Comments

  • claudio in Sync Lotus Notes Contacts with Soc…
  • madhu nallamani… in Advantages of Lotus Notes over Conv…
  • Jaap in FCK Editor Plugin: Internal Links
  • Mike in Sync Lotus Notes Contacts with Soc…
  • matthew fedak in FCK Editor Plugin: Internal Links

2007-2011 Groupwave

Valid XHTML | Valid CSS 3.0