public class CachedRenderer extends WrappedRenderer
<block name="statistics_uncached"
mimetype="text/html">
<body>
<class name="org.mmbase.framework.ResourceRenderer">
<param name="resource">documentation/mmstatistics.xml</param>
<param name="type">config</param>
<param name="xslt">xslt/docbook2block.xslt</param>
</class>
</body>
</block>
<block name="statistics"
classification="mmbase.documentation"
mimetype="text/html">
<body>
<class name="org.mmbase.framework.CachedRenderer">
<param name="wrapsBlock">statistics_uncached</param>
<param name="includeRenderTime">xml-comments</param>
</class>
</body>
</block>
*
Caching can be based on an 'expires' property. If that is not specified, caching will happen according the HTTP specifications on the URI returned by Renderer.getUri().Renderer.Typewrappedtype| Constructor and Description |
|---|
CachedRenderer(Renderer.Type t,
Block parent) |
| Modifier and Type | Method and Description |
|---|---|
protected File |
getCacheFile(Parameters blockParameters,
RenderHints hints) |
protected File |
getETagFile(File file) |
protected File |
getExpiresFile(File file) |
protected String |
getKey(Parameters blockParameters) |
protected String |
readETag(File f) |
protected long |
readExpires(File f) |
void |
render(Parameters blockParameters,
Writer w,
RenderHints hints)
Renders to a writer.
|
protected void |
renderFile(File f,
Writer w) |
protected void |
renderWrappedAndFile(File f,
Parameters blockParameters,
Writer w,
RenderHints hints,
Runnable ready)
Renders the wrapped renderer, and writes the result to both a file, and to the writer.
|
void |
setDirectory(String d) |
void |
setExpires(int e) |
void |
setIncludeRenderTime(String type) |
void |
setTimeout(int t)
If using an HttpURLConnection, then use the given timeout.
|
void |
setWait(int t)
If rendering of the cached renderer takes very long, you may choose to not wait for the
result.
|
String |
toString() |
protected void |
writeETag(File f,
String etag) |
protected void |
writeExpires(File f,
long expires) |
protected void |
writeRenderTime(Date time,
Writer w) |
getParameters, getUri, getWraps, setWraps, setWrapsBlockdecorateIntro, decorateOutro, getBlock, getType, getUripublic CachedRenderer(Renderer.Type t, Block parent)
public void setExpires(int e)
public void setDirectory(String d)
public void setTimeout(int t)
t - Timeout in millisecondspublic void setWait(int t)
t - Wait-time in millisecondspublic void setIncludeRenderTime(String type)
protected void writeRenderTime(Date time, Writer w) throws FrameworkException, IOException
FrameworkExceptionIOExceptionprotected String getKey(Parameters blockParameters)
protected File getCacheFile(Parameters blockParameters, RenderHints hints)
protected void writeETag(File f, String etag) throws IOException
IOExceptionprotected String readETag(File f) throws IOException
IOExceptionprotected void writeExpires(File f, long expires) throws IOException
IOExceptionprotected long readExpires(File f) throws IOException
IOExceptionprotected void renderFile(File f, Writer w) throws FrameworkException, IOException
FrameworkExceptionIOExceptionprotected void renderWrappedAndFile(File f, Parameters blockParameters, Writer w, RenderHints hints, Runnable ready) throws FrameworkException, IOException
FrameworkExceptionIOExceptionpublic void render(Parameters blockParameters, Writer w, RenderHints hints) throws FrameworkException
Rendererrender in interface Rendererrender in class WrappedRendererFrameworkExceptionpublic String toString()
toString in class WrappedRendererMMBase 1.9-SNAPSHOT - ${javadoctimestamp}