Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-3403

Remove usages of the HstRequest in AbstractMenuItem/CommonMenuItem and replace it by HstRequestContext

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: hst-api
    • Labels:
    • Similar issues:
    • Story Points:
      0.25
    • Processed by team:
      Pulsar
    • Sprint:
      Platform sprint 131, Platform Sprint 132

      Description

      Everything should be possible with the HstRequestContext so it can also be used when you only have a HstRequestContext available.

      For example: The method resolveToSiteMapItem in AbstractMenuItem/CommonMenuItem requires HstRequest but only HstRequestContext is used.

              if(this.resolvedSiteMapItem != null) {
                  return resolvedSiteMapItem.resolvedItem;
              }
              if(this.getHstLink() == null || this.getHstLink().getPath() == null || "".equals(this.getHstLink().getPath())) {
                  log.warn("Cannot resolve to sitemap item because HstLink is null or empty. Return null");
                  return null;
              }
              *HstRequestContext ctx = request.getRequestContext();*
              try {
                  resolvedSiteMapItem = new ResolvedSiteMapItemWrapper(ctx.getSiteMapMatcher().match(this.getHstLink().getPath(), ctx.getResolvedSiteMapItem().getResolvedMount()));
              }  catch (NotFoundException e) {
                  log.warn("Cannot resolve to sitemap item because '{}'. Return null.", e.getMessage());
                  return null;
              }
              return resolvedSiteMapItem.resolvedItem;
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rgerritsen Rutger Gerritsen (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: