public interface HstLinkCreator
HstLink
'sModifier and Type | Method and Description |
---|---|
void |
clear()
Clears possibly available caches
|
HstLink |
create(HippoBean bean,
HstRequestContext requestContext) |
HstLink |
create(HstSiteMapItem toHstSiteMapItem,
Mount mount)
Regardless the current context, create a HstLink to the HstSiteMapItem that you use as argument.
|
HstLink |
create(javax.jcr.Node node,
HstRequestContext requestContext)
Rewrite a jcr Node to a HstLink wrt its current ResolvedSiteMapItem
|
HstLink |
create(javax.jcr.Node node,
HstRequestContext requestContext,
HstSiteMapItem preferredItem,
boolean fallback)
Rewrite a jcr Node to a HstLink wrt its current HstRequestContext and preferredItem.
|
HstLink |
create(javax.jcr.Node node,
HstRequestContext requestContext,
HstSiteMapItem preferredItem,
boolean fallback,
boolean navigationStateful)
This method creates the same
HstLink as create(Node, HstRequestContext, HstSiteMapItem, boolean) when navigationStateful = false . |
HstLink |
create(javax.jcr.Node node,
HstRequestContext requestContext,
String mountAlias)
|
HstLink |
create(javax.jcr.Node node,
HstRequestContext requestContext,
String mountAlias,
String type)
|
HstLink |
create(javax.jcr.Node node,
Mount mount)
|
HstLink |
create(javax.jcr.Node node,
Mount mount,
HstSiteMapItem preferredItem,
boolean fallback)
|
HstLink |
create(String path,
Mount mount)
Creates an HstLink for the
path and mount . |
HstLink |
create(String path,
Mount mount,
boolean containerResource)
Creates an HstLink for the
path and mount . |
HstLink |
create(String uuid,
javax.jcr.Session session,
HstRequestContext requestContext)
Rewrite a jcr uuid to a HstLink wrt its current ResolvedSiteMapItem.
|
List<HstLink> |
createAll(javax.jcr.Node node,
HstRequestContext requestContext,
boolean crossMount)
Rewrite a jcr Node to a List of
HstLink s |
List<HstLink> |
createAll(javax.jcr.Node node,
HstRequestContext requestContext,
String hostGroupName,
String type,
boolean crossMount)
Rewrite a jcr Node to a List of
HstLink s |
List<HstLink> |
createAllAvailableCanonicals(javax.jcr.Node node,
HstRequestContext requestContext)
Expert: Creates a
List of all available canonical links for node within the hostgroup ( VirtualHost.getHostGroupName() ) of the Mount for
the HstRequestContext . |
List<HstLink> |
createAllAvailableCanonicals(javax.jcr.Node node,
HstRequestContext requestContext,
String type)
Expert: Creates a
List of all available canonical links for node , within the hostgroup ( VirtualHost.getHostGroupName() ) of the Mount for
the HstRequestContext and where where the backing Mount of the HstLink has at least one Mount.getTypes() equal to type |
List<HstLink> |
createAllAvailableCanonicals(javax.jcr.Node node,
HstRequestContext requestContext,
String type,
String hostGroupName)
Expert: Creates a
List of all available canonical links for node , within the hostgroup hostGroupName and where where the backing Mount of the HstLink has at least one Mount.getTypes() equal to type |
HstLink |
createByRefId(String siteMapItemRefId,
Mount mount)
Regardless the current context, create a HstLink to the
HstSiteMapItem for Mount mount that has HstSiteMapItem.getRefId() equal to siteMapItemRefId . |
HstLink |
createCanonical(javax.jcr.Node node,
HstRequestContext requestContext)
This creates a canonical HstLink: regardless the current requestContext, one and the same jcr Node is guaranteed to return the same HstLink.
|
HstLink |
createCanonical(javax.jcr.Node node,
HstRequestContext requestContext,
HstSiteMapItem preferredItem) |
HstLink |
createPageNotFoundLink(Mount mount) |
String |
getBinariesPrefix() |
List<LocationResolver> |
getLocationResolvers() |
boolean |
isBinaryLocation(String path)
Binaries frequently have a different linkrewriting mechanism.
|
HstLink create(String uuid, javax.jcr.Session session, HstRequestContext requestContext)
uuid
- the uuid of the node that must be used to link tosession
- jcr sessionrequestContext
- the HstRequestContextHstLink
instance or null
HstLink create(javax.jcr.Node node, HstRequestContext requestContext)
node
- requestContext
- the HstRequestContextnull
HstLink create(javax.jcr.Node node, HstRequestContext requestContext, HstSiteMapItem preferredItem, boolean fallback)
preferredItem
is not null
, the link is tried to be rewritten to
one of the descendants (including itself) of the preferred HstSiteMapItem
. When preferredItem
is null
, a link is created against the entire sitemap item tree. When there cannot be created an HstLink to a descendant HstSiteMapItem
or self, then:
fallback = true
, a fallback to create(Node, HstRequestContext)
is donefallback = false
, dependent on the implementation some error HstLink or null
can be returned
This method returns an HstLink
that takes the current URL into account, but does compute the link with respect to the physical (canonical) location
of the jcr Node. If you need a HstLink
within the context of the possible virtual jcr Node (for example in case of in context showing documents in faceted navigation), use
create(Node, HstRequestContext, HstSiteMapItem, boolean, boolean)
with navigationStateful = true
node
- the jcr noderequestContext
- the HstRequestContextpreferredItem
- if not null (null means no preferred sitemap item), first a link is trying to be created for this itemfallback
- whether to fallback to link rewriting without preferredItem
in case link rewriting
with preferredItem
resulted in a not found linknull
create(Node, HstRequestContext, HstSiteMapItem, boolean, boolean)
HstLink create(javax.jcr.Node node, HstRequestContext requestContext, HstSiteMapItem preferredItem, boolean fallback, boolean navigationStateful)
This method creates the same HstLink
as create(Node, HstRequestContext, HstSiteMapItem, boolean)
when navigationStateful = false
. When navigationStateful = true
,
the link that is created is with respect to the jcr Node node
, even if this node is a virtual location. This is different then create(Node, HstRequestContext, HstSiteMapItem, boolean)
: that
method always first tries to find the canonical location of the jcr Node before it is creating a link for the node.
Expert: Note there is a difference between context relative with respect to the current URL and with respect to the current jcr Node. Default, links in the HST are
created always taking into account the current URL (thus context aware linking) unless you call createCanonical(Node, HstRequestContext)
or createCanonical(Node, HstRequestContext, HstSiteMapItem)
. Also,
default, it always (unless there is no) takes the canonical location of the jcr Node. Thus, multiple virtual versions of the same physical Node, result in the same HstLink. Only when having navigationStateful = true
,
also the jcr Node is context relative, and thus multiple virtual versions of the same jcr Node can result in multiple links. This is interesting for example in
faceted navigation views, where you want 'in context' documents to be shown.
node
- the jcr noderequestContext
- the HstRequestContextpreferredItem
- if not null (null means no preferred sitemap item), first a link is trying to be created for this itemfallback
- whether to fallback to link rewriting without preferredItem
in case link rewriting
with preferredItem
resulted in a not found linknavigationStateful
- value true or falsenull
create(Node, HstRequestContext, HstSiteMapItem, boolean)
HstLink createCanonical(javax.jcr.Node node, HstRequestContext requestContext)
node
- requestContext
- the HstRequestContextnull
HstLink createCanonical(javax.jcr.Node node, HstRequestContext requestContext, HstSiteMapItem preferredItem)
node
- requestContext
- the HstRequestContextpreferredItem
- if null
, a fallback to createCanonical(Node, HstRequestContext)
is donenull
When specifying a preferredItem, we try to create a canonical link wrt this preferredItem. If the link cannot be created for this preferredItem,
a fallback to {@link #createCanonical(Node, HstRequestContext)} without preferredItem is done.
List<HstLink> createAllAvailableCanonicals(javax.jcr.Node node, HstRequestContext requestContext)
List
of all available canonical links for node
within the hostgroup ( VirtualHost.getHostGroupName()
) of the Mount
for
the HstRequestContext
. All available links have a Mount
that has at least one of its Mount.getTypes()
equal to the Mount.getTypes()
belonging to the Mount
of the
requestContext
. If the Mount
of the requestContext
has no type in common at all, for example because
it is Mount
from a REST mount used by the template composer, you can use createAllAvailableCanonicals(Node, HstRequestContext, String)
and specify
the type
the Mount
's for the available canonical links should be of.node
- requestContext
- the HstRequestContextList
of all available canonical links where at least one of the Mount.getTypes()
are equal to Mount.getTypes()
belonging to the Mount
of the requestContext
createCanonical(Node, HstRequestContext)
List<HstLink> createAllAvailableCanonicals(javax.jcr.Node node, HstRequestContext requestContext, String type)
List
of all available canonical links for node
, within the hostgroup ( VirtualHost.getHostGroupName()
) of the Mount
for
the HstRequestContext
and where where the backing Mount
of the HstLink
has at least one Mount.getTypes()
equal to type
node
- requestContext
- the HstRequestContexttype
- the type
that the Mount
's belonging to the available canonical links should be ofList
of all available canonical links where at least one of the Mount.getTypes()
are equal to type
createCanonical(Node, HstRequestContext)
List<HstLink> createAllAvailableCanonicals(javax.jcr.Node node, HstRequestContext requestContext, String type, String hostGroupName)
List
of all available canonical links for node
, within the hostgroup hostGroupName
and where where the backing Mount
of the HstLink
has at least one Mount.getTypes()
equal to type
node
- requestContext
- the HstRequestContexttype
- the type
that the Mount
's belonging to the available canonical links should be ofhostGroupName
- The hostGroupName that the HstLink
s their Mount
s should belong toList
of all available canonical links where at least one of the Mount.getTypes()
are equal to type
createCanonical(Node, HstRequestContext)
HstLink create(javax.jcr.Node node, Mount mount)
Expert: Rewrite a jcr node
to a HstLink
with respect to the mount
. Note that this HstLink creation does only take into account the
mount
and not the current context.
The mount
can be a different one then the one of the current request context.
If the mount
cannot be used to create a HstLink for the jcr node
, because the node
belongs
to a different (sub)site, a page not found link is returned.
note: if a link is returned, this is always the canonical link, also see createCanonical(Node, HstRequestContext)
node
- the jcr node for that should be translated into a HstLinkmount
- the (sub)site for which the hstLink should be created forHstLink
for the jcr node
and the mount
or null
when no link for the node can be made in the mount
HstLink create(javax.jcr.Node node, Mount mount, HstSiteMapItem preferredItem, boolean fallback)
Expert: Rewrite a jcr node
to a HstLink
with respect to the mount
and preferredItem
.
When preferredItem
is not null
, the link is tried to be rewritten to one of the descendants (including itself)
of the preferred HstSiteMapItem
. When this does not result in a match, then, depending on whether
fallback = true
,a fallback to an attempt to link rewrite for the entire sitemap is done
Note that this HstLink creation does only take into account the mount
and not the current context.
The mount
can be a different one then the one of the current request context.
If the mount
cannot be used to create a HstLink for the jcr node
, because the node
belongs
to a different (sub)site, a page not found link is returned.
node
- the jcr node for that should be translated into a HstLinkmount
- the (sub)site for which the hstLink should be created forpreferredItem
- if not null (null means no preferred sitemap item), first a link is trying to be created for this itemfallback
- whether to fallback to link rewriting without preferredItem
in case link rewriting
with preferredItem
resulted in a not found linkHstLink
for the jcr node
and the mount
or null
when no link for the node can be made in the mount
HstLink create(javax.jcr.Node node, HstRequestContext requestContext, String mountAlias)
Expert: Rewrite a jcr node
to a HstLink
for the mountAlias
. First, the Mount
belonging to the
mountAlias
is searched for. When the Mount
belonging to the alias cannot rewrite the node
,
there is no fallback to whether other Mount
's can rewrite the node
to a HstLink
.
Note that the found Mount
must
Mount.getAlias()
equal to mountAlias
Mount.getTypes()
the same as the Mount
belonging to the current requestContext
.
VirtualHost.getHostGroupName()
as the Mount
belonging to the current requestContext
.
Mount
complying to the above rules, null
is returned. If a Mount
does comply, we return create(Node, Mount)
node
- the jcr noderequestContext
- the current request contextmountAlias
- the alias of the Mount
for which the link should be created forHstLink
for the jcr node
and the mountAlias
or null
when there cannot be found an Mount
for the aliascreate(Node, Mount)
HstLink create(javax.jcr.Node node, HstRequestContext requestContext, String mountAlias, String type)
Expert: Rewrite a jcr node
to a HstLink
for the mountAlias
and for type
. When the Mount
belonging to the alias cannot rewrite the node
, there is no fallback to whether other Mount
's can rewrite the node
to a HstLink
Note that the found Mount
must
Mount.getAlias()
equal to mountAlias
type
in its Mount.getTypes()
VirtualHost.getHostGroupName()
as the Mount
belonging to the current requestContext
.
Mount
complying to the above rules, null
is returned. If a Mount
does comply, we return create(Node, Mount)
.
The difference with create(Node, HstRequestContext, String)
is that this method does not look for a Mount
with a common type
as for the Mount
from the current request. It does
look for a Mount
which at least has type
as its Mount.getTypes()
node
- the jcr noderequestContext
- the current request contextmountAlias
- the alias of the Mount
for which the link should be created fortype
- the type that should be contained in the Mount.getTypes()
where the Mount
is the mount belonging to the returned HstLink
HstLink
for the jcr node
and the mountAlias
or null
when no link for the node can be made in the Mount
belonging to the alias or when there belongs no Mount
to the aliascreate(Node, Mount)
HstLink create(HippoBean bean, HstRequestContext requestContext)
bean
- requestContext
- the HstRequestContextbean
and the hstRequestContext
or null
when no link for the node can be madeHstLink create(HstSiteMapItem toHstSiteMapItem, Mount mount)
null
, though this is up to the implementationtoHstSiteMapItem
- the HstSiteMapItem
to link toHstLink
instance or null
HstLink createByRefId(String siteMapItemRefId, Mount mount)
HstSiteMapItem
for Mount
mount
that has HstSiteMapItem.getRefId()
equal to siteMapItemRefId
.
If there cannot be found a HstSiteMapItem
for siteMapItemRefId
in the Mount
mount
, then null
is returned.
If the HstSiteMapItem
is found for siteMapItemRefId
, then it can be only used when it does not
contain any ancestor including itself with a wildcard, because the link is ambiguous in that case.
If a wildcard is encountered, this method can return null
, though this is up to the implementationsiteMapItemRefId
- the HstSiteMapItem.getRefId()
of the HstSiteMapItem
to link tomount
- the Mount
the siteMapItemRefId
should be inHstLink
instance or null
HstLink create(String path, Mount mount)
path
and mount
. If the mount
is a sub mount,
eg /fr, then the resulting link includes /fr after the context path.path
- the path to the sitemap item, where the sitemap item or one of its ancestors may contain wildcardsmount
- the Mount
the path should be inHstLink
instance or null
HstLink create(String path, Mount mount, boolean containerResource)
path
and mount
. If containerResource
is
false
, the resulting URL WILL include the Mount.getMountPath()
after the webapp
relative part (context path). When containerResource
is false
, the resulting URL
WILL include the Mount.getMountPath()
after the webapp relative part (context path).path
- the path to the sitemap itemmount
- the Mount
for which the link should be createdcontainerResource
- true
if the link to be created must be a webapp relative link and not relative
to Mount.getMountPath()
HstLink
instance or null
List<HstLink> createAll(javax.jcr.Node node, HstRequestContext requestContext, boolean crossMount)
HstLink
snode
- requestContext
- the HstRequestContextcrossMount
- if true
also mounts not belonging to the current request context
(HstRequestContext.getResolvedMount()
) are tried.HstLink
s for this jcr Node or empty list when non found. The returned List is sorted by
first the HstLink
s with the shortest path (in number of slashes) and if there are links with equal number of slashes,
return lexically sorted on pathList<HstLink> createAll(javax.jcr.Node node, HstRequestContext requestContext, String hostGroupName, String type, boolean crossMount)
HstLink
snode
- requestContext
- the HstRequestContexthostGroupName
- The hostGroupName that the HstLink
s their Mount
s should belong totype
- the type that should be contained in the Mount.getTypes()
where the Mount
is the
mount belonging to the returned HstLink
. If type
is null
, the type
of the HstRequestContext.getResolvedMount()
is used.crossMount
- if true
also mounts not belonging to the current request context
(HstRequestContext.getResolvedMount()
) are tried.HstLink
s for this jcr Node or empty list when non found. The returned List is sorted by
first the HstLink
s with the shortest path (in number of slashes) and if there are links with equal number of slashes,
return lexically sorted on pathHstLink createPageNotFoundLink(Mount mount)
mount
boolean isBinaryLocation(String path)
true
the location is a
binary location.path
- true
when the path points to a binary locationString getBinariesPrefix()
/
and
does not include the /
itself. If no binaries prefix is configured, ""
will be returnedList<LocationResolver> getLocationResolvers()
void clear()
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.