return URLTools.replaceURLsBy(markup, rewriter);
}
private org.gatein.pc.api.cache.CacheControl createCacheControl(MarkupContext markupContext)
{
CacheControl cacheControl = markupContext.getCacheControl();
org.gatein.pc.api.cache.CacheControl result = DEFAULT_CACHE_CONTROL;
int expires;
if (cacheControl != null)
{
expires = cacheControl.getExpires();
String userScope = cacheControl.getUserScope();
// check that we support the user scope...
if (consumer.supportsUserScope(userScope))
{
log.debug("RenderHandler.processRenderRequest: trying to cache markup " + userScope + " for " + expires + " seconds.");
CacheScope scope;
if (WSRPConstants.CACHE_FOR_ALL.equals(userScope))
{
scope = CacheScope.PUBLIC;
}
else if (WSRPConstants.CACHE_PER_USER.equals(userScope))
{
scope = CacheScope.PRIVATE;
}
else
{
throw new IllegalArgumentException("Unknown CacheControl user scope: " + userScope); // should not happen
}
result = new org.gatein.pc.api.cache.CacheControl(expires, scope, cacheControl.getValidateTag());
}
}
return result;
}