Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1861

Wrap javascript call rendering apis for interoperability and convenience


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 5.3.2
    • Fix Version/s: None
    • Component/s: tapestry-core


      Vast improvements to the ajax and javascript rendering API's have made things much easier to use in tapestry 5.2+, however I still think there is room for improvement. I find I can't work without this 'helper' service I designed to standardise script call rendering between xhr and non-xhr requests. The main motivation/benefit is that a set of functionality can now be called in either (xhr/non-xhr) context and still work. It also has the benefit of building the necessary JavaScriptCallback in the xhr context. In my opinion, this makes user code much tidier:

      public class JavascriptHelperImpl implements JavascriptHelper
      private AjaxResponseRenderer ajaxResponseRenderer;
      private Request request;
      private JavaScriptSupport jsSupport;

      public void addScript(final String format, final Object... args)
      if (!request.isXHR())

      { jsSupport.addScript(format, args); return; }

      ajaxResponseRenderer.addCallback(new JavaScriptCallback()
      public void run(JavaScriptSupport javascriptSupport)

      { javascriptSupport.addScript(format, args); }


      There may or may not be additional opportunity with the other methods such as 'addInitializerCall' but I haven't needed to.

      This code is free for anyone (including apache/tapestry) to use.


          Issue Links



              • Assignee:
                hlship Howard M. Lewis Ship
                paul.stanton Paul Stanton
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: