示例#1
0
  @Override
  protected void onDetach() {
    super.onDetach();

    renderedComponentsPerScope = null;
    headerResponse = null;
  }
示例#2
0
  /**
   * Renders the content of the <head> section of the page, including <wicket:head>
   * sections in subclasses of the page. For every child-component, the content is rendered to a
   * string and passed to {@link IHeaderResponse}.
   *
   * @param headerStreamState
   */
  public void renderHeaderTagBody(HeaderStreamState headerStreamState) {
    if (headerStreamState == null) return;

    final Response oldResponse = getRequestCycle().getResponse();
    try {
      // Create a separate (string) response for the header container itself
      final StringResponse bodyResponse = new StringResponse();
      getRequestCycle().setResponse(bodyResponse);

      // render the header section directly associated with the markup
      super.onComponentTagBody(headerStreamState.getMarkupStream(), headerStreamState.getOpenTag());
      CharSequence bodyOutput = getCleanResponse(bodyResponse);
      if (bodyOutput.length() > 0) {
        getHeaderResponse().render(StringHeaderItem.forString(bodyOutput));
      }
    } finally {
      getRequestCycle().setResponse(oldResponse);
    }
  }