Mailing List webobjects-dev@wocommunity.org Message #77
From: Paul Hoadley <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] WOActionURL and WOContext.componentActionURL()
Date: Mon, 22 Feb 2021 18:21:54 +1030
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Hi Ramsey,

On 22 Feb 2021, at 5:23 pm, Ramsey Gurley <webobjects-dev@wocommunity.org> wrote:

Have a look in the ERXComponentRequestHandler. If I remember correctly, basically what happens is a component action url is just a numbered path back into an existing page object in memory. The context id lets the handler know which page to pull from the session page cache, then the element id is where in the page to find the component action targeted. Something like 5.3.2.4 means context id 5 (page with key of 5 in the cache), with element id 3.2.4 (The fourth element of the second element of the third element of the parent page). Once that happens, it knows where to call lifecycle methods (invokeAction/appendToResponse/etc) in response to the URL request. 

Which means, if you really want to see where the action is executed, look for the invokeAction in the component hierarchy, which appears to be in superclass WOHyperlink.

invokedElement = (WOActionResults)_action.valueInComponent(component);

Where _action is a WOAssociation, probably a WOBindingNameAssociation, where valueInComponent is calling valueForKeyPath on the binding value on the component. That executes the method and receives a WOActionResult.

I install the Enhanced Class Decompiler plugin to view the code for that. It's a quite nice plugin for eclipse.

Yeah, it's great!

To be honest, I'm almost at the point where I'll probably just deal with having a WOActionURL embedded in the Javascript in the page. I can see what you're looking at in WOHyperlink.invokeAction(). I take it that this line in WOActionURL is generating the URL:

String actionURL = aContext.componentActionURL(WOApplication.application().componentRequestHandlerKey(),
this.secureInContext(aContext));

And it can do that because it (the WOActionURL) is already a component with the appropriate WOAssocations (that is, including the 'action' binding)?

This is starting to seem all a bit hard. Unless someone has done it before, I think I'll skip it.


-- 
Paul Hoadley
https://logicsquad.net/
https://www.linkedin.com/company/logic-squad/

Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster