You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/12/05 18:18:01 UTC

[isis] branch master updated: ISIS-2903: fixes EntityPage created too early for Wicket

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 8946d8d  ISIS-2903: fixes EntityPage created too early for Wicket
8946d8d is described below

commit 8946d8db95864f24f7c192ce1f0f70e4e3c4acf4
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Dec 5 19:17:50 2021 +0100

    ISIS-2903: fixes EntityPage created too early for Wicket
    
    - don't build the EntityPage during an AJAX request when redirecting
    
    - instead use PageParameters to pass over the bookmark for the next
    RequestCycle to start building the EntityPage from scratch
---
 .../org/apache/isis/core/runtime/events/_Xray.java | 39 ++++++------
 .../isis/testdomain/jpa/JpaInventoryJaxbVm.java    |  2 +-
 .../models/interaction/BookmarkedObjectWkt.java    |  5 +-
 .../interaction/HasBookmarkedOwnerAbstract.java    |  4 +-
 .../wicket/model/util/PageParameterUtils.java      |  6 ++
 .../ui/actionresponse/ActionResultResponse.java    | 40 +++++++++----
 .../ActionResultResponseHandlingStrategy.java      |  4 +-
 .../actionresponse/ActionResultResponseType.java   | 19 ++++--
 .../ui/actionresponse/PageRedirectRequest.java     | 70 ++++++++++++++++++++++
 .../viewer/wicket/ui/pages/entity/EntityPage.java  | 44 +++++++++++++-
 .../wicket/ui/panels/FormExecutorDefault.java      |  2 +-
 11 files changed, 186 insertions(+), 49 deletions(-)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/events/_Xray.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/events/_Xray.java
index 5eed1ed..4c2876a 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/events/_Xray.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/events/_Xray.java
@@ -23,7 +23,6 @@ import org.apache.isis.applib.services.iactnlayer.InteractionLayerTracker;
 import org.apache.isis.commons.internal.debug._Debug;
 import org.apache.isis.commons.internal.debug.xray.XrayDataModel;
 import org.apache.isis.commons.internal.debug.xray.XrayModel.Stickiness;
-import org.apache.isis.commons.internal.debug.xray.XrayModel.ThreadMemento;
 import org.apache.isis.commons.internal.debug.xray.XrayUi;
 import org.apache.isis.core.security.util.XrayUtil;
 
