// Invoke
PortletInvocationResponse response = super.invoke(invocation);
// Try to cache any fragment result
CacheControl control = null;
if (response instanceof ContentResponse)
{
fragment = (ContentResponse)response;
control = fragment.getCacheControl();
}
else if (response instanceof RevalidateMarkupResponse)
{
RevalidateMarkupResponse revalidate = (RevalidateMarkupResponse)response;
control = revalidate.getCacheControl();
}
// Compute expiration time, i.e when it will expire
long expirationTimeMillis = 0;
String validationToken = null;
if (control != null)
{
if (control.getExpirationSecs() == -1)
{
expirationTimeMillis = Long.MAX_VALUE;
}
else if (control.getExpirationSecs() > 0)
{
expirationTimeMillis = System.currentTimeMillis() + control.getExpirationSecs() * 1000;
}
if (control.getValidationToken() != null)
{
validationToken = control.getValidationToken();
}
else if (cachedEntry != null)
{
validationToken = cachedEntry.validationToken;
}