Mailing List webobjects-dev@wocommunity.org Message #173
From: Aaron Rosenzweig <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] ERXRedirect unknownKeyException???
Date: Sat, 8 May 2021 11:40:00 -0400
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Maybe you are working too hard - go about it another way. 

In java make the calculation and instead of going to the “payment” page go directly to the “thank you” page.

On May 8, 2021, at 11:30 AM, Ralf Schuchardt <webobjects-dev@wocommunity.org> wrote:

I think you are getting the error because setting a binding also involves reading the value back, therefore all bindings should also have a getter method.

ERXRedirect is supposed to be returned as a component in an action method. So instead of returning the thank you page, you would return an ERXRedirect instance.

But this does probably not solve your problem, as you are already on the ThankYouPage. As most of the work is done in ERXResponse.appendToResponse() you may try to manually call this in ThankYouPage’s appendToResponse:

public void appendToResponse(WOResponse aResponse, WOContext aContext) {

    if (noPayment) {
        ERXRedirect redirect = pageWithName(ERXRedirect.class);
        redirect.setComponent( redirectComponent );
        redirect.appendToResponse(aResponse, aContext);
    }
    super.appendToResponse()
}

This should set a location header and 302 response code and so redirect to the target page.

Ralf

On 8 May 2021, at 16:17, Markus Ruggiero (rucotec) wrote:

When I transfer to a payment page but this page sees that there is no payment to be collected I want to directly jump further to the Thank You page. Everything is component action, everything happens inside a session.

In my .wo, inside a WOConditional that triggers when there is no payment needed

<webobject name = "noPaymentRequested">
    <p>No payment required at the moment<br /></p>
    <webobject name = "automaticallyContinue" />
</webobject name = "noPaymentRequested”>

<webobject name = "includePayment">
    <webobject name = "paymentPanel" />
</webobject name = "includePayment">

with the binding

automaticallyContinue : ERXRedirect {
    component = thankYouPage;
}

In my java:

public WOComponent thankYouPage() {

    invoiceRemoteRequest.setStatus(E_RemoteRequestStatus.DONE);
    EOEditingContext ec = invoiceRemoteRequest.editingContext();
    ec.saveChanges();

    notifyCoordinator();

    RemoteActionThankYouPage nextPage = pageWithName(RemoteActionThankYouPage.class);
    nextPage.setInvoiceRemoteRequest(invoiceRemoteRequest);
    return nextPage;
}

And the result:

<com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException message '[<er.extensions.appserver.ERXRedirect name: er.extensions.appserver.ERXRedirect subcomponents: null > valueForKey()]: lookup of unknown key: 'component'.
The WOComponent er.extensions.appserver.ERXRedirect does not have an instance variable of the name component or _component, nor a method of the name component, _component, getComponent, or _getComponent' object '<er.extensions.appserver.ERXRedirect name: er.extensions.appserver.ERXRedirect subcomponents: null >' key 'component'>

Calling the setter is ok, but why is it trying to call a getter? 
What am I missing here?

Thanks a lot
---markus---


Markus Ruggiero

rucotec GmbH                        web https://rucotec.ch
Steinenvorstadt 79                email markus.ruggiero@rucotec.ch
4051 Basel / Switzerland         mobile +41 79 508 4701

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