Well, there is no urlFor method that takes a page, but if you use urlFor with
a RenderPageRequestHandler, the resulting url will be the same as this
method is not affected. Only the methods for RequestListenerInterface urls
are changed. For those, the url will be the bookmarkable version (with a
page id by the way). If you don't want that, your page should override
isBookmarkable and return false if it was constructed with the model
constructor.
I don't think it's possible to prevent this. The current behavior was based
on isPageStateless, which was incorrect anyway. The result for your page
would have been the same if it is stateless.
Page.wasCreatedBookmarkable also does not give the desired result, as it
is only set when the page was created as a result of opening a
bookmarkable url, not by using a bookmarkable constructor.
Best regards,
Emond
On Tuesday 20 August 2013 08:09:48 Igor Vaynberg wrote:
> so what happens to the pages that are both bookmarkable and not?
>
> public class EditCustomerPage {
> public EditCustomerPage(PageParameters params) {
> this(getEntity(params, "customer"));
> }
>
> public EditCustomerPage(IModel<Customer> customer) {
> ...
> }
> }
>
> what url will i get now when i say urlFor(new
> EditCustomerPage(customerModel)) ?
>
> -igor
>
>
> On Tue, Aug 20, 2013 at 5:39 AM, Emond Papegaaij
<[email protected]
> > wrote:
> >
> > On Monday 19 August 2013 17:32:45 Martin Grigorov wrote:
> > > Hi Emond,
> > >
> > > I think this change is OK.
> > > Maybe we can improve it a bit by using
> >
> > Application.get().getPageSettings().
> >
> > > getRecreateMountedPagesAfterExpiry() in the checks above ?
> > >
> > > With the new check as you can see the produced urls contain the
class
> >
> > name.
> >
> > > Some users don't like this.
> >
> >
Application.get().getPageSettings().getRecreateMountedPagesAfterExpiry()
> >
> > > return true by default. If someone doesn't like the extra info in the
> > > produced urls then she can disable it this way.
> >
> > I've thought some more about this, and I think the current behavior is
ok.
> > If
> > you don't want bookmarkable urls, but your page has a bookmarkable
> > constructor, you should override isBookmarkable. The setting is more
> > about request handling than it is about rendering urls. The reason the
> > pageparameters are not rendered in the url is, that they would
otherwise
> > be rendered as query parameters, overriding other (such as form)
> > parameters.
> >
> > I'll merge the branch somewhere tomorrow and forward port it to 7 if
> > nobody objects.
> >
> > Best regards,
> > Emond