org.broadleafcommerce.openadmin.web.resource
Class AbstractGeneratedResourceHandler

java.lang.Object
  extended by org.broadleafcommerce.openadmin.web.resource.AbstractGeneratedResourceHandler
Direct Known Subclasses:
RuleBuilderEnumOptionsResourceHandler

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  String getFileContents()
           
protected  net.sf.ehcache.Cache getGeneratedResourceCache()
           
abstract  String getHandledFileName()
          For example, if the application is deployed under the "test" context and you want to handle the request for http://localhost/test/js/myFile.js, this method should return the String "/js/myFile.js".
 org.springframework.core.io.Resource getResource(javax.servlet.http.HttpServletRequest request)
          Attempts to retrive the requested resource from cache.
 
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

getResource

public org.springframework.core.io.Resource getResource(javax.servlet.http.HttpServletRequest request)
Attempts to retrive the requested resource from cache. If not cached, generates the resource, caches it, and then returns it

Parameters:
request -
Returns:
the generated resource

getHandledFileName

public abstract String getHandledFileName()
For example, if the application is deployed under the "test" context and you want to handle the request for http://localhost/test/js/myFile.js, this method should return the String "/js/myFile.js".

Returns:
the servlet-context-based file name to handle.

getFileContents

public abstract String getFileContents()
Returns:
the String representation of the contents of this generated file

getGeneratedResourceCache

protected net.sf.ehcache.Cache getGeneratedResourceCache()


Copyright © 2013. All Rights Reserved.