org.apache.hivemind.util
Class ContextResource

java.lang.Object
  extended by org.apache.hivemind.util.AbstractResource
      extended by org.apache.hivemind.util.ContextResource
All Implemented Interfaces:
Resource

public class ContextResource
extends AbstractResource

Implementation of Resource for resources found within the web application context.

Note: moved from Tapestry. Originally part of Tapestry 3.0.

Since:
1.1
Author:
Howard Lewis Ship

Constructor Summary
ContextResource(javax.servlet.ServletContext context, java.lang.String path)
           
ContextResource(javax.servlet.ServletContext context, java.lang.String path, java.util.Locale locale)
           
 
Method Summary
 Resource getLocalization(java.util.Locale locale)
          Locates the resource using LocalizedContextResourceFinder and ServletContext.getResource(java.lang.String).
 java.net.URL getResourceURL()
          Returns a URL for the resource.
 int hashCode()
           
protected  Resource newResource(java.lang.String path)
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.hivemind.util.AbstractResource
equals, getLocale, getName, getPath, getRelativeResource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContextResource

public ContextResource(javax.servlet.ServletContext context,
                       java.lang.String path)

ContextResource

public ContextResource(javax.servlet.ServletContext context,
                       java.lang.String path,
                       java.util.Locale locale)
Method Detail

getLocalization

public Resource getLocalization(java.util.Locale locale)
Locates the resource using LocalizedContextResourceFinder and ServletContext.getResource(java.lang.String).

Parameters:
locale - to localize for, or null for no localization.
Returns:
a localized version of this resource, of null if the resource itself does not exist.

getResourceURL

public java.net.URL getResourceURL()
Description copied from interface: Resource
Returns a URL for the resource.

Returns:
the URL for the resource if it exists, or null if it does not

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

newResource

protected Resource newResource(java.lang.String path)
Specified by:
newResource in class AbstractResource


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.