wicket page expired after in another tab submiting

301 views Asked by At

I am using wicket 6.9 i have a table where the link column is created like this :

               @Override
                public void onClick() {
                    PageParameters pageParameters = new PageParameters();
                    IEntity iEntity = (IEntity) getDefaultModelObject();
                    pageParameters.set(HomePage.NAVIGATE_TO, navigateTo);
                    String routingPropertyToPass = "";
                    String idToPass = String.valueOf(BeanUtils.getProperty(iEntity, idPropertyToPass));
                    log.info(routingProperty);
                    if (!ColumnType.LINKABLE_WITH_FILTER.equals(columnDisplay.getColumnType()))
                        routingPropertyToPass = String.valueOf(BeanUtils.getProperty(iEntity, routingProperty));
                    if (filterBy != null) {
                        log.info("passing to the next page idPropertyToPass = {} and idToPass {}", iconCssOrNextPageReflectionProperty,
                                idToPass);
                        pageParameters.add("filterBy", iconCssOrNextPageReflectionProperty + "," + idToPass);
                    } else {
                        pageParameters.set(HomePage.ENTITY_ID, idToPass);
                        pageParameters.set(HomePage.ROUTING_PROPERTY, routingPropertyToPass);
                    }
                    pageParameters.set(HomePage.CLASS_NAME, clazz.getSimpleName());

                    HomePage homePage = new HomePage(pageParameters);
                    setResponsePage(homePage);

                }

when on link is opened in another tab everything is ok , also for the second and thired . but when i am submiting on 1-3 and return to the grid and from there clicking one again on another link amd get page expiered

any thoghets on why ?

1

There are 1 answers

0
cserepj On

Instead of doing all this stuff in the onClick() method of the link, compute the pageParameters object one block in, and use a BookmarkablePageLink like this:

add(new BookmarkablePageLink("link", HomePage.class, pageParameters);

The reason why you are seeing page expired messages is because the Link you are using will render non bookmarkable urls, relative to the user's page version and most probably opening newer page versions on other tabs caused the old version on which the link was valid to get discarded. You can tweak how much page versions wicket stores on the Application object, but in case you have all this nice pageparameter based stuff going on you are better off fixing your links to render bookmarkable (stateless) urls.