Search in sources :

Example 1 with IHeaderRenderStrategy

use of org.apache.wicket.markup.renderStrategy.IHeaderRenderStrategy in project wicket by apache.

the class PartialPageUpdate method writeHeaderContribution.

/**
 * @param response
 *      the response to write to
 * @param component
 *      to component which will contribute to the header
 */
protected void writeHeaderContribution(final Response response, final Component component) {
    headerRendering = true;
    // create the htmlheadercontainer if needed
    if (header == null) {
        header = new PartialHtmlHeaderContainer(this);
        page.addOrReplace(header);
    }
    RequestCycle requestCycle = component.getRequestCycle();
    // save old response, set new
    Response oldResponse = requestCycle.setResponse(headerBuffer);
    try {
        headerBuffer.reset();
        IHeaderRenderStrategy strategy = AbstractHeaderRenderStrategy.get();
        strategy.renderHeader(header, null, component);
    } finally {
        // revert to old response
        requestCycle.setResponse(oldResponse);
    }
    writeHeaderContribution(response);
    headerRendering = false;
}
Also used : WebResponse(org.apache.wicket.request.http.WebResponse) Response(org.apache.wicket.request.Response) HeaderResponse(org.apache.wicket.markup.head.internal.HeaderResponse) IHeaderResponse(org.apache.wicket.markup.head.IHeaderResponse) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) IRequestCycle(org.apache.wicket.request.IRequestCycle) IHeaderRenderStrategy(org.apache.wicket.markup.renderStrategy.IHeaderRenderStrategy)

Aggregations

IHeaderResponse (org.apache.wicket.markup.head.IHeaderResponse)1 HeaderResponse (org.apache.wicket.markup.head.internal.HeaderResponse)1 IHeaderRenderStrategy (org.apache.wicket.markup.renderStrategy.IHeaderRenderStrategy)1 IRequestCycle (org.apache.wicket.request.IRequestCycle)1 Response (org.apache.wicket.request.Response)1 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)1 WebResponse (org.apache.wicket.request.http.WebResponse)1