Again Yuri you have not posted the relevant code, but at a guess this is likely 
where you are going wrong:
>where "info" constructs server url from request

Your link object should probably be constructing the relevant context for your 
link, and not from the request:

Link el = componentResources.createEventLink("getchildren", new Object[] { 
param1,param2 });

param 1 and 2 should be wired to the relevant component parameters of course.

Peter

----- Original Message -----
From: "Yury Luneff" <bitter...@ya.ru>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Thursday, 14 May, 2009 13:28:06 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re[2]: page & components activation contexts

ok.

The component has:
@SuppressWarnings("unchecked")
    public StreamResponse onGetChildren(Long watcherId, Long domId) {
    ...}

    as component event. Hence, 2 context params

    links are created like that:
Link el = componentResources.createEventLink("getchildren");
        renderSupport.addScript("cascadeUrl = \"" + info.getServerURL() +
                el.toAbsoluteURI() + "/\";");

(where "info" constructs server url from request). Maybe that's not
the true way, but javascript transforms this url by adding "/0/0" for
ex. I can't trigger "createEventLink" from client side and even if i
could, i would need to know pages context that is unrelated to the
component.

the page that uses the component:
private Integer type;

    public void onActivate(Integer type) {
        this.type = type;
    }

    public Integer onPassivate() {
           return type;
    }
--
therefore the page introduces its own activation context of one
parameter.

When the script constructs ajax request, the url becomes something
like "page/0/0/0", where the first one is from the page itself (and
provided by createEventLink) and the 2 latter are added by script.

And as the callback has only 2 parameters as context, it fails, as
tapestry tries to search onGetChildren with 3 parameters, one of which
is unrelated to the component.

I guess, now the problem is clearly described :)
> Hi Yury,

> Please post some code, it will be easier to guide you.

> Peter

> ----- Original Message -----
> From: "Yury Luneff" <bitter...@ya.ru>
> To: users@tapestry.apache.org
> Sent: Wednesday, 13 May, 2009 18:59:20 GMT +02:00 Athens, Beirut, Bucharest, 
> Istanbul
> Subject: page & components activation contexts

> Hello, users.

> Is there a way to separate activation contexts for page and its
> components?

> I wrote a component that uses AJAX to interact from client side.
> Render part of the component creates links for callbacks using
> ComponentResources. And callbacks are method with fixed number
> of arguments (2 for ex.).

> When the page that contains that component tries to introduce its own
> activation context, callback url will have page's context embedded. So
> now AJAX calls to component with 3 context elements - 1 from page and
> 2 from component. And as the component knows nothing about this, it
> must be treated in a special way (for now I retained only onActivate
> part of the page so it's not a fully pages context that is saved).

> Is there a way to clearly separate contexts of the page and component
> events so that component could be unaware of any page it is embedded
> to?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to