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:
- 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 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…







