X-CGP-ClamAV-Result: CLEAN X-VirusScanner: Niversoft's CGPClamav Helper v1.22.2a (ClamAV engine v0.102.2) X-Junk-Score: 0 [] X-KAS-Score: 0 [] From: "Samuel Pelletier" Received: from fortimail.cybercat.ca ([216.13.210.77] verified) by post.selbstdenker.com (CommuniGate Pro SMTP 6.3.3) with ESMTPS id 25456106 for webobjects-dev@wocommunity.org; Tue, 23 Feb 2021 13:55:14 +0100 Received-SPF: none receiver=post.selbstdenker.com; client-ip=216.13.210.77; envelope-from=samuel@samkar.com Received: from [10.70.4.100] (modemcable070.93-179-173.mc.videotron.ca [173.179.93.70]) (user=samuel%samkar.com mech=PLAIN bits=0) by fortimail.cybercat.ca with ESMTP id 11NCspRd026671-11NCspRe026671 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 23 Feb 2021 07:54:52 -0500 Content-Type: multipart/alternative; boundary="Apple-Mail=_BED1161B-1AC1-45BE-B70C-A02F5234475D" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: [WO-DEV] WOActionURL and WOContext.componentActionURL() Date: Tue, 23 Feb 2021 07:54:51 -0500 References: To: WebObjects & WOnder Development In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3608.120.23.2.4) X-FEAS-AUTH-USER: samuel%samkar.com --Apple-Mail=_BED1161B-1AC1-45BE-B70C-A02F5234475D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Paul, You may also use the Ajax components with the functionName binding to = create Javascript bridges. This binding is available in AjaxHyperlink, = AjaxUpdateLink and AjaxSubmitButton at least. For example can be = called in javascript like this "doSomeAction();" and will refresh the = parent update container in the same request. If you need some parameters, AjaxSubmitButton with hidden field works = great. There is also AjaxProxy but I never used it. Regards, Samuel > Le 22 f=C3=A9vr. 2021 =C3=A0 02:51, Paul Hoadley = a =C3=A9crit : >=20 > Hi Ramsey, >=20 > On 22 Feb 2021, at 5:23 pm, Ramsey Gurley = > = wrote: >=20 >> 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.=20 >>=20 >> 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. >>=20 >> invokedElement =3D = (WOActionResults)_action.valueInComponent(component); >>=20 >> 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. >>=20 >> I install the Enhanced Class Decompiler plugin to view the code for = that. It's a quite nice plugin for eclipse. >=20 > Yeah, it's great! >=20 > 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: >=20 > String actionURL =3D = aContext.componentActionURL(WOApplication.application().componentRequestHa= ndlerKey(), > = this.secureInContext(aContext)); >=20 > And it can do that because it (the WOActionURL) is already a component = with the appropriate WOAssocations (that is, including the 'action' = binding)? >=20 > This is starting to seem all a bit hard. Unless someone has done it = before, I think I'll skip it. >=20 >=20 > --=20 > Paul Hoadley > https://logicsquad.net/ > https://www.linkedin.com/company/logic-squad/ >=20 --Apple-Mail=_BED1161B-1AC1-45BE-B70C-A02F5234475D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Paul,

You may also use the Ajax components with = the functionName binding to create Javascript bridges. This binding = is available in AjaxHyperlink, AjaxUpdateLink = and AjaxSubmitButton at least.

For example = <wo:AjaxUpdateLink updateContainerID =3D "_parent" = functionName =3D "doSomeAction"  action =3D = "$someAction" /> can be called in javascript like this = "doSomeAction();" and will refresh the parent update container in the = same request.

If= you need some parameters, AjaxSubmitButton with hidden field works = great. There is also AjaxProxy but I never used it.

Regards,

Samuel



Le 22 = f=C3=A9vr. 2021 =C3=A0 02:51, Paul Hoadley <webobjects-dev@wocommunity.org> a =C3=A9crit = :

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= =3D (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 =3D aContext.componentActionURL(WOA= pplication.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.


<= br class=3D"">= --Apple-Mail=_BED1161B-1AC1-45BE-B70C-A02F5234475D--