org.apache.myfaces.renderkit.html.util
Interface ResourceHandler

All Known Implementing Classes:
MyFacesResourceHandler, ParameterResourceHandler, StreamingResourceHandler

public interface ResourceHandler

Represents a single resource that a component in a page needs a browser to fetch. This class helps generate the URI that is emitted into the page, and specifies the class that should be invoked to handle the request for that URI when the browser makes it.

Author:
Mathias Broekelmann

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.
 

Method Detail

getResourceLoaderClass

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. 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.

Returns:
a class which implements org.apache.myfaces.component.html.util.ResourceLoader
See Also:
ResourceLoader

getResourceUri

String getResourceUri(javax.faces.context.FacesContext context)
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.

See Also:
ResourceLoader.serveResource(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, String)

hashCode

int hashCode()
Must always be implemented when equals is overridden.

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

boolean equals(Object obj)
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.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)


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