You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Oleksandr Yuzikov <yu...@sac.com.ua> on 2005/08/22 18:09:17 UTC

Page activation in AbstractService problem

Hi, respected tapestry users.

I want to activate "success" page after the user activation service 
performed. But I get blank page there. Any suggestions about this issue?

public void service(IEngineServiceView view, IRequestCycle cycle, 
ResponseOutputStream out) throws ServletException, IOException {
    String context[] = getServiceContext(cycle.getRequestContext());
    String username = context[0];
    String key = context[1];
       
    Global glob = (Global)cycle.getEngine().getGlobal();
    User user = glob.getUserManager().activate(username, key);
       
    if (user != null){
        glob.setActivatedUser(user);
        UserActivationSuccess page = 
(UserActivationSuccess)cycle.getPage("UserActivationSuccess");
        page.setUser(user);
        cycle.activate(page);
    } else {
        cycle.activate("UserActivationFailed");
    }
}

Thanks.

-- Oleksandr Yuzikov


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page activation in AbstractService problem

Posted by Oleksandr Yuzikov <yu...@sac.com.ua>.
Thank you Adam a lot. Works great.

Adam Greene wrote:

> Ok, then the missing line of code is:
>
>        engine.renderResponse(cycle, output);
>
> this is what actually renders the response and usually is the last 
> line in your service.
>
> ----- Original Message ----- From: "Oleksandr Yuzikov" 
> <yu...@sac.com.ua>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Tuesday, August 23, 2005 3:23 AM
> Subject: Re: Page activation in AbstractService problem
>
>
>> Thanks for replying, Adam.
>>
>> Yes, you are totally right about saving user in the global object. I 
>> need to switch the view to the UserActivationSuccess page. Then ask 
>> him/her some additional info and store it.
>> I am using Tapestry 3.0.3. My service extends AbstractSerivce class 
>> only. Activation link is something like this: 
>> http://myhost/myproject/app?service=activation/username/key
>>
>> -- Oleksandr Yuzikov
>>
>> Adam Greene wrote:
>>
>>> Well, first off, be careful about setActivatedUser that it doesn't 
>>> store the user directly in the Global because global is just that, 
>>> global across all users.  I assume that the setActivatedUser is 
>>> calling out to hivemind, hibernate, spring, or some other back end 
>>> process.  Secondly, we need more info, like what version of Tapestry 
>>> you are using (4.0 Beta 4, 3.0.3, etc). Also did you try debugging 
>>> the code and is the value of user == null or actually contain a 
>>> value.  Also what interfaces and classes does your service implement 
>>> (only really interested in the Tapestry specific ones).
>>>
>>> ----- Original Message ----- From: "Oleksandr Yuzikov" 
>>> <yu...@sac.com.ua>
>>> To: "Tapestry users" <ta...@jakarta.apache.org>
>>> Sent: Monday, August 22, 2005 1:09 PM
>>> Subject: Page activation in AbstractService problem
>>>
>>>
>>>> Hi, respected tapestry users.
>>>>
>>>> I want to activate "success" page after the user activation service 
>>>> performed. But I get blank page there. Any suggestions about this 
>>>> issue?
>>>>
>>>> public void service(IEngineServiceView view, IRequestCycle cycle, 
>>>> ResponseOutputStream out) throws ServletException, IOException {
>>>>    String context[] = getServiceContext(cycle.getRequestContext());
>>>>    String username = context[0];
>>>>    String key = context[1];
>>>>       Global glob = (Global)cycle.getEngine().getGlobal();
>>>>    User user = glob.getUserManager().activate(username, key);
>>>>       if (user != null){
>>>>        glob.setActivatedUser(user);
>>>>        UserActivationSuccess page = 
>>>> (UserActivationSuccess)cycle.getPage("UserActivationSuccess");
>>>>        page.setUser(user);
>>>>        cycle.activate(page);
>>>>    } else {
>>>>        cycle.activate("UserActivationFailed");
>>>>    }
>>>> }
>>>>
>>>> Thanks.
>>>>
>>>> -- Oleksandr Yuzikov
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page activation in AbstractService problem

Posted by Adam Greene <ag...@iq-2000.com>.
Ok, then the missing line of code is:

        engine.renderResponse(cycle, output);

this is what actually renders the response and usually is the last line in 
your service.

----- Original Message ----- 
From: "Oleksandr Yuzikov" <yu...@sac.com.ua>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, August 23, 2005 3:23 AM
Subject: Re: Page activation in AbstractService problem


