public class SeoUrlFormatter extends BasicUrlFormatter
UrlFormatter
that parses and formats optimized URLs.
Property Summary | ||
---|---|---|
Property | Type | Default Value |
pathSeparatorToken |
String |
_ (underscore) |
pathKeyValueSeparator |
char |
- (hyphen) |
navStateFormatter |
|
null |
ERecFormatter |
|
null |
aggrERecFormatter |
|
null |
pathParamKeys |
String[] |
null |
urlParamEncoders |
|
null |
navStateCanonicalizer |
|
null |
See properties inherited from BasicUrlFormatter |
Modifier and Type | Field and Description |
---|---|
static char |
PATH_SEPARATOR |
Constructor and Description |
---|
SeoUrlFormatter() |
Modifier and Type | Method and Description |
---|---|
AggrERecUrlParam |
createAggrERecUrlParam(UrlState pUrlState,
com.endeca.navigation.AggrERec pAggrERec)
Creates an URL parameter containing an
AggrERec . |
ERecUrlParam |
createERecUrlParam(UrlState pUrlState,
com.endeca.navigation.ERec pERec)
Creates an URL parameter containing an
ERec . |
NavStateUrlParam |
createNavStateUrlParam(UrlState pUrlState)
Creates an URL parameter containing an empty
NavState . |
UrlParam |
createUrlParam(UrlState pUrlState,
String pKey,
String pValue)
Creates an URL parameter for the specified
UrlState . |
protected String |
formatAggrERec(UrlState pUrlState) |
String |
formatCanonicalUrl(UrlState pUrlState)
Formats a canonical url.
|
protected String |
formatERec(UrlState pUrlState) |
protected String |
formatNavState(UrlState pUrlState) |
protected String |
formatPathKeywords(UrlState pUrlState) |
protected String |
formatPathParams(UrlState pUrlState) |
protected String |
formatQueryString(UrlState pUrlState) |
String |
formatUrl(UrlState pUrlState)
Formats the specified
UrlState into an URL string. |
AggrERecFormatter |
getAggrERecFormatter()
The
AggrERecFormatter used to render aggregate record
attributes to the URL path keywords. |
ERecFormatter |
getERecFormatter()
The
ERecFormatter used to render endeca record
attributes to the URL path keywords. |
NavStateCanonicalizer |
getNavStateCanonicalizer()
Returns the canonicalizer used to sort the navigation state before
rendering an
UrlState . |
NavStateFormatter |
getNavStateFormatter()
The
NavStateFormatter property used to render navigation
state information to the URL path keywords. |
char |
getPathKeyValueSeparator()
The character used to separate key/value pairs in the path
parameter section of the URL.
|
String[] |
getPathParamKeys()
The parameter keys that will be appended to the path.
|
String |
getPathSeparatorToken()
The separator token that is used to separate the misc-path
section of the URL from the path parameter section.
|
UrlParamEncoder[] |
mUrlParamEncoders()
The
UrlParamEncoder objects used by this SeoUrlFormatter . |
protected void |
parsePathInfo(UrlState pUrlState,
String pPathInfo) |
protected void |
parseQueryString(UrlState pUrlState,
String pQueryString) |
UrlState |
parseRequest(javax.servlet.http.HttpServletRequest pRequest)
Parses the specified request into an
UrlState . |
UrlState |
parseRequest(String pQueryString,
String pPathInfo,
String pCharacterEncoding) |
void |
setAggrERecFormatter(AggrERecFormatter pAggrERecFormatter)
Sets the
aggrERecFormatter property, which is used to render
directory-style (path-encoded) keywords for UrlState objects
containing an Endeca aggregate record. |
void |
setERecFormatter(ERecFormatter pERecFormatter)
Sets the
ERecFormatter property, which is used to render
directory-style (path-encoded) keywords for UrlState objects
containing an Endeca record. |
void |
setNavStateCanonicalizer(NavStateCanonicalizer pNavStateCanonicalizer)
Specifies the canonicalizer used to sort the navigation state before
rendering an
UrlState . |
void |
setNavStateFormatter(NavStateFormatter pNavStateFormatter)
Sets the
navStateFormatter property, which is used to render
directory-style (path-encoded) keywords for UrlState objects
containing dimensional navigation state. |
void |
setPathKeyValueSeparator(char pPathKeyValueSeparator)
Specifies the character used to separate key/value pairs in the path
parameter section of the URL.
|
void |
setPathParamKeys(String[] pPathParamKeys)
Specifies the parameter keys that will be appended to the path,
rather than the query string, which is the default setting for any given key.
|
void |
setPathSeparatorToken(String pPathSeparatorToken)
Specifies the separator token that is used to separate the misc-path
section of the URL from the path parameter section.
|
void |
setUrlParamEncoders(UrlParamEncoder[] pUrlParamEncoders)
Specifies the
UrlParamEncoder objects used by this SeoUrlFormatter . |
void |
setUseNavStateCanonicalizer(boolean useNavStateCanonicalizer)
Determines whether or not to use canonicalizers when formatting the URL.
|
boolean |
useNavStateCanonicalizer()
The
useNavStateCanonicalizer property used determine whether to use any
canonicalizers associated with this formatter. |
getAggrERecParamKey, getDefaultEncoding, getERecParamKey, getNavStateParamKey, getPrependQuestionMark, parseRequest, setAggrERecParamKey, setDefaultEncoding, setERecParamKey, setNavStateParamKey, setPrependQuestionMark
public static final char PATH_SEPARATOR
public String getPathSeparatorToken()
public void setPathSeparatorToken(String pPathSeparatorToken)
http://www.mysite.com/controller/Wine+Type/Sparkling/Blanc+de+Blancs/XX/N-6202
pPathSeparatorToken
- Path separator token to set. Cannot be null.IllegalArgumentException
- if pPathSeparatorToken is null.public char getPathKeyValueSeparator()
public void setPathKeyValueSeparator(char pPathKeyValueSeparator)
In the following URL, '*' is the keyValueSeparator:
http://www.mysite.com/controller/Wine+Type/Sparkling/Blanc+de+Blancs/_/N*6202
pPathKeyValueSeparator
- key value separator. Cannot be null.public boolean useNavStateCanonicalizer()
useNavStateCanonicalizer
property used determine whether to use any
canonicalizers associated with this formatter.TRUE
if the canonicalizer will be used.public void setUseNavStateCanonicalizer(boolean useNavStateCanonicalizer)
useNavStateCanonicalizer
- If set to TRUE
, the canonicalizer will
be used.public NavStateFormatter getNavStateFormatter()
NavStateFormatter
property used to render navigation
state information to the URL path keywords.public void setNavStateFormatter(NavStateFormatter pNavStateFormatter)
navStateFormatter
property, which is used to render
directory-style (path-encoded) keywords for UrlState
objects
containing dimensional navigation state.pNavStateFormatter
- object that is used to format the UrlState.SeoNavStateFormatter
public ERecFormatter getERecFormatter()
ERecFormatter
used to render endeca record
attributes to the URL path keywords.public void setERecFormatter(ERecFormatter pERecFormatter)
ERecFormatter
property, which is used to render
directory-style (path-encoded) keywords for UrlState
objects
containing an Endeca record.pERecFormatter
- object that is used to format the UrlState.SeoERecFormatter
public AggrERecFormatter getAggrERecFormatter()
AggrERecFormatter
used to render aggregate record
attributes to the URL path keywords.public void setAggrERecFormatter(AggrERecFormatter pAggrERecFormatter)
aggrERecFormatter
property, which is used to render
directory-style (path-encoded) keywords for UrlState
objects
containing an Endeca aggregate record.pAggrERecFormatter
- object that is used to format the UrlState.SeoAggrERecFormatter
public String[] getPathParamKeys()
public void setPathParamKeys(String[] pPathParamKeys)
http://www.mysite.com/controller/Wine-Sparkling-Blanc-de-Blancs/Other-US/_/N-6202+4294963118If N had not been added to the pathParamKeys, the URL would be output as follows:
http://www.mysite.com/controller/Wine-Sparkling-Blanc-de-Blancs/Other-US?N=6202+4294963118
pPathParamKeys
- Array of keys that will be added to the path, rather than the query string.public UrlParamEncoder[] mUrlParamEncoders()
UrlParamEncoder
objects used by this SeoUrlFormatter
.public void setUrlParamEncoders(UrlParamEncoder[] pUrlParamEncoders)
UrlParamEncoder
objects used by this SeoUrlFormatter
.pUrlParamEncoders
- array of encoders that are used to encode various URL parameters.public NavStateCanonicalizer getNavStateCanonicalizer()
UrlState
.public void setNavStateCanonicalizer(NavStateCanonicalizer pNavStateCanonicalizer)
UrlState
.pNavStateCanonicalizer
- the NavStateCanonicalizer
class to use.public UrlState parseRequest(javax.servlet.http.HttpServletRequest pRequest) throws UrlFormatException
UrlFormatter
UrlState
.parseRequest
in interface UrlFormatter
parseRequest
in class BasicUrlFormatter
pRequest
- the request to parse.UrlFormatException
- if the request cannot be parsed.public UrlState parseRequest(String pQueryString, String pPathInfo, String pCharacterEncoding) throws UrlFormatException
parseRequest
in interface UrlFormatter
parseRequest
in class BasicUrlFormatter
UrlFormatException
public String formatUrl(UrlState pUrlState) throws UrlFormatException
UrlFormatter
UrlState
into an URL string.formatUrl
in interface UrlFormatter
formatUrl
in class BasicUrlFormatter
pUrlState
- the UrlState
to format.UrlFormatException
- if the UrlState
cannot be formatted.public String formatCanonicalUrl(UrlState pUrlState) throws UrlFormatException
UrlFormatter
formatCanonicalUrl
in interface UrlFormatter
formatCanonicalUrl
in class BasicUrlFormatter
pUrlState
- The URL State to use to format the URL.UrlFormatException
- Throws formatting exception.public UrlParam createUrlParam(UrlState pUrlState, String pKey, String pValue)
UrlFormatter
UrlState
. This is
an internal method used by an UrlState
. You shouldn't need to
use this method unless you are implementing a custom UrlFormatter
.createUrlParam
in interface UrlFormatter
createUrlParam
in class BasicUrlFormatter
pUrlState
- the UrlState
that will contain the parameter.pKey
- the parameter key.pValue
- the parameter string value (fully decoded).public ERecUrlParam createERecUrlParam(UrlState pUrlState, com.endeca.navigation.ERec pERec)
UrlFormatter
ERec
. This is
an internal method used by an UrlState
. You shouldn't need to
use this method unless you are implementing a custom UrlFormatter
.createERecUrlParam
in interface UrlFormatter
createERecUrlParam
in class BasicUrlFormatter
pUrlState
- the UrlState
that will contain the parameter.pERec
- the ERec
to be contained in the UrlState
.UrlFormatter.getERecParamKey()
public AggrERecUrlParam createAggrERecUrlParam(UrlState pUrlState, com.endeca.navigation.AggrERec pAggrERec)
UrlFormatter
AggrERec
. This is
an internal method used by an UrlState
. You shouldn't need to
use this method unless you are implementing a custom UrlFormatter
.createAggrERecUrlParam
in interface UrlFormatter
createAggrERecUrlParam
in class BasicUrlFormatter
pUrlState
- the UrlState
that will contain the parameter.pAggrERec
- the AggrERec
to be contained in the UrlState
.UrlFormatter.getAggrERecParamKey()
public NavStateUrlParam createNavStateUrlParam(UrlState pUrlState)
UrlFormatter
NavState
. This is
an internal method used by an UrlState
. You shouldn't need to
use this method unless you are implementing a custom UrlFormatter
.createNavStateUrlParam
in interface UrlFormatter
createNavStateUrlParam
in class BasicUrlFormatter
pUrlState
- the UrlState
that will contain the parameter.UrlFormatter.getNavStateParamKey()
protected String formatPathKeywords(UrlState pUrlState) throws UrlFormatException
UrlFormatException
protected String formatNavState(UrlState pUrlState) throws UrlFormatException
UrlFormatException
protected String formatERec(UrlState pUrlState) throws UrlFormatException
UrlFormatException
protected String formatAggrERec(UrlState pUrlState) throws UrlFormatException
UrlFormatException
protected String formatPathParams(UrlState pUrlState) throws UrlFormatException
UrlFormatException
protected String formatQueryString(UrlState pUrlState) throws UrlFormatException
UrlFormatException
protected void parsePathInfo(UrlState pUrlState, String pPathInfo) throws UrlFormatException
UrlFormatException
protected void parseQueryString(UrlState pUrlState, String pQueryString) throws UrlFormatException
UrlFormatException
Copyright © 2015, Oracle and/or its affiliates. All rights reserved.