Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2007, 02:05 AM
New Member
 
Posts: 4
Default ZmZimletBase.PROXY when using AjxRpc

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
Reply With Quote
  #2 (permalink)  
Old 05-09-2007, 09:34 AM
Zimlet Guru & Moderator
 
Posts: 431
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
  #3 (permalink)  
Old 05-11-2007, 02:00 AM
New Member
 
Posts: 4
Default

Quote:
Originally Posted by lostknight View Post
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.
Thank you lostknight, I made it work by allowing the domain I wanted to address on Zimbra.

I have another doubt, however. My zimlet doesnt match the regular expression on the Contact List, it does it only in email bodies. How can I make it work on every frame of the Web Interface?

what does the parameter "paren" under the tag <regex> means?

Thank you very much
Reply With Quote
  #4 (permalink)  
Old 06-19-2007, 07:07 AM
Loyal Member
 
Posts: 97
Default Problems with post

FYI, I don't know if it's fixed now or not. But in the lower 4.0 versions of Zimbra, the proxy using post did not work so well. We had to have javascript open a new window and post to the server we wanted to post to. But I think it's working now, you can check the bugzilla.

I'm trying to do the same thing you are doing, would you mind posting or sending me the code you are using to connect create your request.
__________________
EricX
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0