@@ -62,7 +61,7 @@ final class _Xray {
 
         _Debug.log(10, txInfo);
 
-        val threadId = ThreadMemento.fromCurrentThread();
+        //val threadId = ThreadMemento.fromCurrentThread();
 
         val sequenceId = XrayUtil.currentSequenceId(iaTracker)
         .orElse(null);
@@ -73,14 +72,15 @@ final class _Xray {
 
             // if no sequence diagram available, that we can append to,
             // then at least add a node to the left tree
-            if(!seq.isPresent()) {
-                val uiThreadNode = model.getThreadNode(threadId);
-                model.addContainerNode(
-                        uiThreadNode,
-                        txInfo,
-                        Stickiness.CAN_DELETE_NODE);
-                return;
-            }
+            //XXX replaced by log above
+//            if(!seq.isPresent()) {
+//                val uiThreadNode = model.getThreadNode(threadId);
+//                model.addContainerNode(
+//                        uiThreadNode,
+//                        txInfo,
+//                        Stickiness.CAN_DELETE_NODE);
+//                return;
+//            }
 
             seq.ifPresent(sequence->{
                 val sequenceData = sequence.getData();
@@ -101,7 +101,7 @@ final class _Xray {
 
         _Debug.log(10, txInfo);
 
-        val threadId = ThreadMemento.fromCurrentThread();
+        //val threadId = ThreadMemento.fromCurrentThread();
 
         val sequenceId = XrayUtil.currentSequenceId(iaTracker)
                 .orElse(null);
@@ -112,14 +112,15 @@ final class _Xray {
 
             // if no sequence diagram available, that we can append to,
             // then at least add a node to the left tree
-            if(!seq.isPresent()) {
-                val uiThreadNode = model.getThreadNode(threadId);
-                model.addContainerNode(
-                        uiThreadNode,
-                        txInfo,
-                        Stickiness.CAN_DELETE_NODE);
-                return;
-            }
+            //XXX replaced by log above
+//            if(!seq.isPresent()) {
+//                val uiThreadNode = model.getThreadNode(threadId);
+//                model.addContainerNode(
+//                        uiThreadNode,
+//                        txInfo,
+//                        Stickiness.CAN_DELETE_NODE);
+//                return;
+//            }
 
             seq.ifPresent(sequence->{
                 val sequenceData = sequence.getData();
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/JpaInventoryJaxbVm.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/JpaInventoryJaxbVm.java
index 44c7053..6459c46 100644
--- a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/JpaInventoryJaxbVm.java
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/jpa/JpaInventoryJaxbVm.java
@@ -55,7 +55,7 @@ import lombok.Setter;
 @XmlAccessorType(XmlAccessType.FIELD)
 @DomainObject(
         nature=Nature.VIEW_MODEL
-        , logicalTypeName = "testdomain.jdo.JpaInventoryJaxbVm"
+        , logicalTypeName = "testdomain.jpa.JpaInventoryJaxbVm"
 )
 public class JpaInventoryJaxbVm {
 
diff --git a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/BookmarkedObjectWkt.java b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/BookmarkedObjectWkt.java
index 34c0624..f818108 100644
--- a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/BookmarkedObjectWkt.java
+++ b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/BookmarkedObjectWkt.java
@@ -46,7 +46,7 @@ extends ModelAbstract<ManagedObject> {
     @Getter private final Bookmark bookmark;
 
     /**
-     * Request scoped.
+     * Request scoped. No yet activated!
      */
     public static class ManagedObjectCache {
 
@@ -133,10 +133,9 @@ extends ModelAbstract<ManagedObject> {
         throw _Exceptions.unsupportedOperation("MangedObjectWkt is immuatable");
     }
 
-    public final ManagedObject getObjectAndAttachWhenEntity() {
+    public final ManagedObject getObjectAndReAttach() {
         //EntityUtil.assertAttachedWhenEntity()//guard
         val entityOrViewmodel = super.getObject();
-
         // even though initial loading seems attached, we need to check again
         return EntityUtil.computeIfDetached(entityOrViewmodel, this::reload);
     }
diff --git a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/HasBookmarkedOwnerAbstract.java b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/HasBookmarkedOwnerAbstract.java
index 5350041..0a944bc 100644
--- a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/HasBookmarkedOwnerAbstract.java
+++ b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/interaction/HasBookmarkedOwnerAbstract.java
@@ -44,14 +44,14 @@ implements
 
     @Override
     public final ManagedObject getBookmarkedOwner() {
-        return bookmarkedObject.getObjectAndAttachWhenEntity();
+        return bookmarkedObject.getObjectAndReAttach();
     }
 
     public final BookmarkedObjectWkt bookmarkedObjectModel() {
         return bookmarkedObject;
     }
 
-   // -- SHORTCUTS
+    // -- SHORTCUTS
 
     public final boolean hasAsRootPolicy() {
         return hasBookmarkPolicy(BookmarkPolicy.AS_ROOT);
diff --git a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/PageParameterUtils.java b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/PageParameterUtils.java
index 02ca31b..faf8243 100644
--- a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/PageParameterUtils.java
+++ b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/PageParameterUtils.java
@@ -133,6 +133,12 @@ public class PageParameterUtils {
 
     // -- FACTORY METHODS FOR PAGE PARAMETERS
 
+    public static PageParameters createPageParametersForBookmark(final Bookmark bookmark) {
+        val pageParameters = PageParameterUtils.newPageParameters();
+        PageParameterNames.OBJECT_OID.addStringTo(pageParameters, bookmark.stringify());
+        return pageParameters;
+    }
+
     /**
      * Factory method for creating {@link PageParameters} to represent an
      * object.
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponse.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponse.java
index a7155e1..ef6a2ea 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponse.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponse.java
@@ -22,15 +22,15 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.request.IRequestHandler;
 import org.apache.wicket.request.component.IRequestablePage;
 
+import org.apache.isis.applib.services.bookmark.Bookmark;
 import org.apache.isis.applib.value.OpenUrlStrategy;
-import org.apache.isis.commons.internal.base._Either;
-import org.apache.isis.viewer.wicket.ui.pages.PageAbstract;
+import org.apache.isis.viewer.wicket.model.util.PageParameterUtils;
 
 import lombok.NonNull;
 
 /**
  * The response to provide as a result of interpreting the response;
- * either to show a {@link #toPage(PageAbstract) page}, or to
+ * either to show a {@link #toPage(PageRedirectRequest) page}, or to
  * {@link #withHandler(IRequestHandler) redirect} to a
  * handler (eg a download).
  */
@@ -38,7 +38,7 @@ public class ActionResultResponse {
 
     private final ActionResultResponseHandlingStrategy handlingStrategy;
     private final IRequestHandler handler;
-    private final _Either<PageAbstract, Class<? extends IRequestablePage>> page;
+    private final PageRedirectRequest<?> pageRedirect;
     private final AjaxRequestTarget target;
     private final String url;
 
@@ -47,14 +47,28 @@ public class ActionResultResponse {
                 ActionResultResponseHandlingStrategy.SCHEDULE_HANDLER, handler, null, null, null);
     }
 
-    public static ActionResultResponse toPage(final PageAbstract page) {
+    public static ActionResultResponse toPage(final PageRedirectRequest<?> page) {
         return new ActionResultResponse(
-                ActionResultResponseHandlingStrategy.REDIRECT_TO_PAGE, null, _Either.left(page), null, null);
+                ActionResultResponseHandlingStrategy.REDIRECT_TO_PAGE, null, page, null, null);
     }
 
-    public static ActionResultResponse toPageClass(final Class<? extends IRequestablePage> pageClass) {
-        return new ActionResultResponse(
-                ActionResultResponseHandlingStrategy.REDIRECT_TO_PAGE, null, _Either.right(pageClass), null, null);
+    public static <T extends IRequestablePage> ActionResultResponse toPage(
+            final @NonNull Class<T> pageClass,
+            final @NonNull Bookmark bookmark) {
+        return toPage(PageRedirectRequest.forPageClass(
+                        pageClass,
+                        PageParameterUtils.createPageParametersForBookmark(bookmark)));
+    }
+
+    public static <T extends IRequestablePage> ActionResultResponse toPage(
+            final @NonNull Class<T> pageClass,
+            final @NonNull T pageInstance) {
+        return toPage(PageRedirectRequest.forPage(pageClass, pageInstance));
+    }
+
+    public static <T extends IRequestablePage> ActionResultResponse toPage(
+            final @NonNull Class<T> pageClass) {
+        return toPage(PageRedirectRequest.forPageClass(pageClass));
     }
 
     public static ActionResultResponse openUrlInBrowser(
@@ -71,12 +85,12 @@ public class ActionResultResponse {
     private ActionResultResponse(
             final ActionResultResponseHandlingStrategy strategy,
             final IRequestHandler handler,
-            final _Either<PageAbstract, Class<? extends IRequestablePage>> page,
+            final PageRedirectRequest<?> pageRedirect,
             final AjaxRequestTarget target,
             final String url) {
         this.handlingStrategy = strategy;
         this.handler = handler;
-        this.page = page;
+        this.pageRedirect = pageRedirect;
         this.target = target;
         this.url = url;
     }
@@ -95,8 +109,8 @@ public class ActionResultResponse {
     /**
      * Populated only if {@link #getHandlingStrategy() handling strategy} is {@link ActionResultResponseHandlingStrategy#REDIRECT_TO_PAGE}
      */
-    public _Either<PageAbstract, Class<? extends IRequestablePage>> getToPage() {
-        return page;
+    public PageRedirectRequest<?> getPageRedirect() {
+        return pageRedirect;
     }
 
     /**
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseHandlingStrategy.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseHandlingStrategy.java
index ff3c63f..1b45f3a 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseHandlingStrategy.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseHandlingStrategy.java
@@ -60,9 +60,7 @@ public enum ActionResultResponseHandlingStrategy {
             commonContext.getTransactionService().flushTransaction();
 
             // "redirect-after-post"
-            resultResponse.getToPage().accept(
-                    RequestCycle.get()::setResponsePage,
-                    RequestCycle.get()::setResponsePage);
+            resultResponse.getPageRedirect().applyTo(RequestCycle.get());
         }
     },
     SCHEDULE_HANDLER {
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseType.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseType.java
index d65a2a2..b306706 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseType.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/ActionResultResponseType.java
@@ -38,6 +38,7 @@ import org.apache.isis.viewer.wicket.model.models.EntityCollectionModelStandalon
 import org.apache.isis.viewer.wicket.model.models.PageType;
 import org.apache.isis.viewer.wicket.model.models.ValueModel;
 import org.apache.isis.viewer.wicket.model.models.VoidModel;
+import org.apache.isis.viewer.wicket.model.util.PageParameterUtils;
 import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
 import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
 import org.apache.isis.viewer.wicket.ui.pages.standalonecollection.StandaloneCollectionPage;
@@ -78,7 +79,8 @@ public enum ActionResultResponseType {
                 final Can<ManagedObject> args) {
             final var collectionModel = EntityCollectionModelStandalone
                     .forActionModel(resultAdapter, actionModel, args);
-            return ActionResultResponse.toPage(new StandaloneCollectionPage(collectionModel));
+            return ActionResultResponse.toPage(
+                    StandaloneCollectionPage.class, new StandaloneCollectionPage(collectionModel));
         }
     },
     /**
@@ -95,7 +97,7 @@ public enum ActionResultResponseType {
             ValueModel valueModel = ValueModel.of(commonContext, resultAdapter);
             valueModel.setActionHint(actionModel);
             final ValuePage valuePage = new ValuePage(valueModel);
-            return ActionResultResponse.toPage(valuePage);
+            return ActionResultResponse.toPage(ValuePage.class, valuePage);
         }
     },
     VALUE_CLOB {
@@ -187,7 +189,7 @@ public enum ActionResultResponseType {
             final var commonContext = actionModel.getCommonContext();
             final VoidModel voidModel = new VoidModel(commonContext);
             voidModel.setActionHint(actionModel);
-            return ActionResultResponse.toPage(new VoidReturnPage(voidModel));
+            return ActionResultResponse.toPage(VoidReturnPage.class, new VoidReturnPage(voidModel));
         }
     },
     SIGN_IN {
@@ -200,7 +202,8 @@ public enum ActionResultResponseType {
             val signInPage = actionModel.getCommonContext()
                     .lookupServiceElseFail(PageClassRegistry.class)
                     .getPageClass(PageType.SIGN_IN);
-            return ActionResultResponse.toPageClass(signInPage);
+
+            return ActionResultResponse.toPage(PageRedirectRequest.forPageClass(signInPage));
         }
     };
 
@@ -253,9 +256,13 @@ public enum ActionResultResponseType {
 
         // this will not preserve the URL (because pageParameters are not copied over)
         // but trying to preserve them seems to cause the 302 redirect to be swallowed somehow
-        final EntityPage entityPage = EntityPage.ofAdapter(model.getCommonContext(), actualAdapter);
+        //FIXME[ISIS-2903] some experiments here ...
+        //final EntityPage entityPage = EntityPage.ofAdapter(model.getCommonContext(), actualAdapter);
+
+        return ActionResultResponse.toPage(PageRedirectRequest.forPageClass(
+                EntityPage.class,
+                PageParameterUtils.createPageParametersForObject(actualAdapter)));
 
-        return ActionResultResponse.toPage(entityPage);
     }
 
     @Value(staticConstructor = "of")
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/PageRedirectRequest.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/PageRedirectRequest.java
new file mode 100644
index 0000000..bcd9a3a
--- /dev/null
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/actionresponse/PageRedirectRequest.java
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.actionresponse;
+
+import org.apache.wicket.request.component.IRequestablePage;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.springframework.lang.Nullable;
+
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.NonNull;
+
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
+public class PageRedirectRequest<T extends IRequestablePage> {
+
+    private final @NonNull Class<T> pageClass;
+    private final @Nullable PageParameters pageParameters;
+    private final @Nullable IRequestablePage pageInstance;
+
+    public static <T extends IRequestablePage> PageRedirectRequest<T> forPageClass(
+            final @NonNull Class<T> pageClass,
+            final @NonNull PageParameters pageParameters) {
+        return new PageRedirectRequest<>(pageClass, pageParameters, null);
+    }
+
+    public static <T extends IRequestablePage> PageRedirectRequest<T> forPageClass(
+            final @NonNull Class<T> pageClass) {
+        return new PageRedirectRequest<>(pageClass, null, null);
+    }
+
+    public static <T extends IRequestablePage> PageRedirectRequest<T> forPage(
+            final @NonNull Class<T> pageClass,
+            final @NonNull T pageInstance) {
+        return new PageRedirectRequest<>(pageClass, null, pageInstance);
+    }
+
+    public void applyTo(
+            final @Nullable RequestCycle requestCycle) {
+        if(requestCycle==null) {
+            return;
+        }
+        if(pageParameters!=null) {
+            requestCycle.setResponsePage(pageClass, pageParameters);
+            return;
+        }
+        if(pageInstance!=null) {
+            requestCycle.setResponsePage(pageInstance);
+            return;
+        }
+        requestCycle.setResponsePage(pageClass);
+    }
+
+}
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
index d1de2b6..dfa75fc 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
@@ -19,6 +19,7 @@
 package org.apache.isis.viewer.wicket.ui.pages.entity;
 
 import org.apache.wicket.Application;
+import org.apache.wicket.Component;
 import org.apache.wicket.RestartResponseException;
 import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
 import org.apache.wicket.markup.head.CssHeaderItem;
@@ -29,7 +30,13 @@ import org.apache.wicket.markup.repeater.RepeatingView;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.CssResourceReference;
 import org.apache.wicket.util.string.Strings;
+import org.apache.wicket.util.visit.IVisit;
+import org.apache.wicket.util.visit.IVisitor;
+import org.apache.wicket.util.visit.Visits;
 
+import org.apache.isis.commons.internal.base._Timing;
+import org.apache.isis.commons.internal.debug._Debug;
+import org.apache.isis.commons.internal.debug.xray.XrayUi;
 import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
 import org.apache.isis.core.metamodel.facets.object.grid.GridFacet;
 import org.apache.isis.core.metamodel.spec.ManagedObject;
@@ -42,6 +49,7 @@ import org.apache.isis.viewer.wicket.model.modelhelpers.WhereAmIHelper;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.model.util.PageParameterUtils;
 import org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconAndTitlePanel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.reference.ReferencePanel;
 import org.apache.isis.viewer.wicket.ui.pages.PageAbstract;
 import org.apache.isis.viewer.wicket.ui.util.Wkt;
 
@@ -76,6 +84,10 @@ public class EntityPage extends PageAbstract {
             final IsisAppCommonContext commonContext,
             final PageParameters pageParameters) {
 
+        _Debug.onCondition(XrayUi.isXrayEnabled(), ()->{
+            _Debug.log(10, "new EntityPage from PageParameters %s", pageParameters);
+        });
+
         final String oid = EntityModel.oidStr(pageParameters);
         if (Strings.isEmpty(oid)) {
             throw new RestartResponseException(Application.get().getHomePage());
@@ -92,8 +104,13 @@ public class EntityPage extends PageAbstract {
     public static EntityPage ofAdapter(
             final IsisAppCommonContext commonContext,
             final ManagedObject adapter) {
+
+        _Debug.onCondition(XrayUi.isXrayEnabled(), ()->{
+            _Debug.log(10, "new EntityPage from Adapter %s", adapter.getSpecification());
+        });
+
         return new EntityPage(
-                PageParameterUtils.newPageParameters(),
+                PageParameterUtils.createPageParametersForObject(adapter),
                 EntityModel.ofAdapter(commonContext, adapter));
     }
 
@@ -114,6 +131,31 @@ public class EntityPage extends PageAbstract {
         response.render(CssHeaderItem.forReference(WHERE_AM_I_CSS));
     }
 
+    @Override
+    public void renderPage() {
+        _Debug.onCondition(XrayUi.isXrayEnabled(), ()->{
+            _Debug.log(10, "about to render EntityPage ..");
+            Visits.visitChildren(this, new IVisitor<Component, Void>(){
+                @Override
+                public void component(final Component component, final IVisit<Void> visit){
+                    if(component.getClass().getSimpleName().equals("ReferencePanel")) {
+                        val scalarModel = ((ReferencePanel)component).getModel();
+                        val value = scalarModel.getObject();
+                        _Debug.log(10, "value = %s", value.getPojo());
+                    }
+                }
+            });
+        });
+
+        val stopWatch = _Timing.now();
+        super.renderPage();
+        stopWatch.stop();
+
+        _Debug.onCondition(XrayUi.isXrayEnabled(), ()->{
+            _Debug.log(10, ".. rendering took %s", stopWatch.toString());
+        });
+    }
+
 
     @Override
     public UiHintContainer getUiHintContainerIfAny() {
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormExecutorDefault.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormExecutorDefault.java
index 10d28af..d33eee9 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormExecutorDefault.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormExecutorDefault.java
@@ -155,7 +155,7 @@ implements FormExecutor {
                     act->ActionResultResponseType
                             .determineAndInterpretResult(act, ajaxTarget, resultAdapter, act.snapshotArgs()),
                     prop->ActionResultResponse
-                            .toPage(EntityPage.ofAdapter(prop.getCommonContext(), resultAdapter)));
+                            .toPage(EntityPage.class, resultAdapter.getBookmark().orElseThrow()));
 
             _Debug.onCondition(XrayUi.isXrayEnabled(), ()->{
                 _Debug.log(10, "handle result ...");