Sunday, July 16, 2006

L-arginine, What Does It Do?

AJAX - Read a file Outside the field

As previously indicated, AJAX applications can not access files outside the internet domain of the calling page (it should be noted however that this limitation does not seem to affect Microsoft Internet Explorer). The preferred method to exceed this limit, whatever the browser used, is through a "Cross-Domain Proxy".

Cross-Domain Proxy

A "cross-domain proxy" is nothing more than an application hosted in the area, which will download the file outside desired and return to the AJAX application. This technique is used by NetVibes . By opening NetVibes with Firefox extension Firebug , we see that the son's RSS page is called through a URL like: http://www.netvibes.com/xmlProxy.php?url=http% 3A / / swww.acme.com / rss.xml

PHP Application xmlProxy.php simply retrieve the XML file and transmit to the Web browser. It does not include information prior to shipment. This helps avoid overloading the server, leaving that task to the client.

Lotus Domino Cross-Domain Proxy

To do the same thing with Lotus Notes I started by using the method "ALAXA" presented in the article " Seeking information on the Internet from a Lotus Notes client . Unfortunately it appears the responseText property mismanaging, if at all, charset other than UTF-8. The main sources of information are encoded in French ISO-8859-1 I could use this method.

So I decided to take the opportunity to develop an agent in Lotus Notes Java.
The agent must retrieve the target URL as an argument and return the contents of that URL.
cross domain proxy
The source code of the agent is :
   import lotus.domino.*; 
import java.io.*;
import java.net.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// Récupération de l'URL passé en argument de l'agent
Document doc = agentContext.getDocumentContext();
String newurl = doc.getItemValueString("Path_Info_Decoded");
newurl = newurl.substring(newurl.indexOf("url=") + 4);
URL url = new URL (newurl);

/ / Initialize the result to return
String result = "";

/ / The information will be sent to the browser as XML
PrintWriter pw = getAgentOutput ();
pw.println ("Content-type: text / xml" )

/ / Get the contents of the target page
BufferedReader in = new BufferedReader (new InputStreamReader (url.openStream ())); String
inputLine;
while ((inputLine = in.readLine ())! = null ) {result + =
inputLine.toString ();}


/ / Send the result to the Web browser
pw.println (result);
doc.recycle ();

} catch (Exception e) {e.printStackTrace
();}


}}
To call the agent must use a URL Type: http://serverlocal/path/base.nsf/agent?openagent&url=http% 3A / / sitecible / path / file

Integration into the RSS aggregator

can easily integrate this feature in the RSS aggregator previously presented.

ajax rss
  • Step 1: Integration of the agent on a base of the web domain. The agent may be declared in the database itself or from any other basis for the domain.
  • Step 2: Submitting URLs to open thread. Instead of directly indicating the URL of the target, it is preceded by the URL of the agent according to the format presented. We can also provide development to automatically this syntax to simplify the task of the user.
Attention javascript interpretation of RSS son presented does not support the ATOM format yet.

[Update] Added doc.recycle () following the remark Yogi Administrator dark Blog DarkBlog accessible without hesitation.

0 comments:

Post a Comment