You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "David Vittor (JIRA)" <ji...@apache.org> on 2014/09/15 16:15:34 UTC

[jira] [Updated] (JSPWIKI-566) AJAX server-side rewrite

     [ https://issues.apache.org/jira/browse/JSPWIKI-566?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Vittor updated JSPWIKI-566:
---------------------------------
    Attachment: test.html
                ajaxDispatchServlet.patch

I've cracked it.

This took an incredible amount of brain power, but I've developed a WikiAjaxDispatcherServlet that will allow JSPWiki to handle AJAX requests.

I've decided to keep the javascript generic (see makeRequest() in jspwiki-common.js), so have not used either mootools or jquery, but did as per http://javapapers.com/ajax/getting-started-with-ajax-using-java/

I've updated the WEB-INF/web.xml to pass "/ajax/*" requests to the WikiAjaxDispatcherServlet. The dispatcher uses the "ServiceRegistry" to find the right class. See: http://stackoverflow.com/questions/251336/is-something-similar-to-serviceloader-in-java-1-5 and http://docs.oracle.com/javase/1.5.0/docs/api/index.html?javax/imageio/spi/ServiceRegistry.html

I've also created a SampleAjaxPlugin, which is registered in META-INF/services/*javax.servlet.http.HttpServlet*
{noformat}
org.apache.wiki.plugin.SampleAjaxPlugin
{noformat}

AJAX calls can now be made using *<url>/ajax/SampleAjaxPlugin*

I'm not 100% sure about ACLs/permissions, but my thinking is that it is the responsibility of each plugin to handle these as required.

Attached is the patch required. Note: I've updated the *Release.java* file, but not sure if I should or not.

Also attached is a very simple test.html which shows this in action against my current digitalspider jspwiki.

Well as always let me know what you think!


> AJAX server-side rewrite
> ------------------------
>
>                 Key: JSPWIKI-566
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-566
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Core & storage
>    Affects Versions: 3.0
>            Reporter: Janne Jalkanen
>         Attachments: ajaxDispatchServlet.patch, test.html
>
>
> The AJAX library we're currently using is a bit problematic, as it stores non-serializable stuff in the HttpSession (causing all sorts of nasty exception reports in default configurations of Tomcat, and preventing clustering).  It does provide a very nice, reflection-based interface so that we can expose any class/method as a JSON endpoint, but this does not really work well with our auth system.
> We should replace the jabsorb stuff with a Stripes-native solution (possibly with some extensions to allow particular beans to expose methods as if we were using jabsorb).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)