View Single Post
  #2 (permalink)  
Old 05-09-2007, 09:34 AM
JoshuaPrismon JoshuaPrismon is offline
Zimlet Guru & Moderator
 
Posts: 467
Default

Quote:
Originally Posted by JAdj View Post
Hi everybody.

I'm new to Zimbra and therefore to Zimlets.

I'm trying to create a zimlet that makes an http (GET or POST) request to a server in a computer on my local network.

I've been watching how other Zimlets do this, and I'm trying to use AjxRpc function to do this.

This function gets, as a parameter, the url to which you want to send your request. Every single zimlet I have seen use the variable ZmZimletBase.PROXY to form this url

example:
var url = ZmZimletBase.PROXY + AjxStringUtil.urlEncode(dir);

My question is: Is there any way of creating an URL without using ZmZimletBase.PROXY? I have tried just removing it but AJxRpc throws an exception.
If I use the variable, the request is not addressed to the url I want, the resulting url is something like: http://(IP of Zimbra PC)/zimbra?target=(dir), and I dont want to send the request there.

I've also tried to modify ZmZimletBase.PROXY, same result: Exception was thrown.

How is the appropriate way to modify this variable?

Any help would be appreciated. Thanks you very much in advance
The fundamental problem is that the web server enforces a same-origin policy on XMlHTTPRequest (the method below AjxRpc). That means that the Zimlet can only talk to the same server that it loaded from in the first place. That means to talk to any other server, you must proxy via the Zimlet proxy code. That Zimlet proxy code approves connections based on the XML configuration file you provided with the Zimlet.

The URL that is generated is the instructions to the proxy on how to get to the server you actually want.
Reply With Quote