Woonsan Ko pushed to branch feature/spaplus at cms-community / hippo-site-toolkit
Commits: e2f5ca66 by Ate Douma at 2018-02-28T15:42:38+01:00 HSTTWO-4175 update master for 12.3 development - - - - - 7b71fb82 by Woonsan Ko at 2018-03-07T11:48:33-05:00 HSTTWO-4227: Merge branch 'master' into feature/spaplus - - - - - c085dbc6 by Woonsan Ko at 2018-03-07T13:16:52-05:00 HSTTWO-4227: generate component rendering url link for site url, not api url. - - - - - 2 changed files: - components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java - pom.xml Changes: ===================================== components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java ===================================== --- a/components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java +++ b/components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java @@ -40,6 +40,8 @@ import org.hippoecm.hst.core.container.ContainerConstants; import org.hippoecm.hst.core.container.ContainerException; import org.hippoecm.hst.core.container.HstComponentWindow; import org.hippoecm.hst.core.container.HstContainerConfig; +import org.hippoecm.hst.core.container.HstContainerURL; +import org.hippoecm.hst.core.container.HstContainerURLProvider; import org.hippoecm.hst.core.linking.HstLink; import org.hippoecm.hst.core.linking.HstLinkCreator; import org.hippoecm.hst.core.pagemodel.model.AggregatedPageModel; @@ -208,6 +210,12 @@ public class PageModelAggregationValve extends AggregationValve { protected AggregatedPageModel createAggregatedPageModel(final HstComponentWindow[] sortedComponentWindows, final Map<HstComponentWindow, HstRequest> requestMap, final Map<HstComponentWindow, HstResponse> responseMap) throws ContainerException { + final HstRequestContext requestContext = RequestContextProvider.get(); + final HstContainerURLProvider containerURLProvider = getUrlFactory().getContainerURLProvider(); + final HstContainerURL apiBaseURL = requestContext.getBaseURL(); + final Mount siteMount = requestContext.getMount(ContainerConstants.MOUNT_ALIAS_SITE); + final HstContainerURL siteBaseURL = containerURLProvider.createURL(siteMount, apiBaseURL, apiBaseURL.getPathInfo()); + // root component (page component) is the first item in the sortedComponentWindows. final HstComponentWindow rootWindow = sortedComponentWindows[0]; final String id = rootWindow.getReferenceNamespace(); @@ -233,7 +241,7 @@ public class PageModelAggregationValve extends AggregationValve { curContainerWindowModel = new ComponentContainerWindowModel(window.getReferenceNamespace(), window.getName()); addParameterMapMetadata(window, curContainerWindowModel); - addComponentRenderingURLLink(hstResponse, curContainerWindowModel); + addComponentRenderingURLLink(requestContext, siteBaseURL, window, curContainerWindowModel); decorateComponentWindowMetadata(hstRequest, hstResponse, curContainerWindowModel); pageModel.addContainerWindow(curContainerWindowModel); } else if (window.isContainerItemWindow()) { @@ -247,7 +255,7 @@ public class PageModelAggregationValve extends AggregationValve { window.getReferenceNamespace(), window.getName(), window.getComponentName()); componentWindowModel.setLabel(window.getComponentInfo().getLabel()); addParameterMapMetadata(window, componentWindowModel); - addComponentRenderingURLLink(hstResponse, componentWindowModel); + addComponentRenderingURLLink(requestContext, siteBaseURL, window, componentWindowModel); decorateComponentWindowMetadata(hstRequest, hstResponse, componentWindowModel); curContainerWindowModel.addComponentWindowSet(componentWindowModel); } else { @@ -282,10 +290,18 @@ public class PageModelAggregationValve extends AggregationValve { return pageModel; } - private void addComponentRenderingURLLink(HstResponse hstResponse, - IdentifiableLinkableMetadataBaseModel linkableModel) { - HstURL compRenderURL = hstResponse.createComponentRenderingURL(); - linkableModel.putLink(ContainerConstants.LINK_NAME_COMPONENT_RENDERING, compRenderURL.toString()); + /** + * Generate a component rendering URL which should return renderable markups. + * @param requestContext request context + * @param siteBaseURL site base page rendering URL which is not from this API pipeline but normal site pipeline. + * @param compWindow HST component window + * @param linkableModel linable model object + */ + private void addComponentRenderingURLLink(HstRequestContext requestContext, HstContainerURL siteBaseURL, + HstComponentWindow compWindow, IdentifiableLinkableMetadataBaseModel linkableModel) { + final HstURL compRenderURL = requestContext.getURLFactory().createURL(HstURL.COMPONENT_RENDERING_TYPE, + compWindow.getReferenceNamespace(), siteBaseURL, requestContext); + linkableModel.putLink(ContainerConstants.LINK_NAME_COMPONENT_RENDERING, compRenderURL); } /** ===================================== pom.xml ===================================== --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onehippo.cms7</groupId> <artifactId>hippo-cms7-project</artifactId> - <version>29.3</version> + <version>29.4-SNAPSHOT</version> </parent> <name>Hippo Site Toolkit</name> @@ -80,7 +80,7 @@ <jackrabbit-ocm.version>1.5.3</jackrabbit-ocm.version> - <hippo.jackrabbit.version>2.14.0-h2</hippo.jackrabbit.version> + <hippo.jackrabbit.version>2.16.1-h1-SNAPSHOT</hippo.jackrabbit.version> <hippo.commons.version>4.3.0-SNAPSHOT</hippo.commons.version> <hippo.repository.version>5.3.0-SNAPSHOT</hippo.repository.version> <hippo.configuration-management.version>1.3.0-SNAPSHOT</hippo.configuration-management.version> View it on GitLab: https://code.onehippo.org/cms-community/hippo-site-toolkit/compare/62ec5d81fdfcb9be133eef299984c9a5ba2e6390...c085dbc64305a67b7b469abd401b5b5e83b665fd --- View it on GitLab: https://code.onehippo.org/cms-community/hippo-site-toolkit/compare/62ec5d81fdfcb9be133eef299984c9a5ba2e6390...c085dbc64305a67b7b469abd401b5b5e83b665fd You're receiving this email because of your account on code.onehippo.org.
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn