Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
0.25
-
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;