wicket.util.resource.locator
Class AbstractResourceStreamLocator

java.lang.Object
  extended by wicket.util.resource.locator.AbstractResourceStreamLocator
All Implemented Interfaces:
IResourceStreamLocator
Direct Known Subclasses:
ClassLoaderResourceStreamLocator, PathResourceStreamLocator, ResourceFinderResourceStreamLocator

public abstract class AbstractResourceStreamLocator
extends java.lang.Object
implements IResourceStreamLocator

Base class for implementing IResourceStreamLocators.

Contains the logic to locate a resource based on a path, a style (see Session), a locale and an extension string. The full filename will be built like: <path>_<style>_<locale>.<extension>.

Resource matches will be attempted in the following order:

  1. 1. <path>_<style>_<locale>.<extension>
  2. 2. <path>_<locale>.<extension>
  3. 3. <path>_<style>.<extension>
  4. 4. <path>.<extension>

Locales may contain a language, a country and a region or variant. Combinations of these components will be attempted in the following order:

  1. locale.toString() see javadoc for Locale for more details
  2. <language>_<country>
  3. <language>

Author:
Juergen Donnerstag, Jonathan Locke

Constructor Summary
protected AbstractResourceStreamLocator()
          Constructor
 
Method Summary
protected abstract  IResourceStream locate(java.lang.Class clazz, java.lang.String path)
          Subclass implementation locates the resource at the given path.
 IResourceStream locate(java.lang.Class clazz, java.lang.String path, java.lang.String style, java.util.Locale locale, java.lang.String extension)
          Locate a resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractResourceStreamLocator

protected AbstractResourceStreamLocator()
Constructor

Method Detail

locate

public IResourceStream locate(java.lang.Class clazz,
                              java.lang.String path,
                              java.lang.String style,
                              java.util.Locale locale,
                              java.lang.String extension)
Locate a resource. See class comments for more details.

Specified by:
locate in interface IResourceStreamLocator
Parameters:
clazz - The class requesting the resource
path - The path of the resource without extension
style - A theme or style (see Session)
locale - The Locale to apply
extension - the filname's extensions
Returns:
The Resource, or null if not found.

locate

protected abstract IResourceStream locate(java.lang.Class clazz,
                                          java.lang.String path)
Subclass implementation locates the resource at the given path. Different subclasses may take different approaches to the search.

Parameters:
clazz - The class requesting the resource
path - The complete path of the resource to locate. Separators must be forward slashes.
Returns:
The Resource, or null if not found.


Copyright © 2004-2007 Wicket developers. All Rights Reserved.