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.

Reply via email to