Java URL Optimization API (Core API) 2.1.0

com.endeca.soleng.urlformatter.basic
Class BasicUrlFormatter

java.lang.Object
  extended by com.endeca.soleng.urlformatter.basic.BasicUrlFormatter
All Implemented Interfaces:
UrlFormatter

public class BasicUrlFormatter
extends java.lang.Object
implements UrlFormatter

An 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 Summary
BasicUrlFormatter()
           
 
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, java.lang.String pKey, java.lang.String pValue)
          Creates an URL parameter for the specified UrlState.
 java.lang.String formatUrl(UrlState pUrlState)
          Formats the specified UrlState into an URL string.
 java.lang.String getAggrERecParamKey()
          The parameter key used for aggregate record detail links - typically "A".
 java.lang.String getDefaultEncoding()
          Returns the default encoding for this URL formatter.
 java.lang.String getERecParamKey()
          The parameter key used for record detail links - typically "R".
 java.lang.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(java.lang.String pQueryString, java.lang.String pCharacterEncoding)
           
 void setAggrERecParamKey(java.lang.String pAggrERecParamKey)
          Sets the AggrERecParamKey.
 void setDefaultEncoding(java.lang.String pDefaultEncoding)
          Sets the default encoding for this URL formatter.
 void setERecParamKey(java.lang.String pERecParamKey)
          Sets the ERecParamKey.
 void setNavStateParamKey(java.lang.String pNavStateParamKey)
          Sets the NavStateParamKey.
 void setPrependQuestionMark(boolean pPrependQuestionMark)
          Determines whether or not question marks will be appended to the Url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicUrlFormatter

public BasicUrlFormatter()
Method Detail

parseRequest

public UrlState parseRequest(javax.servlet.http.HttpServletRequest pRequest)
                      throws UrlFormatException
Description copied from interface: UrlFormatter
Parses the specified request into an UrlState.

Specified by:
parseRequest in interface UrlFormatter
Parameters:
pRequest - the request to parse.
Throws:
UrlFormatException - if the request cannot be parsed.

parseRequest

public UrlState parseRequest(java.lang.String pQueryString,
                             java.lang.String pCharacterEncoding)
                      throws UrlFormatException
Throws:
UrlFormatException

formatUrl

public java.lang.String formatUrl(UrlState pUrlState)
                           throws UrlFormatException
Description copied from interface: UrlFormatter
Formats the specified UrlState into an URL string.

Specified by:
formatUrl in interface UrlFormatter
Parameters:
pUrlState - the UrlState to format.
Throws:
UrlFormatException - if the UrlState cannot be formatted.

createUrlParam

public UrlParam createUrlParam(UrlState pUrlState,
                               java.lang.String pKey,
                               java.lang.String pValue)
Description copied from interface: UrlFormatter
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.

Specified by:
createUrlParam in interface 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

public ERecUrlParam createERecUrlParam(UrlState pUrlState,
                                       com.endeca.navigation.ERec pERec)
Description copied from interface: UrlFormatter
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.

Specified by:
createERecUrlParam in interface 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:
UrlFormatter.getERecParamKey()

createAggrERecUrlParam

public AggrERecUrlParam createAggrERecUrlParam(UrlState pUrlState,
                                               com.endeca.navigation.AggrERec pAggrERec)
Description copied from interface: UrlFormatter
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.

Specified by:
createAggrERecUrlParam in interface 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:
UrlFormatter.getAggrERecParamKey()

createNavStateUrlParam

public NavStateUrlParam createNavStateUrlParam(UrlState pUrlState)
Description copied from interface: UrlFormatter
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.

Specified by:
createNavStateUrlParam in interface UrlFormatter
Parameters:
pUrlState - the UrlState that will contain the parameter.
Returns:
the newly created URL parameter.
See Also:
UrlFormatter.getNavStateParamKey()

getDefaultEncoding

public java.lang.String getDefaultEncoding()
Returns the default encoding for this URL formatter.

Specified by:
getDefaultEncoding in interface UrlFormatter
Returns:
the default encoding.
See Also:
UrlState.UrlState(UrlFormatter,String)

setDefaultEncoding

public void setDefaultEncoding(java.lang.String pDefaultEncoding)
Sets the default encoding for this URL formatter.

Parameters:
pDefaultEncoding - Encoding to set. Cannot be null.
Throws:
java.lang.IllegalArgumentException - if pDefaultEncoding is null. The encoding is set to "UTF", for example.

getPrependQuestionMark

public boolean getPrependQuestionMark()

setPrependQuestionMark

public void setPrependQuestionMark(boolean pPrependQuestionMark)
Determines whether or not question marks will be appended to the Url.

Parameters:
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";
 

getNavStateParamKey

public java.lang.String getNavStateParamKey()
Description copied from interface: UrlFormatter
The parameter key used for navigation state - typically "N".

Specified by:
getNavStateParamKey in interface UrlFormatter
See Also:
UrlFormatter.createNavStateUrlParam(UrlState)

setNavStateParamKey

public void setNavStateParamKey(java.lang.String pNavStateParamKey)
Sets the NavStateParamKey.

Parameters:
pNavStateParamKey - to set. Cannot be null.
Throws:
java.lang.IllegalArgumentException - if pNavStateParamKey is null.

getERecParamKey

public java.lang.String getERecParamKey()
Description copied from interface: UrlFormatter
The parameter key used for record detail links - typically "R".

Specified by:
getERecParamKey in interface UrlFormatter
See Also:
UrlFormatter.createERecUrlParam(UrlState,com.endeca.navigation.ERec)

setERecParamKey

public void setERecParamKey(java.lang.String pERecParamKey)
Sets the ERecParamKey.

Parameters:
pERecParamKey - to set. Cannot be null.
Throws:
java.lang.IllegalArgumentException - if pERecParamKey is null.

getAggrERecParamKey

public java.lang.String getAggrERecParamKey()
Description copied from interface: UrlFormatter
The parameter key used for aggregate record detail links - typically "A".

Specified by:
getAggrERecParamKey in interface UrlFormatter
See Also:
UrlFormatter.createAggrERecUrlParam(UrlState,com.endeca.navigation.AggrERec)

setAggrERecParamKey

public void setAggrERecParamKey(java.lang.String pAggrERecParamKey)
Sets the AggrERecParamKey.

Parameters:
pAggrERecParamKey - to set. Cannot be null.
Throws:
java.lang.IllegalArgumentException - if pAggrERecParamKey is null.

Java URL Optimization API (Core API) 2.1.0

Copyright © 2010 Endeca Technologies, Inc. All Rights Reserved.
@VERSION
PRODUCT: Java URL Optimization API (Core API) (urlFormatterCore)
VERSION: 2.1.0
BUILD:   12010DEV
ARCH_OS: n/a
DATE:    2010-06-29T04:02:40-0400