Dan Haywood created ISIS-1264:
---------------------------------
Summary: No-arg actions that return Blob or Clob but whose return
type is simply java.lang.Object throw an exception.
Key: ISIS-1264
URL: https://issues.apache.org/jira/browse/ISIS-1264
Project: Isis
Issue Type: Improvement
Components: Core
Affects Versions: 1.10.0
Reporter: Dan Haywood
Assignee: Dan Haywood
Priority: Minor
Fix For: 1.14.0
For example:
{code}
public Object downloadThis() {
return new Clob(...);
}
{code}
there are two possible workarounds; either:
a) return Clob (or Blob) instead of Object
{code}
public Clob downloadThis() {
return new Clob(...);
}
{code}
b) make the action take one or more args (not be a no-arg):
{code}
public Object downloadThis(String filename) {
return new Clob(...);
}
{code}
~~~
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:
{code}
ActionResultResponse resultResponse =
ActionResultResponseType.determineAndInterpretResult(this.getActionModel(),
target, resultAdapter);
resultResponse.getHandlingStrategy().handleResults(this,
resultResponse);
{code}
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)