美文网首页SAP
SAP Spartacus CmsPage的加载逻辑

SAP Spartacus CmsPage的加载逻辑

作者: _扫地僧_ | 来源:发表于2020-12-31 10:12 被阅读0次

    和培训老师讲得一样,经过了connector->adapter->service的过程:

    Returns an observable with the page structure. The page structure is

    • typically loaded from a backend, but can also be returned from static
    • configuration (see CmsStructureConfigService).
        // load page by PageContext
        const httpParams = this.getPagesRequestParams(pageContext);
        return this.http
          .get(this.getPagesEndpoint(httpParams, fields), {
            headers: this.headers,
          })
          .pipe(this.converter.pipeable(CMS_PAGE_NORMALIZER));
      }
    

    页面pagecontext由id和type组成:

    这个page context作为http请求的参数:

    如果没有指定请求的fields,则使用默认的DEFAULT:

    /**
       * Returns a fully qualified OCC Url (including baseUrl and baseSite)
       * @param endpoint Name of the OCC endpoint key config
       * @param urlParams  URL parameters
       * @param queryParams Query parameters
       * @param scope
       */
      getUrl(
        endpoint: string,
        urlParams?: object,
        queryParams?: object,
        scope?: string
      ): string
    

    这里取得endpointconfig:

    OccEndpointsService._activeBaseSite从哪里来的?




    url:https://jerry.eastus.cloudapp.azure.com:9002/occ/v211/electronics-spa/cms/pages?fields=DEFAULT&pageType=ContentPage&pageLabelOrId=homepage

    从url可见,pagecontext的id和type,出现在了HTTP请求的parameters里。

    相关文章

      网友评论

        本文标题:SAP Spartacus CmsPage的加载逻辑

        本文链接:https://www.haomeiwen.com/subject/spjauktx.html