Re: Does the onActivate method can't return a Page?

2008-12-29 Thread d0ng
Sorry, I do not have to run the PageTest,but it fails in my running
application.


Howard Lewis Ship 写道:
> Sounds like a bug; even putting Tapestry into crippled mode (suppress
> redirects enabled) you should be able to return a page instance.
>
> Does this fail in your running app, or only inside PageTester?
>
> 2008/12/26 d0ng :
>   
>> It send a redirect response in my test because of the default value of
>>
>> SUPPRESS_REDIRECT_FROM_ACTION_REQUEST is false.
>>
>> I guess the same is true of you,you can see the network action to verify it 
>> in FireFox with Firebug.
>>
>>
>>
>>
>> Mark W. Shead 写道:
>> 
>>> I use this all the time and it works. For example:
>>>
>>> @InjectPage
>>> private Login loginPage;
>>>
>>> Object onActivate() {
>>> if(!userExists) {
>>>
>>> loginPage.setNext(this.getClass());
>>> return loginPage;
>>> }
>>> return null;
>>> }
>>>
>>> Is what I use to redirect to a login page if a user isn't logged in.
>>>
>>> Mark
>>>
>>> On Dec 24, 2008, at 9:59 AM, d0ng wrote:
>>>
>>>   
 Hi,
 I have a page that's used to redirect request to other page in some
 case,but I don't make it work well.
 For example,in the test code the Index page can't be render and there is
 nothing to output.

 public class Test {
 @InjectPage
 private Index index;

 public Object onActivate() {
 return index;
 }
 }

 Does anyone know why?

 Thanks.

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org

 
>>>   
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>> 
>
>
>
>   



Re: Does the onActivate method can't return a Page?

2008-12-29 Thread Howard Lewis Ship
Sounds like a bug; even putting Tapestry into crippled mode (suppress
redirects enabled) you should be able to return a page instance.

Does this fail in your running app, or only inside PageTester?

2008/12/26 d0ng :
> It send a redirect response in my test because of the default value of
>
> SUPPRESS_REDIRECT_FROM_ACTION_REQUEST is false.
>
> I guess the same is true of you,you can see the network action to verify it 
> in FireFox with Firebug.
>
>
>
>
> Mark W. Shead 写道:
>> I use this all the time and it works. For example:
>>
>> @InjectPage
>> private Login loginPage;
>>
>> Object onActivate() {
>> if(!userExists) {
>>
>> loginPage.setNext(this.getClass());
>> return loginPage;
>> }
>> return null;
>> }
>>
>> Is what I use to redirect to a login page if a user isn't logged in.
>>
>> Mark
>>
>> On Dec 24, 2008, at 9:59 AM, d0ng wrote:
>>
>>> Hi,
>>> I have a page that's used to redirect request to other page in some
>>> case,but I don't make it work well.
>>> For example,in the test code the Index page can't be render and there is
>>> nothing to output.
>>>
>>> public class Test {
>>> @InjectPage
>>> private Index index;
>>>
>>> public Object onActivate() {
>>> return index;
>>> }
>>> }
>>>
>>> Does anyone know why?
>>>
>>> Thanks.
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>
>>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind


Re: Does the onActivate method can't return a Page?

2008-12-26 Thread d0ng
It send a redirect response in my test because of the default value of

SUPPRESS_REDIRECT_FROM_ACTION_REQUEST is false.

I guess the same is true of you,you can see the network action to verify it in 
FireFox with Firebug.




Mark W. Shead 写道:
> I use this all the time and it works. For example:
>
> @InjectPage
> private Login loginPage;
>
> Object onActivate() {
> if(!userExists) {
>
> loginPage.setNext(this.getClass());
> return loginPage;
> }
> return null;
> }
>
> Is what I use to redirect to a login page if a user isn't logged in.
>
> Mark
>
> On Dec 24, 2008, at 9:59 AM, d0ng wrote:
>
>> Hi,
>> I have a page that's used to redirect request to other page in some
>> case,but I don't make it work well.
>> For example,in the test code the Index page can't be render and there is
>> nothing to output.
>>
>> public class Test {
>> @InjectPage
>> private Index index;
>>
>> public Object onActivate() {
>> return index;
>> }
>> }
>>
>> Does anyone know why?
>>
>> Thanks.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
>


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Does the onActivate method can't return a Page?

2008-12-26 Thread Mark W. Shead

I use this all the time and it works.  For example:

@InjectPage
private Login loginPage;

Object onActivate() {
if(!userExists) {

loginPage.setNext(this.getClass());
return loginPage;
}
return null;
}

Is what I use to redirect to a login page if a user isn't logged in.

Mark

On Dec 24, 2008, at 9:59 AM, d0ng wrote:


