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

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 4.0.0
    • hst-api

    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

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

            Dates

              Created:
              Updated:
              Resolved: