Package com.day.cq.rewriter.linkchecker
Class LinkCheckerSettings
java.lang.Object
com.day.cq.rewriter.linkchecker.LinkCheckerSettings
Settings that control the behaviour of the
LinkChecker. The settings
are used as a "linkchecker context" that holds the base-ref and
context uri, and to control the actual rewrite behavior.
If "request" is not attached, they are used merely temporary before the
actual linkchecker is initialized.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LinkCheckerSettingsfromRequest(SlingHttpServletRequest request) Returns the current link checker settings for the current request.Get the current base ref.Returns the base URI of the request associated with the given settings.Returns the context pathReturns the context URI of the web application associated with the given settings.Returns the config for expired linksReturns the config for invalid linksReturn a uri to the parent of the current uri.Returns the config for predated linksGet the current request uri.Returns the resource resolvervoidinit(SlingHttpServletRequest request) Attach the settings to the request.booleanIftrue, external links are not checkedbooleanIftrueinternal links are not checkedvoidsetBaseRef(String baseRef) Set the current base ref.voidsetExpiredConfig(LinkRewriteConfig config) Sets the config for expired linksbooleansetIgnoreExternals(boolean ignoreExternals) Controls if external links should be checked by the linkchecker.booleansetIgnoreInternals(boolean ignoreInternals) Controls if internal links should be checked by the linkchecker.voidsetInvalidConfig(LinkRewriteConfig config) Sets the config for invalid linksvoidsetPredatedConfig(LinkRewriteConfig config) Sets the config for predated links
-
Field Details
-
REQUEST_ATTRIBUTE_NAME
the name of the request attribute
-
-
Constructor Details
-
LinkCheckerSettings
public LinkCheckerSettings()
-
-
Method Details
-
fromRequest
Returns the current link checker settings for the current request.- Parameters:
request- the request- Returns:
- the settings or
null
-
init
Attach the settings to the request.- Parameters:
request- The current request
-
getRequest
-
getResourceResolver
Returns the resource resolver- Returns:
- the resource resolver
-
getContextPath
Returns the context path- Returns:
- the context path
-
getContextURI
Returns the context URI of the web application associated with the given settings.- Returns:
- context URI, or
nullif the URI malformed - Since:
- 5.3
-
getInvalidConfig
Returns the config for invalid links- Returns:
- the config for invalid links
-
setInvalidConfig
Sets the config for invalid links- Parameters:
config- the config
-
getExpiredConfig
Returns the config for expired links- Returns:
- the config for expired links
-
setExpiredConfig
Sets the config for expired links- Parameters:
config- the config
-
getPredatedConfig
Returns the config for predated links- Returns:
- the config
-
setPredatedConfig
Sets the config for predated links- Parameters:
config- the config
-
getRequestURI
Get the current request uri.- Returns:
- the request uri
-
getParentRequestURI
Return a uri to the parent of the current uri.- Returns:
- the parent uri or an empty string
-
getBaseRef
Get the current base ref.- Returns:
- the base href
-
getBaseURI
Returns the base URI of the request associated with the given settings.- Returns:
- base URI, or
nullif the URI malformed - Since:
- 5.3
-
setBaseRef
Set the current base ref.- Parameters:
baseRef- the base href
-
isIgnoreInternals
public boolean isIgnoreInternals()Iftrueinternal links are not checked- Returns:
trueif internal links are not checked
-
setIgnoreInternals
public boolean setIgnoreInternals(boolean ignoreInternals) Controls if internal links should be checked by the linkchecker. If set totrueall internal links are treated as 'valid'. Please note that the settings are directly used by the linkchecker transformer and are respected on a "startElement" event. When altered on-the-fly in a JSP don't forget to flush the writer before changing the value.- Parameters:
ignoreInternals- iftrueinternal links are not checked- Returns:
- previous value
-
isIgnoreExternals
public boolean isIgnoreExternals()Iftrue, external links are not checked- Returns:
trueif external links are not checked
-
setIgnoreExternals
public boolean setIgnoreExternals(boolean ignoreExternals) Controls if external links should be checked by the linkchecker. If set totrueall external links are treated as 'valid' and they are also not recorded in the external-link storage. Please note that the settings are directly used by the linkchecker transformer and are respected on a "startElement" event. When altered on-the-fly in a JSP don't forget to flush the writer before changing the value.- Parameters:
ignoreExternals- iftrueexternal links are not checked- Returns:
- previous value
-