public class DefaultContentPathConstructor extends Object implements ContentPathConstructor
ContentPathConstructor
pageNameConstruct(Template, PageIdentifier, boolean)
Modifier and Type | Field and Description |
---|---|
static Map<String,String> |
aliasMap
Map of the alias path to the ContentNameId |
static String |
CLEAN_VARIABLES_PATH_PARAMS_REGEX
If there are variables defined in a URL in the format /abc/$[a.b.c]/oo%45 o123&/$[zzzz.zzzzz]
Then this will help eliminate the Path param pairs with variables including any leading "/" from the String |
static String |
CLEAN_VARIABLES_QUERY_PARAMS_REGEX
If there are variables defined in a URL in the format param1=abc¶m2=$[a.b.c]¶m3=oo%45 o123¶m4=$[zzzz.zzzzz]
Then this will help eliminate the Query param pairs with variables including any leading "&" from the String |
static String |
CONTENT_PATH_PARAMS
A String of Path params (prefixed to the last path location)
Example: /a/b/c.html + PATH_PARAMS = "d/e ~~~~~~ results in ~~~~~> /a/b/d/e/c.html represent the value of this parameter. |
static String |
CONTENT_QUERY_PARAMS
A String of Query params represent the value of this parameter.
|
static String |
PREVIEW_BASE_URL
A String or a Transformer that accepts
PageIdentifier to generate a URL |
ALL_RECS, CAMPAIGN_ID, LANG, PAGE_ID, PAGE_MODE_MOBILE, PAGE_MODE_POPUP, PAGE_NAME, PAGE_NUM, PAGE_PARAM, PAGE_PARENT, PAGE_PARENT_ID, PAGE_REFERRER, PAGE_TYPE, PREVIEW
Constructor and Description |
---|
DefaultContentPathConstructor() |
Modifier and Type | Method and Description |
---|---|
String |
decodeUrlSafeName(String name)
Transform the safe url-name back to original.
|
String |
encodeUrlSafeName(String name)
Transform the intended name to a URL safe name; converting special characters etc
The transformation should be reversible. |
String |
filterActualPageName(String rawName)
The page name is constructed using
this#pageNameConstruct(PageIdentifier, boolean) . |
protected String |
getExtension()
AppSettings.get().APPLICATION_EXTENSION depends on a Wicket Request Cycle.
A lot of Feeds may needs URL generation also, so cannot depend on Request cycle; directly use appConfiguration."site.ext" |
String |
getPageName(PageIdentifier page)
For Override
|
String |
getPageNameFromURL(String url)
The page name is constructed using
this#pageNameConstruct(PageIdentifier, boolean) . |
String |
pageNameConstruct(Template associatedTemplate,
PageIdentifier page)
Get mount path location/name
|
String |
pageNameConstruct(Template associatedTemplate,
PageIdentifier page,
boolean preview)
Get mount path location/name
Paths constructed here should be compatible with MountPathReLoader#getStaus(java.util.Map)
This method accepts the following constants from Template.getAttributes()
PREVIEW_BASE_URL
CONTENT_QUERY_PARAMS
CONTENT_PATH_PARAMS
CLEAN_VARIABLES_PATH_PARAMS_REGEX
CLEAN_VARIABLES_QUERY_PARAMS_REGEX
|
protected String |
replaceVariables(PageIdentifier page,
String paramTemplateString)
Replaces the variables in the String tempalte ($[var name]) by the values.
|
void |
setPageNameForURL(String url,
String name)
Allow the ability to tell the path constructor a name of Page/content for a given relative URL
|
public static final String PREVIEW_BASE_URL
PageIdentifier
to generate a URLpublic static final String CLEAN_VARIABLES_QUERY_PARAMS_REGEX
public static final String CLEAN_VARIABLES_PATH_PARAMS_REGEX
public static final String CONTENT_QUERY_PARAMS
PageIdentifier.getName()
PageIdentifier#getLocale().country
PageIdentifier#getLocale().language
PageIdentifier#getLocale().ISO3Country
PageIdentifier#getLocale().ISO3Language
PageIdentifier.getAttributeNames()
encodeUrlSafeName(String)
public static final String CONTENT_PATH_PARAMS
PageIdentifier.getName()
PageIdentifier#getLocale().country
PageIdentifier#getLocale().language
PageIdentifier#getLocale().ISO3Country
PageIdentifier#getLocale().ISO3Language
PageIdentifier.getAttributeNames()
encodeUrlSafeName(String)
protected String getExtension()
public final String pageNameConstruct(Template associatedTemplate, PageIdentifier page)
pageNameConstruct
in interface ContentPathConstructor
page
- protected String replaceVariables(PageIdentifier page, String paramTemplateString)
page
- paramTemplateString
- public String getPageName(PageIdentifier page)
getPageName
in interface ContentPathConstructor
page
- as PageIdentifier
PageIdentifier.getName()
public final String pageNameConstruct(Template associatedTemplate, PageIdentifier page, boolean preview)
MountPathReLoader#getStaus(java.util.Map)
Template.getAttributes()
pageNameConstruct
in interface ContentPathConstructor
page
- preview
- (true means Status.DRAFT
else Status.PUBLISH
public String encodeUrlSafeName(String name)
ContentPathConstructor
#getNameFromSafeUrl(String)
encodeUrlSafeName
in interface ContentPathConstructor
public String decodeUrlSafeName(String name)
ContentPathConstructor
ContentPathConstructor.encodeUrlSafeName(String)
decodeUrlSafeName
in interface ContentPathConstructor
public String getPageNameFromURL(String url)
this#pageNameConstruct(PageIdentifier, boolean)
. This can introduce some
conventions. Filter them to extract the actual name if required.getPageNameFromURL
in interface ContentPathConstructor
url
- as Stringpublic void setPageNameForURL(String url, String name)
ContentPathConstructor
setPageNameForURL
in interface ContentPathConstructor
public final String filterActualPageName(String rawName)
this#pageNameConstruct(PageIdentifier, boolean)
. This can introduce some
conventions. Filter them to extract the actual name if required.filterActualPageName
in interface ContentPathConstructor
Copyright © 2018. All rights reserved.