public class BasicUrlFormatter extends Object implements UrlFormatter
UrlFormatter that formats traditional Endeca URLs.
| Property Summary | ||
|---|---|---|
| Property | Type | Default Value |
defaultEncoding |
String |
UTF-8 |
prependQuestionMark |
boolean |
true |
navStateParamKey |
String |
N |
ERecParamKey |
String |
R |
aggrERecParamKey |
String |
A |
| Constructor and Description |
|---|
BasicUrlFormatter() |
| 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. |
String |
formatCanonicalUrl(UrlState pUrlState)
Formats a canonical url.
|
String |
formatUrl(UrlState pUrlState)
Formats the specified
UrlState into an URL string. |
String |
getAggrERecParamKey()
The parameter key used for aggregate record detail links - typically "A".
|
String |
getDefaultEncoding()
Returns the default encoding for this URL formatter.
|
String |
getERecParamKey()
The parameter key used for record detail links - typically "R".
|
String |
getNavStateParamKey()
The parameter key used for navigation state - typically "N".
|
boolean |
getPrependQuestionMark() |
UrlState |
parseRequest(javax.servlet.http.HttpServletRequest pRequest)
Parses the specified request into an
UrlState. |
UrlState |
parseRequest(String pQueryString,
String pCharacterEncoding) |
UrlState |
parseRequest(String pQueryString,
String pPathInfo,
String pCharacterEncoding) |
void |
setAggrERecParamKey(String pAggrERecParamKey)
Sets the AggrERecParamKey.
|
void |
setDefaultEncoding(String pDefaultEncoding)
Sets the default encoding for this URL formatter.
|
void |
setERecParamKey(String pERecParamKey)
Sets the ERecParamKey.
|
void |
setNavStateParamKey(String pNavStateParamKey)
Sets the NavStateParamKey.
|
void |
setPrependQuestionMark(boolean pPrependQuestionMark)
Determines whether or not question marks will be appended to the Url.
|
public UrlState parseRequest(javax.servlet.http.HttpServletRequest pRequest) throws UrlFormatException
UrlFormatterUrlState.parseRequest in interface UrlFormatterpRequest - 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 UrlFormatterUrlFormatExceptionpublic UrlState parseRequest(String pQueryString, String pCharacterEncoding) throws UrlFormatException
UrlFormatExceptionpublic String formatUrl(UrlState pUrlState) throws UrlFormatException
UrlFormatterUrlState into an URL string.formatUrl in interface UrlFormatterpUrlState - the UrlState to format.UrlFormatException - if the UrlState cannot be formatted.public String formatCanonicalUrl(UrlState pUrlState) throws UrlFormatException
UrlFormatterformatCanonicalUrl in interface UrlFormatterpUrlState - The URL State to use to format the URL.UrlFormatException - Throws formatting exception.public UrlParam createUrlParam(UrlState pUrlState, String pKey, String pValue)
UrlFormatterUrlState. 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 UrlFormatterpUrlState - 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)
UrlFormatterERec. 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 UrlFormatterpUrlState - 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)
UrlFormatterAggrERec. 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 UrlFormatterpUrlState - the UrlState that will contain the parameter.pAggrERec - the AggrERec to be contained in the UrlState.UrlFormatter.getAggrERecParamKey()public NavStateUrlParam createNavStateUrlParam(UrlState pUrlState)
UrlFormatterNavState. 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 UrlFormatterpUrlState - the UrlState that will contain the parameter.UrlFormatter.getNavStateParamKey()public String getDefaultEncoding()
getDefaultEncoding in interface UrlFormatterUrlState.UrlState(UrlFormatter,String)public void setDefaultEncoding(String pDefaultEncoding)
pDefaultEncoding - Encoding to set. Cannot be null.IllegalArgumentException - if pDefaultEncoding is null.
The encoding is set to "UTF", for example.public boolean getPrependQuestionMark()
public void setPrependQuestionMark(boolean pPrependQuestionMark)
pPrependQuestionMark - flag to set.
If this is set to true:
String url = urlFormatter.formatUrl(urlState);
// url = "?N=0";
If this is set to false:
String url = urlFormatter.formatUrl(urlState);
// url = "N=0";
public String getNavStateParamKey()
UrlFormattergetNavStateParamKey in interface UrlFormatterUrlFormatter.createNavStateUrlParam(UrlState)public void setNavStateParamKey(String pNavStateParamKey)
pNavStateParamKey - to set. Cannot be null.IllegalArgumentException - if pNavStateParamKey is null.public String getERecParamKey()
UrlFormattergetERecParamKey in interface UrlFormatterUrlFormatter.createERecUrlParam(UrlState,com.endeca.navigation.ERec)public void setERecParamKey(String pERecParamKey)
pERecParamKey - to set. Cannot be null.IllegalArgumentException - if pERecParamKey is null.public String getAggrERecParamKey()
UrlFormattergetAggrERecParamKey in interface UrlFormatterUrlFormatter.createAggrERecUrlParam(UrlState,com.endeca.navigation.AggrERec)public void setAggrERecParamKey(String pAggrERecParamKey)
pAggrERecParamKey - to set. Cannot be null.IllegalArgumentException - if pAggrERecParamKey is null.Copyright © 2019, Oracle and/or its affiliates. All rights reserved.