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:41 UTC

[jira] Updated: (TAPESTRY-1429) Add getLink() to ICallback

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

Jesse Kuhnert updated TAPESTRY-1429:
------------------------------------

    Fix Version/s:     (was: 4.1.3)
                   4.1.4

> Add getLink() to ICallback
> --------------------------
>
>                 Key: TAPESTRY-1429
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1429
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Core Components
>    Affects Versions: 4.0.2, 4.1.2, 4.2
>            Reporter: Geoff Callender
>             Fix For: 4.1.4
>
>
> I'd like to see a getLink() method added to ICallback so we can do redirect-after-post with the callback.
> 	public ILink getLink(IRequestCycle cycle);
> The reason is that I like to keep a "callback stack" as I descend into the pages.  A page can pop its calling page off the stack and often I'd like to redirect to it rather than just activate it.
> Suggested implementation:
> ExternalCallback.java
> ~~~~~~~~~~~~~~~~~
> 	public ILink getLink(IRequestCycle cycle)
> 	{
> 		Defense.notNull(cycle, "cycle");
> 		try {
> 			IEngineService service = cycle.getInfrastructure().getServiceMap().getService(Tapestry.EXTERNAL_SERVICE);
> 			ILink link = service.getLink(false, new ExternalServiceParameter(_pageName, _parameters));
> 			return link;
> 		}
> 		catch (ClassCastException ex) {
> 			throw new ApplicationRuntimeException(CallbackMessages.pageNotExternal(_pageName), ex);
> 		}
> 	}
> DirectCallback.java
> ~~~~~~~~~~~~~~~
> 	public ILink getLink(IRequestCycle cycle)
> 	{
> 		Defense.notNull(cycle, "cycle");
>         IPage page = cycle.getPage(_pageName);
>         IComponent component = page.getNestedComponent(_componentIdPath);
>         IDirect direct = null;
>         try
>         {
>             direct = (IDirect) component;
>             
> 			IEngineService service = cycle.getInfrastructure().getServiceMap().getService(Tapestry.DIRECT_SERVICE);
> 			ILink link = service.getLink(false, new DirectServiceParameter(direct, _parameters));
> 			return link;
>         }
>         catch (ClassCastException ex)
>         {
>             throw new ApplicationRuntimeException(CallbackMessages.componentNotDirect(component),
>                     component, null, ex);
>         }
> 	}
> PageCallback.java
> ~~~~~~~~~~~~~~~
> 	public ILink getLink(IRequestCycle cycle)
> 	{
> 		Defense.notNull(cycle, "cycle");
> 		try {
> 			IEngineService service = cycle.getInfrastructure().getServiceMap().getService(Tapestry.PAGE_SERVICE);
> 			ILink link = service.getLink(false, _pageName);
> 			return link;
> 		}
> 		catch (ClassCastException ex) {
> 			throw new ApplicationRuntimeException(CallbackMessages.pageNotExternal(_pageName), ex);
> 		}
> 	}

-- 
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