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
FieldsFields inherited from class org.craftercms.engine.targeting.impl.AbstractTargetedUrlStrategy
targetIdManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildTargetedUrl(String prefix, String targetId, String suffix) Builds the targeted URL with the specified prefix, target ID and suffix.protected StringdoToTargetedUrl(String url, String currentTargetId) protected Stringprotected Stringprotected Patternprotected StringgetTargetId(Matcher matcher) booleanReturns 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, 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
-
-
Method Details
-
isFileNameBasedStrategy
public boolean isFileNameBasedStrategy()Description copied from interface:TargetedUrlStrategyReturns true if the strategy is based on the name of the file. -
buildTargetedUrl
Description copied from interface:TargetedUrlStrategyBuilds 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:
buildTargetedUrlin interfaceTargetedUrlStrategy- Overrides:
buildTargetedUrlin classAbstractTargetedUrlStrategy- Parameters:
prefix- the URL prefixtargetId- the target IDsuffix- the URL suffix- Returns:
- the built targeted URL
-
getPrefix
- Specified by:
getPrefixin classAbstractTargetedUrlStrategy
-
getTargetId
- Specified by:
getTargetIdin classAbstractTargetedUrlStrategy
-
getSuffix
- Specified by:
getSuffixin classAbstractTargetedUrlStrategy
-
getTargetedUrlPattern
- Specified by:
getTargetedUrlPatternin classAbstractTargetedUrlStrategy
-
doToTargetedUrl
- Specified by:
doToTargetedUrlin classAbstractTargetedUrlStrategy
-