Re: takeValuesFromRequest not triggered
Re: takeValuesFromRequest not triggered
- Subject: Re: takeValuesFromRequest not triggered
- From: Chuck Hill <email@hidden>
- Date: Sun, 20 Mar 2005 13:06:37 -0800
Make the default action a direct action. Or put this code into
appendToResponse in Main. This is covered in Practical WebObjects, by the
way.
Chuck
At 03:50 PM 20/03/2005 -0500, Drew Thoeni wrote:
>That works well for all DirectActions but not for defaultAction (that
>is, for Main).
>
>Unfortunately, I'm trying to trigger the auto login when Main is first
>shown to the user. I looked for an analogous method like
>"performDefaultAction" but can't find any reference to how to detect
>that the default action has been triggered.
>
>
>On Mar 20, 2005, at 12:16 PM, Anthony Paras wrote:
>
>> TakeValuesFromRequest only gets called if it's a component action. Try
>> overriding this method in DirectAction like so:
>>
>> public WOActionResults performActionNamed(String name) {
>>
>> if (existingSession() == null) {
>> ((Session)session()).attemptAutoLoginFromCookie();
>> }
>> return super.performActionNamed(name).generateResponse();
>> }
>>
>>
>>
>> On 3/20/05 8:59 AM, "Drew Thoeni" <email@hidden> wrote:
>>
>>> I have the following method in my Main component, attempting to keep
>>> a user
>>> automatically logged in if they have selected so on their previous
>>> login. The
>>> cookie is writing out fine with appendToResponse. However, this
>>> method never
>>> gets triggered in Main when the user returns. Main is a DirectAction
>>> (have
>>> tried turning that off with same result).
>>>
>>> All docs point to this being correct. But since it's not working, I'm
>>> sure I'm
>>> missing something.
>>>
>>> Regards,
>>>
>>> Drew
>>>
>>>
>>> public void takeValuesFromRequest(WORequest aRequest, WOContext
>>> aContext)
>>> {
>>> super.takeValuesFromRequest(aRequest, aContext);
>>> String primaryEmail = aRequest.cookieValueForKey("primaryEmail");
>>> if (primaryEmail != null) {
>>> NSDictionary bindings = new NSDictionary(primaryEmail,
>>> "primaryEmailIn");
>>> User tempUser =
>>> (User)EOUtilities.objectWithFetchSpecificationAndBindings( ec, "User",
>>> "FetchSingleUser", bindings);
>>> if (tempUser != null) {
>>> session.currentPlayer = tempUser;
>>> }
>>> }
>>> }
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>> email@hidden
>>>
>>> This email sent to email@hidden
>>
>>
>>
>>
>> On 3/20/05 8:59 AM, "Drew Thoeni" <email@hidden> wrote:
>>
>>> I have the following method in my Main component, attempting to keep
>>> a user
>>> automatically logged in if they have selected so on their previous
>>> login. The
>>> cookie is writing out fine with appendToResponse. However, this
>>> method never
>>> gets triggered in Main when the user returns. Main is a DirectAction
>>> (have
>>> tried turning that off with same result).
>>>
>>> All docs point to this being correct. But since it's not working, I'm
>>> sure I'm
>>> missing something.
>>>
>>> Regards,
>>>
>>> Drew
>>>
>>>
>>> public void takeValuesFromRequest(WORequest aRequest, WOContext
>>> aContext)
>>> {
>>> super.takeValuesFromRequest(aRequest, aContext);
>>> String primaryEmail = aRequest.cookieValueForKey("primaryEmail");
>>> if (primaryEmail != null) {
>>> NSDictionary bindings = new NSDictionary(primaryEmail,
>>> "primaryEmailIn");
>>> User tempUser =
>>> (User)EOUtilities.objectWithFetchSpecificationAndBindings( ec, "User",
>>> "FetchSingleUser", bindings);
>>> if (tempUser != null) {
>>> session.currentPlayer = tempUser;
>>> }
>>> }
>>> }
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>> email@hidden
>>>
>>> This email sent to email@hidden
>>
>>
>>
>>
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Webobjects-dev mailing list (email@hidden)
>Help/Unsubscribe/Update your Subscription:
e.net
>
>This email sent to email@hidden
>
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden