Return-Path: Delivered-To: apmail-incubator-jspwiki-dev-archive@minotaur.apache.org Received: (qmail 19975 invoked from network); 14 Jun 2009 14:19:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jun 2009 14:19:24 -0000 Received: (qmail 31150 invoked by uid 500); 14 Jun 2009 14:19:35 -0000 Delivered-To: apmail-incubator-jspwiki-dev-archive@incubator.apache.org Received: (qmail 31125 invoked by uid 500); 14 Jun 2009 14:19:35 -0000 Mailing-List: contact jspwiki-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jspwiki-dev@incubator.apache.org Delivered-To: mailing list jspwiki-dev@incubator.apache.org Received: (qmail 31115 invoked by uid 99); 14 Jun 2009 14:19:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Jun 2009 14:19:35 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dirk.frederickx@gmail.com designates 72.14.220.156 as permitted sender) Received: from [72.14.220.156] (HELO fg-out-1718.google.com) (72.14.220.156) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Jun 2009 14:19:27 +0000 Received: by fg-out-1718.google.com with SMTP id e21so1133456fga.3 for ; Sun, 14 Jun 2009 07:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=2xC24WhsYQgjL4AZCPE16WoPb22iIZ5QSz1XKGbyJv4=; b=xII+fxdnLoQQ24ck7pX+PoyjUOQUo+jSzegYsVJzTdoiGuvxqMSzr6JdpycPgJtNrA aLJJFTB6i7ZvrC6EpbIFc4wNIihmkip20o997F3uOUmK8NVJnwngABsqHH6LK1kGzbVX mJz9aWscI0qum0uKS4Yf8P0PzVicH4/r3t3eM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=VyQPsEBhmRjs8Zs2i3utHYCmOp44+n40TEGYEZkU6RFYaKPX+nglzNOKL+goUUEsKx f2USRAZ+L0zgh52iAU7AuVf71NNLObwuRVTEYwFWykm2CSrSP3dK7p396eavXFrqkt7i im2Y6FOD3iTW03WBUTpzgKT5DpybGL5Zuc/Bc= MIME-Version: 1.0 Received: by 10.86.26.11 with SMTP id 11mr5793309fgz.45.1244989146020; Sun, 14 Jun 2009 07:19:06 -0700 (PDT) Date: Sun, 14 Jun 2009 16:19:05 +0200 Message-ID: <15cc92000906140719h3432a0e1i3d1264cbfc714a51@mail.gmail.com> Subject: ajax in v3.x - From: Dirk Frederickx To: jspwiki-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=000e0cd286e2cc3ad5046c4f9f85 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd286e2cc3ad5046c4f9f85 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Andrew, e.a., Some notes on the use of ajax in the template jsp's and the related javascript. I'll check in some updates to the javascript with new handlers to support ajax. There are 2 cases: 1) AJAX-calls to retrieve xhtml snippets. In v2.x this is done through some jsp-helper-pages which return the xhtml snippets. (not full html pages) It is currenlty used for retrieving the lucene search results for the FindContent.jsp (old AJAXSearch.jsp); the live-preview function during editing (old AJAXPreview.jsp); and the %%category popup to retrieve the list of referring-pages. (old AJAXCategories.jsp) Reading the note of Andrew, we would like to move to stripes' event handlers to deliver these ajax requests. In most cases, we'd still need some jsp's to finally deliver the returned xhtml. Notice that the returned xhtml in these cases should only return a small snippet, and not a complete jspwiki-page. (with header, footer, favorites, etc...) Client side: /* new api */ Wiki.ajax( url (==> of the Stripes ActionBean), { action: ==> Stripes event to be invoked params: ==> FORM-element or javascript-object, will be converted to &parm=value update: ==> optional, DOM-element to update with xhtml snippet onComplete: ==> callback handler on reception of the html response }); Example: Wiki.ajax('Search.jsp', { action: 'ajaxSearch', params: { query:'search-text', maxItems:20 }, update: $('dom-element'), onComplete:function(){ alert('ajax - done'); } }); or Wiki.ajax('Search.jsp', { action: 'ajaxSearch', params:$('searchform2'), ==> automatically retrieve params from the form update: $('searchResult2'), onComplete:function(){ alert('ajax - done'); } }); Notes/Questions: * The current ajaxSearch event invokes the full FindContent.jsp. It rather should return the search-result xhtml snippet inside #searchResult2. In v2.x, the FindContent.jsp invoked/included the AJAXSearch.jsp just to deliver that snippet of search-results. I'd suggest to revert back to that solution, but give it a better name: FindContent, invokinkg FindResult.jsp * 'live-preview' : I suggest to promote this generic function to a top-level jsp, rather than an template jsp. We could also opt for an extra AJAX-event on the existing ViewActionBean * AJAXCategories : This jsp is actually only invoking a jspwiki-plugin. Probably this would better be a JSON based ajax event. (see below) Or, we could consider to build a generic solution to invoke asynchronous any of the installed plugins ? 2) AJAX-calls to retrieve JSON objects (eg. upload progress tracking, find partial page matches) In v2.x this uses server-side the json-rpc. We used this for retrieving a list of pagenames with partial match in the quick-navigation drop-down (search.findPages), populate the suggestion popup during edit (search.getSuggestions) and to retrieve the progress value when upload attachements. (progressTracker.getProgress) Client-side: //v2.x example Wiki.jsonrpc('search.findPages', ['Janne',20], function(result){ //do something with the result json object }); Notes: * We'll still need to select java json tools to read/write server side the JSON objects. Unless we'll stick to json-rpc. * The findPages and getSuggestion events (currently in search.SearchManager) could be added to the SearchActionBean, to keep all kinds of searching together. * The getProgress could be added to AttachmentActionBean dirk --000e0cd286e2cc3ad5046c4f9f85--