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
UrlFormatter
UrlState
.parseRequest
in interface UrlFormatter
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
UrlFormatException
public UrlState parseRequest(String pQueryString, String pCharacterEncoding) throws UrlFormatException
UrlFormatException
public String formatUrl(UrlState pUrlState) throws UrlFormatException
UrlFormatter
UrlState
into an URL string.formatUrl
in interface UrlFormatter
pUrlState
- the UrlState
to format.UrlFormatException
- if the UrlState
cannot be formatted.public String formatCanonicalUrl(UrlState pUrlState) throws UrlFormatException
UrlFormatter
formatCanonicalUrl
in interface UrlFormatter
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
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
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
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
pUrlState
- the UrlState
that will contain the parameter.UrlFormatter.getNavStateParamKey()
public String getDefaultEncoding()
getDefaultEncoding
in interface UrlFormatter
UrlState.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()
UrlFormatter
getNavStateParamKey
in interface UrlFormatter
UrlFormatter.createNavStateUrlParam(UrlState)
public void setNavStateParamKey(String pNavStateParamKey)
pNavStateParamKey
- to set. Cannot be null.IllegalArgumentException
- if pNavStateParamKey is null.public String getERecParamKey()
UrlFormatter
getERecParamKey
in interface UrlFormatter
UrlFormatter.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()
UrlFormatter
getAggrERecParamKey
in interface UrlFormatter
UrlFormatter.createAggrERecUrlParam(UrlState,com.endeca.navigation.AggrERec)
public void setAggrERecParamKey(String pAggrERecParamKey)
pAggrERecParamKey
- to set. Cannot be null.IllegalArgumentException
- if pAggrERecParamKey is null.Copyright © 2015, Oracle and/or its affiliates. All rights reserved.