Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-1264

No-arg actions returning Blob/Clob but whose return type is simply java.lang.Object throw exception.

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.10.0
    • 2.0.0-M5
    • Viewer Wicket
    • None

    Description

      For example:

      public Object downloadThis() {
          return new Clob(...);
      }
      

      there are two possible workarounds; either:

      a) return Clob (or Blob) instead of Object

      public Clob downloadThis() {
          return new Clob(...);
      }
      

      b) make the action take one or more args (not be a no-arg):

      public Object downloadThis(String filename) {
          return new Clob(...);
      }
      

      ~~~
      In more detail:

      The ActionLinkFactoryAbstract class has a utility method determineDeferredBehaviour that figures out from the actionModel whether this is an action with no args and returning either a Clob/Blob or a URL (that also requires special handling). It has to do so by looking at the action signature, ie the compile-time return type. If the action matches, we get back an AjaxDeferredBehaviour callback handler, and this is what is used to handle the ajax request if the action's link is subsequently clicked.

      If the action doesn't conform to this, then we just get a regular AbstractAjaxDefaultBehaviour.

      Later on, though, when we invoke the action (ActionPanel), we use this code:

                  ActionResultResponse resultResponse = ActionResultResponseType.determineAndInterpretResult(this.getActionModel(), target, resultAdapter);
                  resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
      

      which inspects the returned object and figures out the right way to "return" it. In the case of a Blob/Clob the selecting handlingStrategy basically assumes that an AjaxDeferredBehaviour has been set up. If it wasn't, then everything blows up.

      ~~~
      Don't know how to fix this. Perhaps Martin has a solution.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            hobrom Andi Huber
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment