Finally we've solved spam problem (but my collegues are not very happy with
this entire approach):
we use log4j matcher to skip error log message from RenderQueueImpl, and
log it if needed in our exception handler.

p.s. getters do not help, because they will throw exceptions too when data
unavailable.
page request check looks better but, imho, code would become much harder to
understand and support.


2014/1/16 Thiago H de Paula Figueiredo <thiag...@gmail.com>

> On Thu, 16 Jan 2014 05:49:09 -0200, Andrey <andreus...@gmail.com> wrote:
>
>  Hello!
>>
>
> Hi!
>
>
>  We are in need of redirect from render phase.
>> Reasons are: we cannot fetch all required data in onActivate method of
>> page, because onActivate is called for page even for component events
>> inside page.
>> So we load data in setupRender. But there can be problems like data not
>> found, service unavailable etc.
>>
>
> You don't need to load data in setupRender or onActivate() in most cases.
> Suppose you're using Grid to list some data fetched from a database.
> Instead of
>
> @Property
> private List<User> data;
>
> void setupRender() {
>         data = someMethodThatReturnsYourData();
> }
>
> and a template like this: <table t:type="Grid" t:source="data"/>, you can
> keep the template and fetch the data in a getter:
>
> // this annotation guarantees the method body will be actually called only
> once per
> // request, even if the method is called many times in the same request
> @Cached
> public List<User> getData() {
>         return someMethodThatReturnsYourData();
> }
>
> In onActivate(), or any other method, you can check whether it's a page
> request or not:
>
> @Inject
> private Request request;
>
> @Inject
> private ComponentEventLinkEncoder componentEventLinkEncoder;
>
> boolean pageRequest = 
> componentEventLinkEncoder.decodePageRenderRequest(request)
> != null;
>
>
>  Is there any correct way in tapestry to redirect during render?
>>
>
> No.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
откланиваюсь,
Андрюха

Reply via email to