wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: setResponsePage forward solution options
Date Wed, 24 Dec 2014 21:33:19 GMT
Hi,

Option 3) is the correct way.
This question has been asked recently by someone else. Maybe we should add
a convenience method for this in Wicket.
Please create a ticket so we don't forget!
On Dec 24, 2014 5:31 PM, "prasad.bhandagi" <prasad.bhandagi@marsh.com>
wrote:

> I am calling setResponsePage(new StatefulPage()), which then redirects the
> response, as the default Application level RenderStrategy is
> REDIRECT_TO_BUFFER
>
>
> Only for one scenario I need to forward the request instead of redirecting,
> as I need to maintain the original URL for certaing marketing javascripts
> to
> work correctly.
>
> To achieve this I came across few options.
> 1) Change RenderStrategy to ONE_PASS_RENDER - However this is application
> level flag and I do not want to change across the entire application.
> Required only for a specific scenario.
>
> 2) WebRequest.shouldPreserveClientUrl - However this is a method that needs
> to be overriden and I am not sure if I can extend the WebRequest class and
> override this method. Does not seem like a good option.
>
> 3) Write my own method as below. This is the same code as in
> RequestCycle.setResponsePage(). I have only changed the
> RenderPageRequestHandler.RedirectPolicy to NEVER_REDIRECT. Calling this
> method for the specific scenario will ensure only this request will get
> forwarded instead of redirect.
>
>         public void setResponseForwardPage(IRequestablePage page)
>         {
>                 if (page instanceof Page)
>                 {
>                         ((Page)page).setStatelessHint(false);
>                 }
>                 getRequestCycle().scheduleRequestHandlerAfterCurrent(new
> RenderPageRequestHandler(new PageProvider(page),
>
> RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT));
>         }
> While this does my job, I am still wondering if there is a better way to
> achieve this.
> Does anyone have any other thoughts to achieve this requirement or is this
> the best approach?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/setResponsePage-forward-solution-options-tp4668893.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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message