So the entire ExternalCallback/ExternalPage thing is actually entirely worthless when it comes to handling something like remembering where they were going when they failed to authenticate? That seems odd, especially since it is called out as being suitable for exactly that in the tapestry pdf book. How are people doing form based authentication or is everyone just going to some default page after logging in? It seems odd to me that validate() would be called out as an adequate place to do authentication/authorization and yet provide no way to discover what would have happened if validation succeeded.
Incidentally, how would one execute a listener arbitrarily from somewhere? I can see a way to do what I want by using the ServletRequest directly, but I'd have to be able to call the listener myself. --sam On 6/20/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
Not a fun circumstance I'm sure. It's still probably better than getting NPE's. At the point when your pageValidate() method is called I'm not sure if you are in the right "state" to even bother looking for the parameters this way. The majority of requests in Tapestry end up going through the DirectService. http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/engine/DirectService.java?view=markup There are two very distinct states that things can be in within this service..Form submissions / listener method invocations is one, page renders are another. If you look at the source of the supplied link you will find that it is very probably that your listener parameters have not even been set yet. Someone else was working on this Callback interface for things. Who was it ? Scott Russel / Ron Piterman ? I can't tell anymore, there are always so many hidden libraries these days. On 6/20/06, Sam Gendler <[EMAIL PROTECTED]> wrote: > > I am trying to build an ExternalCallback during my validate method, in > order to return to the same place I was trying to reach when my > session expired. I click on a link which includes query string > parameters courtesy of the parameter included in my listener and the > validate() method fails to authorize the anonymous user, so it builds > an ExternalCallback with parameters cycle.getListenerParameters() as > the array of params, which is always null. The same thing occurs when > accessing getServiceParameters(). > > So, the brief form of the code looks like this: > > public class MyPage > extends BasePage > implements IExternalPage, PageValidateListener > { > public void pageValidate(PageEvent event) > { > if (notLoggedIn()) { > LoginPage page = getLoginPage(); > page.setNextPage(new ExternalCallback(event.getPage(), > event.getRequestCycle().getServiceParameters()); > throw new PageRedirectException(page); > } > } > > public void activateExternalPage(Object[] parameters, IRequestCycle > cycle) { > cycle.setListenerParameters(parameters); > log.debug("set listenerParams: " + parameters); > } > > public IPage sampleListener(int someParameter) { > IPage somePage = getSomePage(); > // do some work > return somePage; > } > } > > So, basically, I can't figure out how to get the parameters AND I > cannot figure out how I would cause the listener to be called after > the redirect. > > Any thoughts? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Jesse Kuhnert Tacos/Tapestry, team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]