> Thanks for replying, Adam.
>
> Yes, you are totally right about saving user in the global object. I need 
> to switch the view to the UserActivationSuccess page. Then ask him/her 
> some additional info and store it.
> I am using Tapestry 3.0.3. My service extends AbstractSerivce class only. 
> Activation link is something like this: 
> http://myhost/myproject/app?service=activation/username/key
>
> -- Oleksandr Yuzikov
>
> Adam Greene wrote:
>
>> Well, first off, be careful about setActivatedUser that it doesn't store 
>> the user directly in the Global because global is just that, global 
>> across all users.  I assume that the setActivatedUser is calling out to 
>> hivemind, hibernate, spring, or some other back end process.  Secondly, 
>> we need more info, like what version of Tapestry you are using (4.0 Beta 
>> 4, 3.0.3, etc). Also did you try debugging the code and is the value of 
>> user == null or actually contain a value.  Also what interfaces and 
>> classes does your service implement (only really interested in the 
>> Tapestry specific ones).
>>
>> ----- Original Message ----- From: "Oleksandr Yuzikov" 
>> <yu...@sac.com.ua>
>> To: "Tapestry users" <ta...@jakarta.apache.org>
>> Sent: Monday, August 22, 2005 1:09 PM
>> Subject: Page activation in AbstractService problem
>>
>>
>>> Hi, respected tapestry users.
>>>
>>> I want to activate "success" page after the user activation service 
>>> performed. But I get blank page there. Any suggestions about this issue?
>>>
>>> public void service(IEngineServiceView view, IRequestCycle cycle, 
>>> ResponseOutputStream out) throws ServletException, IOException {
>>>    String context[] = getServiceContext(cycle.getRequestContext());
>>>    String username = context[0];
>>>    String key = context[1];
>>>       Global glob = (Global)cycle.getEngine().getGlobal();
>>>    User user = glob.getUserManager().activate(username, key);
>>>       if (user != null){
>>>        glob.setActivatedUser(user);
>>>        UserActivationSuccess page = 
>>> (UserActivationSuccess)cycle.getPage("UserActivationSuccess");
>>>        page.setUser(user);
>>>        cycle.activate(page);
>>>    } else {
>>>        cycle.activate("UserActivationFailed");
>>>    }
>>> }
>>>
>>> Thanks.
>>>
>>> -- Oleksandr Yuzikov
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page activation in AbstractService problem

Posted by Oleksandr Yuzikov <yu...@sac.com.ua>.
Thanks for replying, Adam.

Yes, you are totally right about saving user in the global object. I 
need to switch the view to the UserActivationSuccess page. Then ask 
him/her some additional info and store it.
I am using Tapestry 3.0.3. My service extends AbstractSerivce class 
only. Activation link is something like this: 
http://myhost/myproject/app?service=activation/username/key

-- Oleksandr Yuzikov

Adam Greene wrote:

> Well, first off, be careful about setActivatedUser that it doesn't 
> store the user directly in the Global because global is just that, 
> global across all users.  I assume that the setActivatedUser is 
> calling out to hivemind, hibernate, spring, or some other back end 
> process.  Secondly, we need more info, like what version of Tapestry 
> you are using (4.0 Beta 4, 3.0.3, etc). Also did you try debugging the 
> code and is the value of user == null or actually contain a value.  
> Also what interfaces and classes does your service implement (only 
> really interested in the Tapestry specific ones).
>
> ----- Original Message ----- From: "Oleksandr Yuzikov" 
> <yu...@sac.com.ua>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Monday, August 22, 2005 1:09 PM
> Subject: Page activation in AbstractService problem
>
>
>> Hi, respected tapestry users.
>>
>> I want to activate "success" page after the user activation service 
>> performed. But I get blank page there. Any suggestions about this issue?
>>
>> public void service(IEngineServiceView view, IRequestCycle cycle, 
>> ResponseOutputStream out) throws ServletException, IOException {
>>    String context[] = getServiceContext(cycle.getRequestContext());
>>    String username = context[0];
>>    String key = context[1];
>>       Global glob = (Global)cycle.getEngine().getGlobal();
>>    User user = glob.getUserManager().activate(username, key);
>>       if (user != null){
>>        glob.setActivatedUser(user);
>>        UserActivationSuccess page = 
>> (UserActivationSuccess)cycle.getPage("UserActivationSuccess");
>>        page.setUser(user);
>>        cycle.activate(page);
>>    } else {
>>        cycle.activate("UserActivationFailed");
>>    }
>> }
>>
>> Thanks.
>>
>> -- Oleksandr Yuzikov
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page activation in AbstractService problem

Posted by Adam Greene <ag...@iq-2000.com>.
Well, first off, be careful about setActivatedUser that it doesn't store the 
user directly in the Global because global is just that, global across all 
users.  I assume that the setActivatedUser is calling out to hivemind, 
hibernate, spring, or some other back end process.  Secondly, we need more 
info, like what version of Tapestry you are using (4.0 Beta 4, 3.0.3, etc). 
Also did you try debugging the code and is the value of user == null or 
actually contain a value.  Also what interfaces and classes does your 
service implement (only really interested in the Tapestry specific ones).

----- Original Message ----- 
From: "Oleksandr Yuzikov" <yu...@sac.com.ua>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, August 22, 2005 1:09 PM
Subject: Page activation in AbstractService problem


> Hi, respected tapestry users.
>
> I want to activate "success" page after the user activation service 
> performed. But I get blank page there. Any suggestions about this issue?
>
> public void service(IEngineServiceView view, IRequestCycle cycle, 
> ResponseOutputStream out) throws ServletException, IOException {
>    String context[] = getServiceContext(cycle.getRequestContext());
>    String username = context[0];
>    String key = context[1];
>       Global glob = (Global)cycle.getEngine().getGlobal();
>    User user = glob.getUserManager().activate(username, key);
>       if (user != null){
>        glob.setActivatedUser(user);
>        UserActivationSuccess page = 
> (UserActivationSuccess)cycle.getPage("UserActivationSuccess");
>        page.setUser(user);
>        cycle.activate(page);
>    } else {
>        cycle.activate("UserActivationFailed");
>    }
> }
>
> Thanks.
>
> -- Oleksandr Yuzikov
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org