Interface RewriteContextResolver


public interface RewriteContextResolver

Expert feature : Note that if you implement a custom RewriteContextResolver, that you make sure that resolve(Node, Mount, HstRequestContext, boolean, boolean) is very fast! Namely, resolve(Node, Mount, HstRequestContext, boolean, boolean) will be invoked for every link creation of a Node or HippoBean

A use case where this RewriteContextResolver can be used is for example when you have comment documents which have a link to the news article they are a comment about. The comment documents themselves do *not* have a URL. They are only visible in the context of the news article they are a comment about. In this case, when there is a link to a comment document or when a comment document is found via search, you want to actually have link creation for the node path of the news document. This can be achieved with a custom RewriteContextResolver. Remember however that the implementation must be fast. Whenever the method resolve(Node, Mount, HstRequestContext, boolean, boolean) takes more than a couple (say 2 to 3) milliseconds, you'll run into performance issues when a lot of links have to be created. Custom implementation can best always log at debug level how long parts of the method takes to execute (default hst logs the total time as well). Target time should be around 1/10 to 1 millisecond max.

Note that the node argument in resolve(Node, Mount, HstRequestContext, boolean, boolean) is not necessarily the Node of the backing HippoBean for which a link is required. The Node typically might be the parent (HippoNodeType.NT_HANDLE) in case the Node represents a document.