no.sesat.search.view.navigation
Class AbstractUrlGenerator

java.lang.Object
  extended by no.sesat.search.view.navigation.AbstractUrlGenerator
All Implemented Interfaces:
UrlGenerator
Direct Known Subclasses:
BasicUrlGenerator, TreeUrlGenerator

public abstract class AbstractUrlGenerator
extends Object
implements UrlGenerator

The basics of a UrlGenerator. Extend this class to create your own UrlGenerator. This ensures that configuration contracts are upheld. The term url component is used to denote a part of a URL, be it a part of the path or a parameter.

Version:
$Id: AbstractUrlGenerator.java 6596 2008-05-10 10:05:48Z ssmiweve $

Constructor Summary
AbstractUrlGenerator(DataModel dataModel, NavigationConfig.Navigation navigation, NavigationState state)
          Overriding classes must have just one constructor with a signature matching this constructor.
 
Method Summary
protected static String enc(String str)
           
protected  DataModel getDataModel()
          Returns the data model.
protected  NavigationState getNavigationState()
          Returns the navigation state.
protected  String getPrefix()
          Returns the static URL prefix.
protected  Set<String> getUrlComponentNames(NavigationConfig.Nav nav, Set<String> extraParameters, String newValue)
          All URL components that should be persistent when navigating the given navigator.
protected  String getUrlComponentValue(NavigationConfig.Nav nav, String componentName, Map<String,String> extraParameters)
          The value for the given URL component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface no.sesat.search.view.navigation.UrlGenerator
getURL, getURL
 

Constructor Detail

AbstractUrlGenerator

public AbstractUrlGenerator(DataModel dataModel,
                            NavigationConfig.Navigation navigation,
                            NavigationState state)
Overriding classes must have just one constructor with a signature matching this constructor.

Parameters:
dataModel - The datamodel.
navigation - the navigator set to generate URLs for.
state - the current navigation set.
Method Detail

getNavigationState

protected final NavigationState getNavigationState()
Returns the navigation state.

Returns:
the navigation state.

getPrefix

protected String getPrefix()
Returns the static URL prefix. (e.g. /search). If the URL is configured to be relative, the empty string is returned.

Returns:
the url prefix.
See Also:
NavigationConfig.Navigation.getPrefix()

getUrlComponentNames

protected final Set<String> getUrlComponentNames(NavigationConfig.Nav nav,
                                                 Set<String> extraParameters,
                                                 String newValue)
All URL components that should be persistent when navigating the given navigator.

Parameters:
nav - the navigator.
extraParameters - any extra parameters that should go into the URL.
newValue -
Returns:
the set of parameter names.

getUrlComponentValue

protected String getUrlComponentValue(NavigationConfig.Nav nav,
                                      String componentName,
                                      Map<String,String> extraParameters)
The value for the given URL component.

Parameters:
nav - the navigator
componentName - the name of the url component.
extraParameters -
Returns:
the value. UTF-8 URL ENCODED.

getDataModel

protected final DataModel getDataModel()
Returns the data model.

Returns:
the datamodel.

enc

protected static String enc(String str)


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.