org.broadleafcommerce.common.web.resource
Class AbstractGeneratedResourceHandler

java.lang.Object
  extended by org.broadleafcommerce.common.web.resource.AbstractGeneratedResourceHandler

public abstract class AbstractGeneratedResourceHandler
extends Object

An abstract GeneratedResourceHandler that is capable of responding to a single specified filename and generate contents for that filename. This abstract parent will handle caching of the generated resource.

Author:
Andre Azzolini (apazzolini)

Field Summary
protected  net.sf.ehcache.Cache generatedResourceCache
           
 
Constructor Summary
AbstractGeneratedResourceHandler()
           
 
Method Summary
abstract  boolean canHandle(String path)
           
abstract  org.springframework.core.io.Resource getFileContents(String path, List<org.springframework.core.io.Resource> locations)
           
protected  net.sf.ehcache.Cache getGeneratedResourceCache()
           
 org.springframework.core.io.Resource getResource(String path, List<org.springframework.core.io.Resource> locations)
          Attempts to retrive the requested resource from cache.
abstract  boolean isCachedResourceExpired(GeneratedResource cachedResource, String path, List<org.springframework.core.io.Resource> locations)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generatedResourceCache

protected net.sf.ehcache.Cache generatedResourceCache
Constructor Detail

AbstractGeneratedResourceHandler

public AbstractGeneratedResourceHandler()
Method Detail

canHandle

public abstract boolean canHandle(String path)
Parameters:
path -
Returns:
booelean determining whether or not this handler is able to handle the given request

getFileContents

public abstract org.springframework.core.io.Resource getFileContents(String path,
                                                                     List<org.springframework.core.io.Resource> locations)
Parameters:
path -
locations -
Returns:
the Resource representing this file

isCachedResourceExpired

public abstract boolean isCachedResourceExpired(GeneratedResource cachedResource,
                                                String path,
                                                List<org.springframework.core.io.Resource> locations)
Parameters:
cachedResource -
path -
locations -
Returns:
whether or not the given cachedResource needs to be regenerated

getResource

public org.springframework.core.io.Resource getResource(String path,
                                                        List<org.springframework.core.io.Resource> locations)
Attempts to retrive the requested resource from cache. If not cached, generates the resource, caches it, and then returns it

Parameters:
request -
location -
Returns:
the generated resource

getGeneratedResourceCache

protected net.sf.ehcache.Cache getGeneratedResourceCache()


Copyright © 2013. All Rights Reserved.