org.hippoecm.hst.core.linking
Class LocationMapResolver

java.lang.Object
  extended by org.hippoecm.hst.core.linking.LocationMapResolver

public class LocationMapResolver
extends Object

Class capable of resolving a path to the best LocationTreeMapItem and create a ResolvedTreeMapItem for you


Constructor Summary
LocationMapResolver(LocationMapTree locationMapTree)
           
 
Method Summary
 ResolvedLocationMapTreeItem resolve(String path)
          Tries to find the best match for the path within this LocationMapTree belonging to HstSite.
 void setCanonical(boolean canonical)
           
 void setRepresentsDocument(boolean representsDocument)
           
 void setResolvedSiteMapItem(ResolvedSiteMapItem resolvedSiteMapItem)
           
 void setSubResolver(boolean isSubResolver)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationMapResolver

public LocationMapResolver(LocationMapTree locationMapTree)
Method Detail

setRepresentsDocument

public void setRepresentsDocument(boolean representsDocument)

setCanonical

public void setCanonical(boolean canonical)

setResolvedSiteMapItem

public void setResolvedSiteMapItem(ResolvedSiteMapItem resolvedSiteMapItem)

setSubResolver

public void setSubResolver(boolean isSubResolver)

resolve

public ResolvedLocationMapTreeItem resolve(String path)
Tries to find the best match for the path within this LocationMapTree belonging to HstSite. As it can easily happen that multiple SiteMapItem's are suitable for to match the path, implementing classes should try to return the 'best' match, unless canonical is true (then regardless the context, the same sitemap item must be returned). Typically, the 'best' match would be a match that resolves to a SiteMapItem containing a relative content path that is the most specific for the current path. When two relative content path match equally well, then the following steps define the order in which a sitemap item is preferred. 1) one of the N sitemap items is the same as the current ctx sitemapitem, this one is taken (SAME) : break; 2) if one of the N sitemap items is a *descendant* sitemap item of the current ctx sitemap item, that one is taken : break; 3) Take the matched sitemap items (List) with the first common (shared) ancestor with the current ctx sitemap item : if List contains 1 item: return item: else continue; 4) If (3) returns multiple matched items, return the ones that are the closest (wrt depth) to the common ancestor: if there is one, return item : else continue; 5) If (4) returns 1 or more items, pick the first (we cannot distinguish better) 6) If still no best context hit found, we return the first matchingSiteMapItem in the matchingSiteMapItems list, as there they are all equally out of context If canonical is true we return a ResolvedLocationMapTreeItem containing always the same HstSiteMapItem, regardless the current context. This is useful if you want to add the canonical location of some webpage, which is highly appreciated by search engines, for example: . This becomes increasingly important when making use of faceted navigations where the same document content can be shown on a website in many different contexts.

Parameters:
path - the path you want to match
Returns:
the resolvedLocationMapTreeItem that contains a rewritten path and the hstSiteMapId which is the unique id of the HstSiteMapItem that returned the best match. If no match can be made, null is returned


Copyright © 2008-2012 Hippo. All Rights Reserved.