You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ravi <ra...@intellinet.de> on 2019/05/10 07:39:19 UTC
Wicket 8 rendering of components
Hi all,
I have a question regarding the rendering in Wicket 8.3.0.
We have a Wicket 7.2.0 implementation of SecureForm for CSFR prevention
similar to what shayy posted here
http://apache-wicket.1842946.n4.nabble.com/Implementing-a-SecureForm-to-avoid-CSRF-attacks-td4666175.html
Basically we programatically add the markup of a hidden input in
onComponentTagBody( markup, tag) of the Form.
This hidden input was added to the component tree in onInitialize.
In onBeforeRender we mark the component as rendered.
Worked fine so far.
What seems to be happening is that onBeforeRender ist called in
ComponentRenderingRequestHandler.beforeRender before component.renderPart
ist called.
RenderPart resets the renderedComponents in the Page - throwing away our
hidden input that was added in onBeforeRender.
Leaving us with an exception that ist thrown during Page.checkRendering.
Is this the expected behavior and if so how would I go about marking
components as rendered?
Thanks for any hint,
Ravi
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 8 rendering of components
Posted by Ravi <ra...@intellinet.de>.
I'll try that,
Thank you for your quick response, Sven!
-Ravi
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 8 rendering of components
Posted by Ravi <ra...@intellinet.de>.
Hi Sven,
sure thing, here it is.
Thanks!
Ravi
secure-form-example1.zip
<http://apache-wicket.1842946.n4.nabble.com/file/t375522/secure-form-example1.zip>
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 8 rendering of components
Posted by Sven Meier <sv...@meiers.net>.
Hi,
in Wicket 8.x an Ajax response prepares all components beforehand and only then renders all components afterwards.
Simplest fix would be overwriting #onRender() and let it call rendered() on your fake input instead.
I'd suggest to skip that unnecessary input altogether - just let your #isTokenValid() query the request parameter directly:
getRequest().getRequestParameters().getParameterValue(tokenId).toString()
Much simpler IMHO
Have fun
Sven
>
> On 13.05.2019 at 09:26, <Ravi> wrote:
>
>
> Hi Sven, sure thing, here it is. Thanks! Ravi secure-form-example1.zip -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org
>
Re: Wicket 8 rendering of components
Posted by Sven Meier <sv...@meiers.net>.
Hi,
> how would I go about marking components as rendered?
Wicket marks components as they are rendered, this isn't something you
need/should do.
Why aren't you just using a HiddenField? A quickstart would help to
understand your problem, especially to compare it with Wicket 7.x.
Regards
Sven
Am 10.05.19 um 09:39 schrieb Ravi:
> Hi all,
>
> I have a question regarding the rendering in Wicket 8.3.0.
>
> We have a Wicket 7.2.0 implementation of SecureForm for CSFR prevention
> similar to what shayy posted here
> http://apache-wicket.1842946.n4.nabble.com/Implementing-a-SecureForm-to-avoid-CSRF-attacks-td4666175.html
>
> Basically we programatically add the markup of a hidden input in
> onComponentTagBody( markup, tag) of the Form.
> This hidden input was added to the component tree in onInitialize.
> In onBeforeRender we mark the component as rendered.
>
> Worked fine so far.
>
> What seems to be happening is that onBeforeRender ist called in
> ComponentRenderingRequestHandler.beforeRender before component.renderPart
> ist called.
> RenderPart resets the renderedComponents in the Page - throwing away our
> hidden input that was added in onBeforeRender.
> Leaving us with an exception that ist thrown during Page.checkRendering.
>
> Is this the expected behavior and if so how would I go about marking
> components as rendered?
>
> Thanks for any hint,
>
> Ravi
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org