Class TargetedUrlByFileStrategy
java.lang.Object
org.craftercms.engine.targeting.impl.AbstractTargetedUrlStrategy
org.craftercms.engine.targeting.impl.TargetedUrlByFileStrategy
- All Implemented Interfaces:
TargetedUrlStrategy
TargetedUrlStrategy
implementation that recognizes the target ID in
the file name (e.g. /products/index_es_CR.xml).- Author:
- avasquez
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final int
static final int
static final int
static final String
protected String
Fields inherited from class org.craftercms.engine.targeting.impl.AbstractTargetedUrlStrategy
targetIdManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildTargetedUrl
(String prefix, String targetId, String suffix) Builds the targeted URL with the specified prefix, target ID and suffix.protected String
doToTargetedUrl
(String url, String currentTargetId) protected String
protected String
protected Pattern
protected String
getTargetId
(Matcher matcher) boolean
Returns true if the strategy is based on the name of the file.void
setTargetIdSeparator
(String targetIdSeparator) Methods inherited from class org.craftercms.engine.targeting.impl.AbstractTargetedUrlStrategy
getTargetedUrlComponents, matchUrl, parseTargetedUrl, setTargetIdManager, toTargetedUrl
-
Field Details
-
DEFAULT_TARGET_ID_SEPARATOR
- See Also:
-
TARGETED_URL_REGEX_FORMAT
- See Also:
-
PREFIX_GROUP
public static final int PREFIX_GROUP- See Also:
-
TARGET_ID_GROUP
public static final int TARGET_ID_GROUP- See Also:
-
SUFFIX_GROUP
public static final int SUFFIX_GROUP- See Also:
-
targetIdSeparator
-
-
Constructor Details
-
TargetedUrlByFileStrategy
public TargetedUrlByFileStrategy()
-
-
Method Details
-
setTargetIdSeparator
-
isFileNameBasedStrategy
public boolean isFileNameBasedStrategy()Description copied from interface:TargetedUrlStrategy
Returns true if the strategy is based on the name of the file. -
buildTargetedUrl
Description copied from interface:TargetedUrlStrategy
Builds the targeted URL with the specified prefix, target ID and suffix. For example, if the prefix is /products/index, the target ID en_US, the suffix .xml, and the strategy handles targeted URLs by file name, then the resulting URL will be /products/index_en_US.xml.- Specified by:
buildTargetedUrl
in interfaceTargetedUrlStrategy
- Overrides:
buildTargetedUrl
in classAbstractTargetedUrlStrategy
- Parameters:
prefix
- the URL prefixtargetId
- the target IDsuffix
- the URL suffix- Returns:
- the built targeted URL
-
getPrefix
- Specified by:
getPrefix
in classAbstractTargetedUrlStrategy
-
getTargetId
- Specified by:
getTargetId
in classAbstractTargetedUrlStrategy
-
getSuffix
- Specified by:
getSuffix
in classAbstractTargetedUrlStrategy
-
getTargetedUrlPattern
- Specified by:
getTargetedUrlPattern
in classAbstractTargetedUrlStrategy
-
doToTargetedUrl
- Specified by:
doToTargetedUrl
in classAbstractTargetedUrlStrategy
-