org.opencms.flex
Class CmsFlexRequestContextInfo

java.lang.Object
  extended by org.opencms.flex.CmsFlexRequestContextInfo

public class CmsFlexRequestContextInfo
extends java.lang.Object

Contains information about the OpenCms request context required by the Flex implementation.

An instance of this class is attached to every CmsRequestContext as an attribute as soon as the request context is wrapped in a flex response. Information about the "last modified" and "expire" times of VFS resources are stored in this Object.

Since:
6.0.0
Version:
$Revision: 1.13 $
Author:
Alexander Kandzior

Constructor Summary
CmsFlexRequestContextInfo()
          Public constructor.
 
Method Summary
 long getDateExpires()
          Returns the "expires" date for this context.
 long getDateLastModified()
          Returns the "last modified" date for this context.
 void merge(CmsFlexRequestContextInfo other)
          Merges this context info with the values from the other context info.
 void updateDateExpires(long dateExpires)
          Updates the "expires" date for this context with the given value.
 void updateDateLastModified(long dateLastModified)
          Updates the "last modified" date for this context with the given value.
 void updateDates(long dateLastModified, long dateExpires)
          Updates both the "last modified" and the "expires" date for this context with the given values.
 void updateFromResource(CmsResource resource)
          Updates the "last modified" date for this context as well as the "expires" date with the values from a given resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsFlexRequestContextInfo

public CmsFlexRequestContextInfo()
Public constructor.

Method Detail

getDateExpires

public long getDateExpires()
Returns the "expires" date for this context.

Returns:
the "expires" date for this context

getDateLastModified

public long getDateLastModified()
Returns the "last modified" date for this context.

Returns:
the "last modified" date for this context

merge

public void merge(CmsFlexRequestContextInfo other)
Merges this context info with the values from the other context info.

Parameters:
other - the context info to merge with

updateDateExpires

public void updateDateExpires(long dateExpires)
Updates the "expires" date for this context with the given value.

Parameters:
dateExpires - the value to update the "expires" date with

updateDateLastModified

public void updateDateLastModified(long dateLastModified)
Updates the "last modified" date for this context with the given value.

The currently stored value is only updated with the new value if the new value is either larger (i.e. newer) then the stored value, or if the new value is less then zero, which indicates that the "last modified" optimization can not be used because the element is dynamic.

Parameters:
dateLastModified - the value to update the "last modified" date with

updateDates

public void updateDates(long dateLastModified,
                        long dateExpires)
Updates both the "last modified" and the "expires" date for this context with the given values.

Parameters:
dateLastModified - the value to update the "last modified" date with
dateExpires - the value to update the "expires" date with

updateFromResource

public void updateFromResource(CmsResource resource)
Updates the "last modified" date for this context as well as the "expires" date with the values from a given resource.

The "expires" date is the calculated from the given date values of resource release and expiration and also the current time.

Parameters:
resource - the resource to use for updating the context values