com.samskivert.servlet.tests
Class SiteResourceLoaderTest.TestSiteIdentifier

java.lang.Object
  extended by com.samskivert.servlet.tests.SiteResourceLoaderTest.TestSiteIdentifier
All Implemented Interfaces:
SiteIdentifier
Enclosing class:
SiteResourceLoaderTest

public static class SiteResourceLoaderTest.TestSiteIdentifier
extends Object
implements SiteIdentifier


Field Summary
 
Fields inherited from interface com.samskivert.servlet.SiteIdentifier
DEFAULT_SITE_ID, DEFAULT_SITE_STRING, SITE_ID_OVERRIDE_KEY
 
Constructor Summary
SiteResourceLoaderTest.TestSiteIdentifier()
           
 
Method Summary
 Iterator<Site> enumerateSites()
          Returns an enumerator over all Site mappings known to this SiteIdentifier.
 int getSiteId(String siteString)
          Returns the site identifier for the site associated with the supplied site string.
 String getSiteString(int siteId)
          Returns a string representation of the site identifier.
 int identifySite(javax.servlet.http.HttpServletRequest req)
          Returns the unique identifier for the site on which this request originated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SiteResourceLoaderTest.TestSiteIdentifier

public SiteResourceLoaderTest.TestSiteIdentifier()
Method Detail

identifySite

public int identifySite(javax.servlet.http.HttpServletRequest req)
Description copied from interface: SiteIdentifier
Returns the unique identifier for the site on which this request originated. That may be divined by looking at the server name, or perhaps a request parameter, or part of the path info. The mechanism (or mechanisms) are up to the implementation. Note: the implementation must honor the SiteIdentifier.SITE_ID_OVERRIDE_KEY request attribute.

Specified by:
identifySite in interface SiteIdentifier
Parameters:
req - the http servlet request the site for which we are trying to identify.
Returns:
the unique site identifier requestsed or SiteIdentifier.DEFAULT_SITE_ID if the site could not be identified. No site should ever have a site id value of 0.

getSiteString

public String getSiteString(int siteId)
Description copied from interface: SiteIdentifier
Returns a string representation of the site identifier. The SiteIdentifier in use can map the site ids to strings however it likes as long as it consistently maps the same identifier to the same string and vice versa. Presumably these strings would be human readable and meaningful.

Specified by:
getSiteString in interface SiteIdentifier
Parameters:
siteId - the unique integer identifier for the site that we wish to be identified by a string.
Returns:
the string identifier for this site.

getSiteId

public int getSiteId(String siteString)
Description copied from interface: SiteIdentifier
Returns the site identifier for the site associated with the supplied site string. The SiteIdentifier in use can map the site ids to strings however it likes as long as it consistently maps the same string to the same identifier and vice versa.

Specified by:
getSiteId in interface SiteIdentifier
Parameters:
siteString - the string to be converted into a site identifer.
Returns:
the integer identifier for this site.

enumerateSites

public Iterator<Site> enumerateSites()
Description copied from interface: SiteIdentifier
Returns an enumerator over all Site mappings known to this SiteIdentifier.

Specified by:
enumerateSites in interface SiteIdentifier


Copyright © 2000-2008 Michael Bayne. All Rights Reserved.