You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by TH Lim <ss...@gmail.com> on 2012/01/09 07:17:44 UTC
getAssociatedMarkup() invoked twice
Hi,
I made my custom markup WebPage, not the default HTML and WebPage pair, to
generate JSON responses. My custom WebPage implemented
IMarkupCacheKeyProvider and IMarkupResourceStreamProvider interfaces.
I come to realize that my implementation of
IMarkupResourceStreamProvider.getMarkupResourceStream(...) was invoked twice
for every request. Upon further investigation, I found out that the Wicket
(1.5.x and 6.x) core code in Component.getMarkup() was the source of this.
...
if (container.hasAssociatedMarkup())
{
markup = container.getAssociatedMarkup();
return markup;
}
...
where container.hasAssociatedMarkup() will also invoke getAssociateMarkup()
i.e.
public boolean hasAssociatedMarkup()
{
return getAssociatedMarkup() != null;
}
As a result, my IMarkupResourceStreamProvider.getMarkupResourceStream(...)
is invoked twice. What I did now is I override hasAssociatedMarkup() to
return a true to avoid my implementation to be invoked twice. My question
is, is this the way going forward or is there a better way of doing this?
Thanks
/lim/
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/getAssociatedMarkup-invoked-twice-tp4277728p4277728.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: getAssociatedMarkup() invoked twice
Posted by Martin Grigorov <mg...@apache.org>.
https://issues.apache.org/jira/browse/WICKET-4329
On Mon, Jan 9, 2012 at 11:05 AM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> This can be easily optimized.
> I'll take care.
>
> On Mon, Jan 9, 2012 at 8:17 AM, TH Lim <ss...@gmail.com> wrote:
>> Hi,
>>
>> I made my custom markup WebPage, not the default HTML and WebPage pair, to
>> generate JSON responses. My custom WebPage implemented
>> IMarkupCacheKeyProvider and IMarkupResourceStreamProvider interfaces.
>>
>> I come to realize that my implementation of
>> IMarkupResourceStreamProvider.getMarkupResourceStream(...) was invoked twice
>> for every request. Upon further investigation, I found out that the Wicket
>> (1.5.x and 6.x) core code in Component.getMarkup() was the source of this.
>>
>> ...
>> if (container.hasAssociatedMarkup())
>> {
>> markup = container.getAssociatedMarkup();
>> return markup;
>> }
>> ...
>>
>> where container.hasAssociatedMarkup() will also invoke getAssociateMarkup()
>> i.e.
>>
>> public boolean hasAssociatedMarkup()
>> {
>> return getAssociatedMarkup() != null;
>> }
>>
>> As a result, my IMarkupResourceStreamProvider.getMarkupResourceStream(...)
>> is invoked twice. What I did now is I override hasAssociatedMarkup() to
>> return a true to avoid my implementation to be invoked twice. My question
>> is, is this the way going forward or is there a better way of doing this?
>>
>> Thanks
>>
>> /lim/
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/getAssociatedMarkup-invoked-twice-tp4277728p4277728.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: getAssociatedMarkup() invoked twice
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
This can be easily optimized.
I'll take care.
On Mon, Jan 9, 2012 at 8:17 AM, TH Lim <ss...@gmail.com> wrote:
> Hi,
>
> I made my custom markup WebPage, not the default HTML and WebPage pair, to
> generate JSON responses. My custom WebPage implemented
> IMarkupCacheKeyProvider and IMarkupResourceStreamProvider interfaces.
>
> I come to realize that my implementation of
> IMarkupResourceStreamProvider.getMarkupResourceStream(...) was invoked twice
> for every request. Upon further investigation, I found out that the Wicket
> (1.5.x and 6.x) core code in Component.getMarkup() was the source of this.
>
> ...
> if (container.hasAssociatedMarkup())
> {
> markup = container.getAssociatedMarkup();
> return markup;
> }
> ...
>
> where container.hasAssociatedMarkup() will also invoke getAssociateMarkup()
> i.e.
>
> public boolean hasAssociatedMarkup()
> {
> return getAssociatedMarkup() != null;
> }
>
> As a result, my IMarkupResourceStreamProvider.getMarkupResourceStream(...)
> is invoked twice. What I did now is I override hasAssociatedMarkup() to
> return a true to avoid my implementation to be invoked twice. My question
> is, is this the way going forward or is there a better way of doing this?
>
> Thanks
>
> /lim/
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/getAssociatedMarkup-invoked-twice-tp4277728p4277728.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org