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

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

public class MockSimpleResourceHandler
extends javax.faces.application.ResourceHandler

Mock implementation of ResourceHandler.

This Mock could be used on situations where all resources are on a specific path.

Since:
1.0.0
Version:
$Revision: 882702 $ $Date: 2009-11-20 15:16:07 -0500 (Vie, 20 Nov 2009) $
Author:
Jakob Korherr (latest modification by $Author: lu4242 $)

Field Summary
protected static Pattern RESOURCE_VERSION_CHECKER
          It checks version like this: /1.js, /1_0.js, /1_0_0.js, /100_100.js

Used on getResourceVersion to filter resources

protected static Pattern VERSION_CHECKER
          It checks version like this: /1/, /1_0/, /1_0_0/, /100_100/

Used on getLibraryVersion to filter resource directories

 
Fields inherited from class javax.faces.application.ResourceHandler
LOCALE_PREFIX, RESOURCE_EXCLUDES_DEFAULT_VALUE, RESOURCE_EXCLUDES_PARAM_NAME, RESOURCE_IDENTIFIER
 
Constructor Summary
MockSimpleResourceHandler(File documentRoot)
           
 
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  String getLocalePrefixForLocateResource()
           
 String getRendererTypeForResourceName(String resourceName)
           
 void handleResourceRequest(javax.faces.context.FacesContext context)
           
 boolean isResourceRequest(javax.faces.context.FacesContext facesContext)
           
 boolean libraryExists(String libraryName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_CHECKER

protected static Pattern VERSION_CHECKER
It checks version like this: /1/, /1_0/, /1_0_0/, /100_100/

Used on getLibraryVersion to filter resource directories


RESOURCE_VERSION_CHECKER

protected static Pattern RESOURCE_VERSION_CHECKER
It checks version like this: /1.js, /1_0.js, /1_0_0.js, /100_100.js

Used on getResourceVersion to filter resources

Constructor Detail

MockSimpleResourceHandler

public MockSimpleResourceHandler(File documentRoot)
Parameters:
documentRoot - parent folder of resource directories. Must not be null
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

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()


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