org.richfaces.resource
Class BaseResourceWrapper<T>

java.lang.Object
  extended by javax.faces.application.Resource
      extended by org.richfaces.resource.AbstractBaseResource
          extended by org.richfaces.resource.AbstractCacheableResource
              extended by org.richfaces.resource.BaseResourceWrapper<T>
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.FacesWrapper<T>, org.richfaces.resource.CacheableResource, org.richfaces.resource.VersionedResource
Direct Known Subclasses:
Java2DUserResourceWrapperImpl, UserResourceWrapperImpl

public abstract class BaseResourceWrapper<T>
extends AbstractCacheableResource
implements org.richfaces.resource.VersionedResource, javax.faces.component.StateHolder, javax.faces.FacesWrapper<T>

Author:
Nick Belaevski

Field Summary
 
Fields inherited from class org.richfaces.resource.AbstractBaseResource
URL_PROTOCOL
 
Fields inherited from class javax.faces.application.Resource
COMPONENT_RESOURCE_KEY
 
Constructor Summary
BaseResourceWrapper(T resourceObject, boolean cacheable, boolean versioned)
           
 
Method Summary
 String getEntityTag(javax.faces.context.FacesContext context)
           
 Date getExpires(javax.faces.context.FacesContext context)
          IMPORTANT: this method returned TTL in RF 3.x, now it returns expiration time
 Map<String,String> getResponseHeaders()
           
 int getTimeToLive(javax.faces.context.FacesContext context)
           
 String getVersion()
           
 T getWrapped()
           
protected abstract  Map<String,String> getWrappedResourceResponseHeaders()
           
 boolean isCacheable(javax.faces.context.FacesContext context)
           
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
 Object saveState(javax.faces.context.FacesContext context)
           
 void setTransient(boolean newTransientValue)
           
 
Methods inherited from class org.richfaces.resource.AbstractCacheableResource
addCacheControlResponseHeaders, isMatchesEntityTag, isMatchesEntityTag, isMatchesLastModified, isMatchesLastModified, setCacheable, userAgentNeedsUpdate
 
Methods inherited from class org.richfaces.resource.AbstractBaseResource
addNoCacheResponseHeaders, getClassLoader, getContentLength, getLastModified, getRequestPath, getURL
 
Methods inherited from class javax.faces.application.Resource
getContentType, getInputStream, getLibraryName, getResourceName, setContentType, setLibraryName, setResourceName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseResourceWrapper

public BaseResourceWrapper(T resourceObject,
                           boolean cacheable,
                           boolean versioned)
Method Detail

getWrappedResourceResponseHeaders

protected abstract Map<String,String> getWrappedResourceResponseHeaders()

getResponseHeaders

public Map<String,String> getResponseHeaders()
Overrides:
getResponseHeaders in class AbstractBaseResource

getVersion

public String getVersion()
Specified by:
getVersion in interface org.richfaces.resource.VersionedResource

isCacheable

public boolean isCacheable(javax.faces.context.FacesContext context)
Specified by:
isCacheable in interface org.richfaces.resource.CacheableResource
Overrides:
isCacheable in class AbstractCacheableResource

getExpires

public Date getExpires(javax.faces.context.FacesContext context)
Description copied from class: AbstractCacheableResource
IMPORTANT: this method returned TTL in RF 3.x, now it returns expiration time

Specified by:
getExpires in interface org.richfaces.resource.CacheableResource
Overrides:
getExpires in class AbstractCacheableResource
Returns:
Returns the expired.

getEntityTag

public String getEntityTag(javax.faces.context.FacesContext context)
Specified by:
getEntityTag in interface org.richfaces.resource.CacheableResource
Overrides:
getEntityTag in class AbstractCacheableResource

getTimeToLive

public int getTimeToLive(javax.faces.context.FacesContext context)
Specified by:
getTimeToLive in interface org.richfaces.resource.CacheableResource
Overrides:
getTimeToLive in class AbstractCacheableResource

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder

saveState

public Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

getWrapped

public T getWrapped()
Specified by:
getWrapped in interface javax.faces.FacesWrapper<T>


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.