Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Post and params

  1. #1
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    Default Post and params

    I'm trying to do something so simple. Pass some param's using post. I've looked at the Wikipedia sample and the jspSample. Both have parts of what I want to do.

    Can anyone explain how post works? I can't do this with get. I have too much information.
    EricX

  2. #2
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default Easiest way is to try it and see

    The easiest way to see what a POST looks like is to whip up a simple HTML form and see what gets POSTed when you hit the submit button.

    However, if you're trying to create a POST from a browser, you shouldn't need to care about what it looks like over the wire. Just have your zimlet generate a form and submit it when appropriate -- the browser should do the right thing.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #3
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    Default Thanks but...

    I'm trying to have the form work automatically submit from a drag and dropped email.

    I've been modifying the wikipedia zimlet, but no success so far.
    EricX

  4. #4
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    Default AjxRpc shows progress

    Went through a bunch of code and found AjxRpc.blahblah. I found a note in the source tomcat\webapps\zimbra\js\ajax\net\AjxRpc.js. The note said one of the parameters is useGet.

    function(requestStr, serverUrl, requestHeaders, callback, useGet, timeout)

    If this parameter is omitted it defaults to post.
    -----Note----
    * @param {Boolean} useGet if true use get method, else use post. If ommitted
    * defaults to post

    -----End Note-----

    Now I just have to put all the pieces together and see if it will pass to the server. Going to bed now. Leaving this till tomorrow.
    EricX

  5. #5
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    Default Proof that post does not work!

    I've posted a php postback page so others can test my code.

    It's very easy!

    Behavior: Drag an email onto the zimlet and it $_post's it to a php page.

    Only problem is post does not work? $_Get works, but post doesn't.

    I've looked at several sample zimlets and post does not work there either. It seems that others have made workarounds that use included java code.

    My code and a public web site to test it.
    http://www.qpmp.com/zimbra/zm_post_test.php - for the post code.

    http://www.qpmp.com/zimbra/zm_get_test.php - for the get code.

    The only difference between the two pages is the word post and get.

    I need to get this figured out. I made the decision to use Zimbra for the ability to do mashups. The ability to move information from zimbra to another web page/form/service should be a simple process.

    Hopefully I'm doing something wrong or I don't understand how this is supposed to work. If this is the case someone please help me. I'll be glad to pay. I've got to get this done.
    EricX

  6. #6
    jtroxel is offline Member
    Join Date
    Jul 2006
    Posts
    13
    Rep Power
    9

    Default Maybe with a header?

    I've also seen issues with post vs. get and AjxRpc. I have not chased this down completely, but I think there might be some issue in the ProxyServlet.

    The only posts that I know of that work in my experience are those that set the header param. E.g.:
    var reqHeader = {"Content-Type":"application/x-www-form-urlencoded"};

    // Invoke http post
    AjxRpc.invoke(reqParam, url, reqHeader, new AjxCallback(this, this._myCallback));

  7. #7
    jtroxel is offline Member
    Join Date
    Jul 2006
    Posts
    13
    Rep Power
    9

    Default Nope

    This did not work, either. I believe that there is a bug in the ProxyServlet and posts, starting at 4.0 (which I noticed had a new impl of the servlet). On one of my projects we had to change all of our posts to gets when we went from 3.x->4.0.

    - JT

  8. #8
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    Default Work arounds for post

    One idea that did not work is using the window.open(url, "wikipedia", props); technique from the wikipedia example. The window.open only supports get method.

    A long way around could be to pass just the email id using get to the receiving page, use some rest command or maybe rss to pull or extract the email information from zimbra into our example.php page. But then you get into permissions and all sorts of stuff.
    EricX

  9. #9
    Ericx is offline Loyal Member
    Join Date
    Jul 2006
    Location
    Virginia Beach, VA
    Posts
    97
    Rep Power
    9

    Default Hacking the ProxyServlet.java

    What if we took this class - changed the names so there are no conflicts, made several of the methods and variables public.
    The new ProxyServletPostem.java class would need to be included with the zimlet. The zimlet like com_zimbra_myzimlet, would include ProxyServletPostem.java or .jsp - don't know the java naming convention, I'm more of a PHP, C++, and VB guy, but learning.

    Then in the zimlet create an instance of the ProxfServletPostem class, fill in all the vars via config_template.xml for static globals, user preferences can be where ever they are stored in zimlets and the stuff like email_obj.body can be pulled from the drag and drop.

    Then just invoke or run or what ever you do in java to make it all run.

    I've posted a link to the code. Any thoughts?

    http://svn.sourceforge.net/viewvc/zi...09&view=markup
    EricX

  10. #10
    jtroxel is offline Member
    Join Date
    Jul 2006
    Posts
    13
    Rep Power
    9

    Default Yes, one could

    refactor the ProxyServlet into a JSP for the Zimlet. However, you would want to either start with the 3.x version, or fix whatever is wrong with it in 4.0. It is this very class that is causing the current issues with posting.

    I entered a bug re the servlet: http://bugzilla.zimbra.com/show_bug.cgi?id=14417

    As for rendering a form and letting it post directly, the following is a snippet that pops the results into a new window:
    Code:
        html[i++] = "<form method=\"POST\" id=\"dp_form\" action=\"" + this.HANDLER + "\" TARGET=\"new_popup\">";
    ...
        this.dpForm = document.getElementById("dp_form");
    ...
        var w = window.open('about:blank','new_popup','width=600,height=500,resizable=1');
        this.dpForm.submit();
        w.focus();

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •