public class SEOURLMapperImpl extends java.lang.Object implements SEOURLMapper
SEOURLMapper
interface.SEOURLMapper
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSNAME
Class name field.
|
static java.lang.String |
COPYRIGHT
IBM copyright field.
|
Constructor and Description |
---|
SEOURLMapperImpl()
Default constructor for the class.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
buildTokenNameUrlKeywordMapForPattern(com.ibm.commerce.seo.url.configuration.SEOURLPatternType pattern,
com.ibm.commerce.seo.url.configuration.SEOURLPatternConfiguration patternConfiguration,
TypedProperty properties,
java.lang.String device)
This method builds the URL token name and keyword map for the specified
pattern using the request properties provided.
|
java.lang.String |
constructDynamicURLByPatternName(java.lang.String patternName,
TypedProperty requestProperties,
javax.servlet.jsp.PageContext pageContext)
This method constructs the dynamic url using the patternName and set of
request properties.
|
java.lang.String |
constructSEOURLByPatternName(java.lang.String patternName,
TypedProperty requestProperties,
javax.servlet.jsp.PageContext pageContext,
java.lang.String mappingName,
java.util.Map params)
This method constructs the SEO URL using the URL pattern name and request
properties specified.
|
java.util.List<java.lang.String> |
constructSEOUrlPrefixByUsageAndDevice(java.lang.String usage,
java.lang.String device,
TypedProperty urlProperties)
This method constructs all the valid URL prefixes for the usage and
device specified.The method looks up all the URL pattern configurations
for the store specified based on the usage to find all the applicable URL
patterns.
|
javax.servlet.http.HttpServletRequest |
deconstructHttpRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Integer storeId)
This method deconstructs the incoming SEO URL to its dynamic equivalent.
|
java.lang.Integer |
getStoreIdFromSEOURL(java.lang.String seoURL)
This method parses the input
seoUrl and returns storeId. |
java.lang.String |
getStoreKeywordFromSEOURL(java.lang.String seoUrl)
This method returns the store keyword present in the SEO URL
|
boolean |
isSEOURLPatternFeatureEnabled(java.lang.Integer storeId)
If SEO URL pattern based feature is enabled at instance level, then this
method checks to see if SEO URL pattern based feature is enabled for the
given store or not.
|
java.util.List |
processRequestURL(javax.servlet.http.HttpServletRequest request)
This method checks if the incoming URL in the request is actually an SEO
URL or not.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public java.util.List<java.lang.String> constructSEOUrlPrefixByUsageAndDevice(java.lang.String usage, java.lang.String device, TypedProperty urlProperties) throws SEOApplicationException
SEOURLMapper
The storeId
and langId
are expected to be
passed in the request properties.
The URL prefix would have the location of the primary token for the
usage, tagged with a special marker. All the other tokens in the URL
pattern would be fully resolved. The marker used to identify the primary
token location in the URL is $SEO:PRIMARYTOKEN$
.
Assuming there is an URL pattern /StoreToken/LangToken/ProductToken for usage PRODUCT and device mobile, the method would construct the following URL prefix if the storeId, langId are specified in the properties. http://localhost/shop/Madisons/en/$SEO:PRIMARYTOKEN$ Where, localhost is the host name for the web server, //shop is the context root simplification defined for the site Madisons/en/$SEO:PRIMARYTOKEN$ is the URL prefix.
constructSEOUrlPrefixByUsageAndDevice
in interface SEOURLMapper
usage
- The usage of the URL prefixes being constructed. For example,
ITEM, PRODUCT etc.device
- The device for which the URL is being constructed. Values
supported are: SEOConstants#DEVICE_TYPE_MOBILE
or
SEOConstants#DEVICE_TYPE_STANDARD_BROWSER
urlProperties
- The input properties to construct the URL prefix.SEOApplicationException
public javax.servlet.http.HttpServletRequest deconstructHttpRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Integer storeId) throws SEOApplicationException
SEOURLMapper
deconstructHttpRequest
in interface SEOURLMapper
request
- The incoming servlet request.response
- The incoming servlet response object.storeId
- - Store Id for which the url needs to be deconstructedSEOApplicationException
public java.util.Map<java.lang.String,java.lang.String> buildTokenNameUrlKeywordMapForPattern(com.ibm.commerce.seo.url.configuration.SEOURLPatternType pattern, com.ibm.commerce.seo.url.configuration.SEOURLPatternConfiguration patternConfiguration, TypedProperty properties, java.lang.String device) throws SEOApplicationException
pattern
- The SEOURLPatternType
object that represents the
URL for whom the map is being built.patternConfiguration
- The SEOURLPatternConfiguration
object that
represents the pattern configuration for the store.properties
- The request properties containing the values to be used to
find the key words.device
- The device type for which the pattern is being applied.SEOApplicationException
- When an error occurs while building the map. Possible errors
are:
public java.lang.String constructSEOURLByPatternName(java.lang.String patternName, TypedProperty requestProperties, javax.servlet.jsp.PageContext pageContext, java.lang.String mappingName, java.util.Map params) throws SEOApplicationException
SEOURLMapper
storeId
and langId
are expected to be part of the request properties. If SEO URL based on
pattern feature is needed, then patternName parameter is mandatory and
should be non-null while mappingName will be ignored and null can be
passed for mappingName If SEO URL based on mapper file feature is needed,
then mappingName parameter is mandatory and should be non-null, while
patternName will be ignored and null can be passed for patternName.constructSEOURLByPatternName
in interface SEOURLMapper
patternName
- The URL pattern name to be used for constructing the SEO URL based on pattern feature.requestProperties
- The input request properties for constructing the URL.pageContext
- The page context of the page on which the URL is being
constructed.mappingName
- The mapping name used in old SEO implementation.params
- Map of parameters passed to be used while constructing SEO URL based on mapping name.
Will be ignored when construction is done based on patternNameSEOApplicationException
public boolean isSEOURLPatternFeatureEnabled(java.lang.Integer storeId)
isSEOURLPatternFeatureEnabled
in interface SEOURLMapper
storeId
- - StoreId for which this check needs to be donetrue
- if SEO based on URL pattern is enabled in
instance XML and for the given storeId false
,
otherwise.SEOURLPatternConfigurationRegistry.isSEOURLPatternFeatureEnabled(Integer)
public java.lang.String constructDynamicURLByPatternName(java.lang.String patternName, TypedProperty requestProperties, javax.servlet.jsp.PageContext pageContext) throws SEOApplicationException
SEOURLMapper
constructDynamicURLByPatternName
in interface SEOURLMapper
patternName
- - Name of the pattern. ViewName will be retrieved based on
this pattern name.requestProperties
- - Request properties which goes in as query parameters in the
resulting URL.pageContext
- - JSP page context object.SEOApplicationException
public java.lang.String getStoreKeywordFromSEOURL(java.lang.String seoUrl)
seoUrl
- - SEO URL which will be parsed to find the store keywordpublic java.lang.Integer getStoreIdFromSEOURL(java.lang.String seoURL)
SEOURLMapper
seoUrl
and returns storeId.
Input string is parsed and each token in the string is matched against
the available tokens whose usageType is set to 'Store'
SEOConfigurationRegistry#getAllStaticSEOTokenUsageTypesForStore(Integer)
.
Token value of the matched token will be returned as storeId.getStoreIdFromSEOURL
in interface SEOURLMapper
seoURL
- - Input string which will be tokenized and parsed.public java.util.List processRequestURL(javax.servlet.http.HttpServletRequest request)
SEOURLMapper
/
in the request path
of the request object is used to do this check. The incoming URL is
considered as SEO URL only if it satisfies all of the below conditions:
/
in the
request path)
processRequestURL
in interface SEOURLMapper
request
- - HttpServletRequest object. Note that this object might be
modified in certain scenario's.Boolean.TRUE
if the
incoming URL is SEO URL based on pattern feature. Otherwise,
Boolean FALSE