Hi,
I have a page that's used to redirect request to other page in some
case,but I don't make it work well.
For example,in the test code the Index page can't be render and  
there is

nothing to output.

public class Test {
@InjectPage
private Index index;

public Object onActivate() {
return index;
}
}

Does anyone know why?

Thanks.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





Re: Does the onActivate method can't return a Page?

2008-12-26 Thread Bill Holloway
It seems to me the default on that should be true.  I certainly would want
to give permission for suppression of my redirects rather than having that
be the default! :)

Bill in Austin

On Fri, Dec 26, 2008 at 12:47 PM, d0ng  wrote:

> I got it.
>
> The different behavior of this question may be cause by the setting of
> SymbolConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS.
>
> In my developing product,the value of
> SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS is set to true,then the response is
> empty.
>
> When I set it to false,the response is correct.
>
> Is this  a problem?
>
> BTW,I'm using 5.0.18.
>
> Thanks.
>
>
>
>
> Bill Holloway ??:
>
>  I set up just such a page, and have it working.  It returns my index just
>> fine.  I'm using 5.0.18, JDK 1.5, Jetty 6.1.8.
>>
>> Bill
>>
>> On Fri, Dec 26, 2008 at 8:24 AM, d0ng  wrote:
>>
>>
>>
>>> Thanks for your reply.
>>>
>>> But I find a comment "The activate event handler may also return a value,
>>> which is treated identically to a return value of a component event
>>> request
>>> event trigger. This will typically be used in an access validation
>>> scenario."
>>> from  the page http://tapestry.apache.org/tapestry5/guide/pagenav.html .
>>>
>>> The return value of a component event request event trigger could be a
>>> page
>>> instance,should I think the same as activate event?
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>>
>>> Bill Holloway ??:
>>>
>>>  My guess is that the page activation context isn't designed for this.
>>>
>>>
  There
 are a couple of workarounds.  One would be to inject the Response
 service
 (org.apache.tapestry5.services.Response) into your page class and then
 use
 it to perform the redirection in your onActivate method:

 @Inject
 private Response _response;

 void onActivate ()
 {
   _response.sendRedirect("/some/other/page");
 }

 Cheers,
 Bill

 On Wed, Dec 24, 2008 at 9:59 AM, d0ng  wrote:





> Hi,
> I have a page that's used to redirect request to other page in some
> case,but I don't make it work well.
> For example,in the test code the Index page can't be render and there
> is
> nothing to output.
>
> public class Test {
> @InjectPage
> private Index index;
>
> public Object onActivate() {
> return index;
> }
> }
>
> Does anyone know why?
>
> Thanks.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
>
>
>
>



>>>
>>>
>>
>>
>>
>
>


Re: Does the onActivate method can't return a Page?

2008-12-26 Thread d0ng

I got it.

The different behavior of this question may be cause by the setting of 
SymbolConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS.


In my developing product,the value of 
SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS is set to true,then the response 
is empty.


When I set it to false,the response is correct.

Is this  a problem?

BTW,I'm using 5.0.18.

Thanks.




Bill Holloway ??:

I set up just such a page, and have it working.  It returns my index just
fine.  I'm using 5.0.18, JDK 1.5, Jetty 6.1.8.

Bill

On Fri, Dec 26, 2008 at 8:24 AM, d0ng  wrote:

  

Thanks for your reply.

But I find a comment "The activate event handler may also return a value,
which is treated identically to a return value of a component event request
event trigger. This will typically be used in an access validation
scenario."
from  the page http://tapestry.apache.org/tapestry5/guide/pagenav.html .

The return value of a component event request event trigger could be a page
instance,should I think the same as activate event?

Thanks.






Bill Holloway ??:

 My guess is that the page activation context isn't designed for this.


 There
are a couple of workarounds.  One would be to inject the Response service
(org.apache.tapestry5.services.Response) into your page class and then use
it to perform the redirection in your onActivate method:

@Inject
private Response _response;

void onActivate ()
{
   _response.sendRedirect("/some/other/page");
}

Cheers,
Bill

On Wed, Dec 24, 2008 at 9:59 AM, d0ng  wrote:



  

Hi,
I have a page that's used to redirect request to other page in some
case,but I don't make it work well.
For example,in the test code the Index page can't be render and there is
nothing to output.

public class Test {
@InjectPage
private Index index;

public Object onActivate() {
return index;
}
}

Does anyone know why?

Thanks.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org







  



  




Re: Does the onActivate method can't return a Page?

2008-12-26 Thread Bill Holloway
I set up just such a page, and have it working.  It returns my index just
fine.  I'm using 5.0.18, JDK 1.5, Jetty 6.1.8.

Bill

On Fri, Dec 26, 2008 at 8:24 AM, d0ng  wrote:

