Class TargetedUrlByFolderStrategy
java.lang.Object
org.craftercms.engine.targeting.impl.AbstractTargetedUrlStrategy
org.craftercms.engine.targeting.impl.TargetedUrlByFolderStrategy
- All Implemented Interfaces:
TargetedUrlStrategy
TargetedUrlStrategy
implementation that recognizes the target ID in
the first folder of the URL name (e.g. /en/products/index.xml).- Author:
- avasquez
-
Field Summary
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.Methods inherited from class org.craftercms.engine.targeting.impl.AbstractTargetedUrlStrategy
getTargetedUrlComponents, matchUrl, parseTargetedUrl, setTargetIdManager, toTargetedUrl
-
Field Details
-
TARGETED_URL_REGEX_FORMAT
- See Also:
-
TARGET_ID_GROUP
public static final int TARGET_ID_GROUP- See Also:
-
SUFFIX_GROUP
public static final int SUFFIX_GROUP- See Also:
-
-
Constructor Details
-
TargetedUrlByFolderStrategy
public TargetedUrlByFolderStrategy()
-
-
Method Details
-
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
-