org.apache.myfaces.component.html.util
Class ParameterResourceHandler

java.lang.Object
  extended by org.apache.myfaces.component.html.util.ParameterResourceHandler
All Implemented Interfaces:
ResourceHandler

public class ParameterResourceHandler
extends Object
implements ResourceHandler

Author:
Mathias Broekelmann

Constructor Summary
ParameterResourceHandler(Class resourceLoaderClass, Map parameters)
           
 
Method Summary
 boolean equals(Object obj)
          Must be implemented to avoid loading the same resource multiple times.
 Class getResourceLoaderClass()
          Return a Class object whose instance can decode the url generated by this class in the getResourceUri method and use that info to locate the resource data represented by this object.
 String getResourceUri(javax.faces.context.FacesContext context)
          Returns the uri part which is used by the resourceloader to identify the resource to load.
 int hashCode()
          Must always be implemented when equals is overridden.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParameterResourceHandler

public ParameterResourceHandler(Class resourceLoaderClass,
                                Map parameters)
Parameters:
resourceLoaderClass -
parameters -
Method Detail

getResourceLoaderClass

public Class getResourceLoaderClass()
Description copied from interface: ResourceHandler
Return a Class object whose instance can decode the url generated by this class in the getResourceUri method and use that info to locate the resource data represented by this object. When a browser requests the data in the URL generated by this class and its callers, an instance of the returned class shall be created to decode the remainder of the url and serve the resource.

Specified by:
getResourceLoaderClass in interface ResourceHandler
Returns:
a class which implements org.apache.myfaces.component.html.util.ResourceLoader
See Also:
ResourceHandler.getResourceLoaderClass()

getResourceUri

public String getResourceUri(javax.faces.context.FacesContext context)
Description copied from interface: ResourceHandler
Returns the uri part which is used by the resourceloader to identify the resource to load. This URI will be interpreted by an instance of the class returned by getResourceLoaderClass.

Specified by:
getResourceUri in interface ResourceHandler
See Also:
ResourceHandler.getResourceUri(javax.faces.context.FacesContext)

equals

public boolean equals(Object obj)
Description copied from interface: ResourceHandler
Must be implemented to avoid loading the same resource multiple times.

When the same component is used multiple times in a page and that component needs an external resource such as a script, multiple calls will be made to the AddResource methods for the same resource. The AddResource class will create an instance of this class for each such call. However if there is already a ResourceHandler instance existing which is "equal" to the newly created one then a duplicate will not be queued for output.

Specified by:
equals in interface ResourceHandler
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Description copied from interface: ResourceHandler
Must always be implemented when equals is overridden.

Specified by:
hashCode in interface ResourceHandler
Overrides:
hashCode in class Object
See Also:
Object.hashCode()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.