> Thanks for your reply.
>
> But I find a comment "The activate event handler may also return a value,
> which is treated identically to a return value of a component event request
> event trigger. This will typically be used in an access validation
> scenario."
> from  the page http://tapestry.apache.org/tapestry5/guide/pagenav.html .
>
> The return value of a component event request event trigger could be a page
> instance,should I think the same as activate event?
>
> Thanks.
>
>
>
>
>
>
> Bill Holloway ??:
>
>  My guess is that the page activation context isn't designed for this.
>>  There
>> are a couple of workarounds.  One would be to inject the Response service
>> (org.apache.tapestry5.services.Response) into your page class and then use
>> it to perform the redirection in your onActivate method:
>>
>> @Inject
>> private Response _response;
>>
>> void onActivate ()
>> {
>>_response.sendRedirect("/some/other/page");
>> }
>>
>> Cheers,
>> Bill
>>
>> On Wed, Dec 24, 2008 at 9:59 AM, d0ng  wrote:
>>
>>
>>
>>> Hi,
>>> I have a page that's used to redirect request to other page in some
>>> case,but I don't make it work well.
>>> For example,in the test code the Index page can't be render and there is
>>> nothing to output.
>>>
>>> public class Test {
>>> @InjectPage
>>> private Index index;
>>>
>>> public Object onActivate() {
>>> return index;
>>> }
>>> }
>>>
>>> Does anyone know why?
>>>
>>> Thanks.
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
>


Re: Does the onActivate method can't return a Page?

2008-12-26 Thread d0ng

Yes,I have tested the Index page separately,it works well when I request it.

Thiago HP ??:

Have you tested your Index page separately? Your code looks correct.

On Wed, Dec 24, 2008 at 12:59 PM, d0ng  wrote:
  

Hi,
I have a page that's used to redirect request to other page in some
case,but I don't make it work well.
For example,in the test code the Index page can't be render and there is
nothing to output.

public class Test {
@InjectPage
private Index index;

public Object onActivate() {
return index;
}
}

Does anyone know why?

Thanks.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org







  




Re: Does the onActivate method can't return a Page?

2008-12-26 Thread Thiago HP
Have you tested your Index page separately? Your code looks correct.

On Wed, Dec 24, 2008 at 12:59 PM, d0ng  wrote:
> Hi,
> I have a page that's used to redirect request to other page in some
> case,but I don't make it work well.
> For example,in the test code the Index page can't be render and there is
> nothing to output.
>
> public class Test {
> @InjectPage
> private Index index;
>
> public Object onActivate() {
> return index;
> }
> }
>
> Does anyone know why?
>
> Thanks.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
Thiago

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Does the onActivate method can't return a Page?

2008-12-26 Thread d0ng

Thanks for your reply.

But I find a comment "The activate event handler may also return a 
value, which is treated identically to a return value of a component 
event request event trigger. This will typically be used in an access 
validation scenario."

from  the page http://tapestry.apache.org/tapestry5/guide/pagenav.html .

The return value of a component event request event trigger could be a 
page instance,should I think the same as activate event?


Thanks.






Bill Holloway ??:

My guess is that the page activation context isn't designed for this.  There
are a couple of workarounds.  One would be to inject the Response service
(org.apache.tapestry5.services.Response) into your page class and then use
it to perform the redirection in your onActivate method:

@Inject
private Response _response;

void onActivate ()
{
_response.sendRedirect("/some/other/page");
}

Cheers,
Bill

On Wed, Dec 24, 2008 at 9:59 AM, d0ng  wrote:

  

Hi,
I have a page that's used to redirect request to other page in some
case,but I don't make it work well.
For example,in the test code the Index page can't be render and there is
nothing to output.

public class Test {
@InjectPage
private Index index;

public Object onActivate() {
return index;
}
}

Does anyone know why?

Thanks.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





  




Re: Does the onActivate method can't return a Page?

2008-12-26 Thread Bill Holloway
My guess is that the page activation context isn't designed for this.  There
are a couple of workarounds.  One would be to inject the Response service
(org.apache.tapestry5.services.Response) into your page class and then use
it to perform the redirection in your onActivate method:

@Inject
private Response _response;

void onActivate ()
{
_response.sendRedirect("/some/other/page");
}

Cheers,
Bill

On Wed, Dec 24, 2008 at 9:59 AM, d0ng  wrote:

> Hi,
> I have a page that's used to redirect request to other page in some
> case,but I don't make it work well.
> For example,in the test code the Index page can't be render and there is
> nothing to output.
>
> public class Test {
> @InjectPage
> private Index index;
>
> public Object onActivate() {
> return index;
> }
> }
>
> Does anyone know why?
>
> Thanks.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>