org.apache.myfaces.test.mock.resource
Class MockResourceHandler

java.lang.Object
  extended by javax.faces.application.ResourceHandler
      extended by org.apache.myfaces.test.mock.resource.MockResourceHandler

public class MockResourceHandler
extends javax.faces.application.ResourceHandler

Mock implementation of ResourceHandler.

This ResourceHandler implementation try to follow the default algorithm defined by the spec, so it try to load resources using the current ExternalContext and the specified ClassLoader, in the same locations it is expected ("resources" and "META-INF/resources").

Since:
1.0.0
Version:
$Revision: 1604204 $ $Date: 2014-06-20 11:20:34 -0500 (Fri, 20 Jun 2014) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)

Field Summary
 
Fields inherited from class javax.faces.application.ResourceHandler
LOCALE_PREFIX, RESOURCE_EXCLUDES_DEFAULT_VALUE, RESOURCE_EXCLUDES_PARAM_NAME, RESOURCE_IDENTIFIER
 
Constructor Summary
MockResourceHandler()
           
MockResourceHandler(boolean extensionMapping, String mapping, ClassLoader classLoader)
           
MockResourceHandler(ClassLoader classLoader)
           
 
Method Summary
 javax.faces.application.Resource createResource(String resourceName)
           
 javax.faces.application.Resource createResource(String resourceName, String libraryName)
           
 javax.faces.application.Resource createResource(String resourceName, String libraryName, String contentType)
           
protected  MockResourceMeta deriveResourceMeta(MockResourceLoader resourceLoader, String resourceName, String libraryName)
          This method try to create a ResourceMeta for a specific resource loader.
protected  String getLocalePrefixForLocateResource()
           
 String getRendererTypeForResourceName(String resourceName)
           
 MockResourceHandlerSupport getResourceHandlerSupport()
           
 void handleResourceRequest(javax.faces.context.FacesContext context)
           
 boolean isResourceRequest()
           
 boolean isResourceRequest(javax.faces.context.FacesContext facesContext)
           
 boolean libraryExists(String libraryName)
           
 void setResourceHandlerSupport(MockResourceHandlerSupport resourceHandlerSupport)
           
 void setResourceRequest(boolean resourceRequest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockResourceHandler

public MockResourceHandler()

MockResourceHandler

public MockResourceHandler(ClassLoader classLoader)

MockResourceHandler

public MockResourceHandler(boolean extensionMapping,
                           String mapping,
                           ClassLoader classLoader)
Method Detail

createResource

public javax.faces.application.Resource createResource(String resourceName)
Specified by:
createResource in class javax.faces.application.ResourceHandler

createResource

public javax.faces.application.Resource createResource(String resourceName,
                                                       String libraryName)
Specified by:
createResource in class javax.faces.application.ResourceHandler

createResource

public javax.faces.application.Resource createResource(String resourceName,
                                                       String libraryName,
                                                       String contentType)
Specified by:
createResource in class javax.faces.application.ResourceHandler

deriveResourceMeta

protected MockResourceMeta deriveResourceMeta(MockResourceLoader resourceLoader,
                                              String resourceName,
                                              String libraryName)
This method try to create a ResourceMeta for a specific resource loader. If no library, or resource is found, just return null, so the algorithm in createResource can continue checking with the next registered ResourceLoader.


getRendererTypeForResourceName

public String getRendererTypeForResourceName(String resourceName)
Specified by:
getRendererTypeForResourceName in class javax.faces.application.ResourceHandler

handleResourceRequest

public void handleResourceRequest(javax.faces.context.FacesContext context)
                           throws IOException
Specified by:
handleResourceRequest in class javax.faces.application.ResourceHandler
Throws:
IOException

isResourceRequest

public boolean isResourceRequest(javax.faces.context.FacesContext facesContext)
Specified by:
isResourceRequest in class javax.faces.application.ResourceHandler

libraryExists

public boolean libraryExists(String libraryName)
Specified by:
libraryExists in class javax.faces.application.ResourceHandler

getLocalePrefixForLocateResource

protected String getLocalePrefixForLocateResource()

getResourceHandlerSupport

public MockResourceHandlerSupport getResourceHandlerSupport()

setResourceHandlerSupport

public void setResourceHandlerSupport(MockResourceHandlerSupport resourceHandlerSupport)

setResourceRequest

public void setResourceRequest(boolean resourceRequest)

isResourceRequest

public boolean isResourceRequest()


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