Package org.zkoss.zk.ui.sys

## Interface PageRenderPatch

-     public interface PageRenderPatch

  A patch that is used to process the rendering result of a page. Currently, it is used only by `DHtmlLayoutPortlet` to allow the deployer to plug-in a patch for particular portal container.

  To specify a patch, use a library property called "org.zkoss.zk.portlet.PageRenderPatch.class" (refer to `Attributes.PORTLET_RENDER_PATCH_CLASS`.

  Since:
    5.0.0
  Author:
    tomyeh

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.io.Writer` | `beforeRender​(RequestInfo reqInfo)` | Called before rendering to test if the patch shall be applied.
    `void` | `patchRender​(RequestInfo reqInfo, Page page, java.io.Writer result, java.io.Writer out)` | Called after rendering to patch the result.

- - ### Method Detail

    - #### beforeRender

          java.io.Writer beforeRender​(RequestInfo reqInfo)

      Called before rendering to test if the patch shall be applied.
      Parameters:
        `reqInfo` - the request information
      Returns:
        null if no need of patch, or a writer if the patch is required. The writer will be used to hold the rendering result of the portlet. Thus, you can process it later in `patchRender(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.Page, java.io.Writer, java.io.Writer)` (so the writer is usually an instance of StringWriter).

    - #### patchRender

          void patchRender​(RequestInfo reqInfo,
                           Page page,
                           java.io.Writer result,
                           java.io.Writer out)
                    throws java.io.IOException

      Called after rendering to patch the result. If `beforeRender(org.zkoss.zk.ui.sys.RequestInfo)` returns null, this method won't be called since nothing to patch.

      If `beforeRender(org.zkoss.zk.ui.sys.RequestInfo)` returns a writer, the writer will become the result argument.

      Parameters:
        `reqInfo` - the request information
        `result` - the result returned by `beforeRender(org.zkoss.zk.ui.sys.RequestInfo)`, and the rendering result of a page will be written to it.
        `out` - the real output sent to the client. It is the writer to write the patched result to.
      Throws:
        `java.io.IOException`