Mailing List webobjects-dev@wocommunity.org Message #76
From: Ramsey Gurley <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] WOActionURL and WOContext.componentActionURL()
Date: Mon, 22 Feb 2021 06:53:27 +0000
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
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.

On Feb 22, 2021, at 1:58 PM, Paul Hoadley <webobjects-dev@wocommunity.org> wrote:

Hello,

I have a page component with an action method someMethod(). In the page template, I use this to get the URL for the action method into some Javascript:

<wo:WOActionURL action="$someMethod" />

This is the advertised purpose of that component, and it works as designed.

However, suppose I don't like intermixing component output like that into Javascript in the page template. What I actually want is just the text output of that WOActionURL component. (Suppose, for example, I want to generate the Javascript some other way, and all I want is that URL itself.) I would have thought that WOContext.componentActionURL() would be the solution—indeed, somewhere inside WOActionURL that's what is being called. What I cannot see is how WOActionURL is using the 'action' binding to target that method, or, indeed, any way to specify that action method to any of the variants of componentActionURL(). I must be missing something here—what is it?



Confidentiality Notice: This email, including all attachments and replies thereto, are covered by the Electronic Communications Privacy Act, 18 U.S.C. Sections 2510-2521 and are legally privileged. This information is confidential, and intended only for the use of the individuals or entities named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this transmitted information is strictly prohibited. Please notify us if you have received this transmission in error. Thank you.
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster