com.endeca.soleng.urlformatter
Interface UrlFormatter

All Known Implementing Classes:
BasicUrlFormatter, SeoUrlFormatter

public interface UrlFormatter

An interface that is responsible for formatting UrlState objects into URL strings. Implementations are also responsible for parsing HttpServletRequest objects into UrlState objects.

See Also:
UrlState

Method Summary
 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 character encoding that should be used when transforming URLs to and from various string forms.
 String getERecParamKey()
          The parameter key used for record detail links - typically "R".
 String getNavStateParamKey()
          The parameter key used for navigation state - typically "N".
 UrlState parseRequest(javax.servlet.http.HttpServletRequest pRequest)
          Parses the specified request into an UrlState.
 UrlState parseRequest(String pQueryString, String pPathInfo, String pCharacterEncoding)
           
 

Method Detail

parseRequest

UrlState parseRequest(javax.servlet.http.HttpServletRequest pRequest)
                      throws UrlFormatException
Parses the specified request into an UrlState.

Parameters:
pRequest - the request to parse.
Throws:
UrlFormatException - if the request cannot be parsed.

parseRequest

UrlState parseRequest(String pQueryString,
                      String pPathInfo,
                      String pCharacterEncoding)
                      throws UrlFormatException
Throws:
UrlFormatException

formatUrl

String formatUrl(UrlState pUrlState)
                 throws UrlFormatException
Formats the specified UrlState into an URL string.

Parameters:
pUrlState - the UrlState to format.
Throws:
UrlFormatException - if the UrlState cannot be formatted.

formatCanonicalUrl

String formatCanonicalUrl(UrlState pUrlState)
                          throws UrlFormatException
Formats a canonical url. Same functionality as the UrlFormatter#formatUrl method, but ensures canonicalizers associated with the formatter are not disabled, to ensure the url given is consistent.

Parameters:
pUrlState - The URL State to use to format the URL.
Returns:
The String representation of the URL State, formatted.
Throws:
UrlFormatException - Throws formatting exception.

getDefaultEncoding

String getDefaultEncoding()
Returns the default character encoding that should be used when transforming URLs to and from various string forms. This value is overridden by any character encoding specified explicitly when constructing an UrlState.

Returns:
the default encoding.
See Also:
UrlState.UrlState(UrlFormatter,String)

createUrlParam

UrlParam createUrlParam(UrlState pUrlState,
                        String pKey,
                        String pValue)
Creates an URL parameter for the specified 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.

Parameters:
pUrlState - the UrlState that will contain the parameter.
pKey - the parameter key.
pValue - the parameter string value (fully decoded).
Returns:
the newly created URL parameter.

createERecUrlParam

ERecUrlParam createERecUrlParam(UrlState pUrlState,
                                com.endeca.navigation.ERec pERec)
Creates an URL parameter containing an 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.

Parameters:
pUrlState - the UrlState that will contain the parameter.
pERec - the ERec to be contained in the UrlState.
Returns:
the newly created URL parameter.
See Also:
getERecParamKey()

createAggrERecUrlParam

AggrERecUrlParam createAggrERecUrlParam(UrlState pUrlState,
                                        com.endeca.navigation.AggrERec pAggrERec)
Creates an URL parameter containing an 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.

Parameters:
pUrlState - the UrlState that will contain the parameter.
pAggrERec - the AggrERec to be contained in the UrlState.
Returns:
the newly created URL parameter.
See Also:
getAggrERecParamKey()

createNavStateUrlParam

NavStateUrlParam createNavStateUrlParam(UrlState pUrlState)
Creates an URL parameter containing an empty 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.

Parameters:
pUrlState - the UrlState that will contain the parameter.
Returns:
the newly created URL parameter.
See Also:
getNavStateParamKey()

getNavStateParamKey

String getNavStateParamKey()
The parameter key used for navigation state - typically "N".

See Also:
createNavStateUrlParam(UrlState)

getERecParamKey

String getERecParamKey()
The parameter key used for record detail links - typically "R".

See Also:
createERecUrlParam(UrlState,com.endeca.navigation.ERec)

getAggrERecParamKey

String getAggrERecParamKey()
The parameter key used for aggregate record detail links - typically "A".

See Also:
createAggrERecUrlParam(UrlState,com.endeca.navigation.AggrERec)


Copyright © 2012, Oracle and/or its affiliates. All rights reserved.