What I want to do is changing this code inside a direct action (which does not 
create a session but does not allow me to change its secure flag)

nextPage = pageWithName(RegisterUser.class);
nextPage.takeValueForKey(Boolean.TRUE, "success");
return nextPage;

to something equivalent where I can change the secure flag...
If I understand correctly if I use ERXRedirect I have to use direct actions, 
so... I have to create a "dummy" direct action which simply redirect to the 
page I want, and than user ERXRedirect 

This is my code:

ERXRedirect redirect = pageWithName(ERXRedirect.class);
redirect.setUrl(context().directActionURLForActionNamed("UserAction/helpRedirect",
                new NSDictionary<String, Object>(new Object[] {Boolean.TRUE}, 
new String[] {"registration"}),
                false,
                true));
                
return redirect;

public WOActionResults helpRedirectAction() {
                
        WOComponent nextPage = pageWithName(UtilitiesPage.class);
        NSArray<String> dict = request().formValueKeys();
        for (String key: dict)
                nextPage.takeValueForKey(request().formValueForKey(key), key);
        return nextPage;
}

and in my utilities page:

public void setRegistration(Object value) {
        if (value != null) {
                if (value.getClass().equals(String.class))
                        this._registration = new 
BooleanHolder(Boolean.parseBoolean((String)value));
                else if (value.getClass().equals(Boolean.class))
                        this._registration = new BooleanHolder((Boolean)value); 
        
        }
        
        else
                _registration = null;
}


It seems to work, but.... is this really necessary?

Francesco

On 27/nov/2010, at 11.08, Simon wrote:

> look at the source code to ERXRedirect, line 175:
> 
> WOSession aSession = session();
> 
> ....bingo. A session gets created.
> 
> a quick scan through the code suggests that this only happens when
> handing a component to the redirect. Redirect to a DA or an explicit
> URL and you shouldn't get a session
> 
> simon
> 
> On 27 November 2010 08:17, Francesco Romano <fra.makav...@gmail.com> wrote:
>> I don't understand...
>> Ok for Ajax.. I think that I'll keep the session.
>> 
>> But.. what abut going from secure to non secure page?
>> 
>> Francesco
>> 
>> On 26/nov/2010, at 13.31, Henrique Gomes wrote:
>> 
>>> A session is always created if you use statefull components or form actions.
>>> The page needs to be all made with stateless components and the form must 
>>> use direct actions.
>>> 
>>> As for Ajax, well, you might have to rethink it:
>>> 
>>> http://osdir.com/ml/webobjects-dev/2009-07/msg00319.html
>>> 
>>> 
>>> Henrique Gomes
>>> 
>>> 
>>> On Nov 26, 2010, at 11:05 AM, Francesco Romano wrote:
>>> 
>>>> Hi.
>>>> The title is not clear, I know... that's because I've 2 question related 
>>>> to session, redirection and direct action.
>>>> 
>>>> 1) I have two pages which are secure (login and registration page).
>>>> What I want to do is, after a successful login (or registration), redirect 
>>>> to a non secure page (like the home page).
>>>> The submit buttons link to two Direct Actions.
>>>> 
>>>> I don't have problem with the login page, because I need a session, so I 
>>>> do something like:
>>>> 
>>>>      nextPage = pageWithName(Main.class);
>>>>      ERXRedirect redirect = pageWithName(ERXRedirect.class);
>>>>      redirect.setSecure(false);
>>>>      redirect.setComponent(nextPage);
>>>>      return redirect;
>>>> 
>>>> but.. for a registration page I  don't want to create a session.. what can 
>>>> i do?
>>>> 
>>>> 2) Ajax components need session? Because I've a "ajax" list product page 
>>>> and a session is automatically created
>>>> 
>>>> Thank you
>>>> 
>>>> Francesco Romano
>>>> 
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/lists%40farol.pt
>>>> 
>>>> This email sent to li...@farol.pt
>>> 
>> 
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/simon%40potwells.co.uk
>> 
>> This email sent to si...@potwells.co.uk
>> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to