[ 
https://issues.apache.org/jira/browse/WICKET-5486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sven Ludwig updated WICKET-5486:
--------------------------------

    Description: 
In WebPageRenderer shouldPreserveClientUrl() currently has precedence over 
RedirectPolicy.ALWAYS_REDIRECT.

This can lead to confusion or unexpected behavior when 
RedirectPolicy.ALWAYS_REDIRECT is explicitely set, but for some reason 
shouldPreserveClientUrl() returns true and thus no redirect is performed due to 
the logic in WebPageRenderer.

A fix for this particular problem could be implemented in 
WebPageRenderer as of Wicket 6.12.0 by changing line 211 to:

                || (shouldPreserveClientUrl && getRedirectPolicy() != 
RedirectPolicy.ALWAYS_REDIRECT)) //


Note that this problem is slightly related to WICKET-5484. Both fixes combined 
the line could look like this:

                || (shouldPreserveClientUrl && !isAjax && getRedirectPolicy() 
!= RedirectPolicy.ALWAYS_REDIRECT)) //



  was:
In WebPageRenderer shouldPreserveClientUrl() currently has precedence over 
RedirectPolicy.ALWAYS_REDIRECT.

This can lead to confusion or unexpected behavior when 
RedirectPolicy.ALWAYS_REDIRECT is explicitely set, but for some reason 
shouldPreserveClientUrl() returns true and thus no redirect is performed due to 
the logic in WebPageRenderer.

A fix for this particular problem could be implemented in 
WebPageRenderer as of Wicket 6.12.0 by changing line 211 to:

                || (shouldPreserveClientUrl && getRedirectPolicy() != 
RedirectPolicy.ALWAYS_REDIRECT)) //


Note that this problem is slightly related to WICKET-5484. Both fixes combined 
the line could look like this:

                || (shouldPreserveClientUrl && !isAjax && getRedirectPolicy() 
!= RedirectPolicy.ALWAYS_REDIRECT)) //


Note: Possibly, there are other cases in which WebPageRenderer does not honor 
RedirectPolicy.ALWAYS_REDIRECT. It should be considered whether or not it would 
be wise/feasible to put an if condition in front of the logic to boldly check 
whether getRedirectPolicy() == RedirectPolicy.ALWAYS_REDIRECT and, if this is 
the case, go rather straight for the redirect, not checking other conditions.



> WebPageRenderer should honor RedirectPolicy.ALWAYS_REDIRECT more consistently
> -----------------------------------------------------------------------------
>
>                 Key: WICKET-5486
>                 URL: https://issues.apache.org/jira/browse/WICKET-5486
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.13.0, 7.0.0
>            Reporter: Sven Ludwig
>            Priority: Minor
>              Labels: contract, unexpected
>
> In WebPageRenderer shouldPreserveClientUrl() currently has precedence over 
> RedirectPolicy.ALWAYS_REDIRECT.
> This can lead to confusion or unexpected behavior when 
> RedirectPolicy.ALWAYS_REDIRECT is explicitely set, but for some reason 
> shouldPreserveClientUrl() returns true and thus no redirect is performed due 
> to the logic in WebPageRenderer.
> A fix for this particular problem could be implemented in 
> WebPageRenderer as of Wicket 6.12.0 by changing line 211 to:
>                 || (shouldPreserveClientUrl && getRedirectPolicy() != 
> RedirectPolicy.ALWAYS_REDIRECT)) //
> Note that this problem is slightly related to WICKET-5484. Both fixes 
> combined the line could look like this:
>                 || (shouldPreserveClientUrl && !isAjax && getRedirectPolicy() 
> != RedirectPolicy.ALWAYS_REDIRECT)) //



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to