You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org> on 2007/09/12 15:58:48 UTC
[jira] Updated: (TAPESTRY-945) Support listener methods that might
redirect OR return a page
[ https://issues.apache.org/jira/browse/TAPESTRY-945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jesse Kuhnert updated TAPESTRY-945:
-----------------------------------
Fix Version/s: (was: 4.1.3)
4.1.4
> Support listener methods that might redirect OR return a page
> -------------------------------------------------------------
>
> Key: TAPESTRY-945
> URL: https://issues.apache.org/jira/browse/TAPESTRY-945
> Project: Tapestry
> Issue Type: Improvement
> Components: Framework
> Affects Versions: 4.0.1
> Reporter: Paul Field
> Priority: Minor
> Fix For: 4.1.4
>
>
> I have a search component that finds companies:
> * If there is one company in the results, it *redirects* to that company's main page
> * If there is more than one company, it *returns* a search results page
> I would like to write a listener method like this:
> public Object doSearch() {
> List<Company> results = getResults();
>
> if (results.size() == 1){
> ExternalServiceParameter parameter = new ExternalServiceParameter("CompanyPage", new Company[]{results.get(0)});
> return getExternalService().getLink(false, parameter); // ********* Returns ILink to redirect ***********
> } else {
> SearchResultsPage searchResultsPage = getResultsPage();
> searchResultsPage.setSearchResults(results);
> return searchResultsPage; // ******* Returns IPage **********
> }
> }
> The problem is that a return type of Object means that the method is not recognised as a listener.
> **** SUGGESTION ****
> Add a marker interface to ILink and IPage for example:
> interface IDestination {}
> interface ILink extends IDestination {}
> interface IPage extends IDestination {}
> Change this method in the class ListenerMapSourceImpl:
> boolean isAcceptibleListenerMethodReturnType(Method m) {
> Class returnType = m.getReturnType();
> if (returnType == void.class || returnType == String.class)
> return true;
> return IDestination.class.isAssignableFrom(returnType); // THIS IS THE LINE THAT CHANGES
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org