Examples of IHeaderResponse


Examples of org.apache.wicket.markup.head.IHeaderResponse

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: {}", toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
        finally
        {
          RequestCycle.get().setResponse(oldResponse);
        }
        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            List<IClusterable> pair = Arrays.asList(this, behavior);
            response.markRendered(pair);
          }
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: {}", toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
        finally
        {
          RequestCycle.get().setResponse(oldResponse);
        }
        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Then ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            List<IClusterable> pair = Arrays.asList(this, behavior);
            response.markRendered(pair);
          }
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: {}", toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
        finally
        {
          RequestCycle.get().setResponse(oldResponse);
        }
        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            List<IClusterable> pair = Arrays.asList(this, behavior);
            response.markRendered(pair);
          }
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

      if (log.isDebugEnabled())
      {
        log.debug("internalRenderHead: {}", toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
        finally
        {
          RequestCycle.get().setResponse(oldResponse);
        }
        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Then ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            List<IClusterable> pair = Arrays.asList(this, behavior);
            response.markRendered(pair);
          }
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

   *            the response Wicket created
   * @return the response Wicket should use in IHeaderContributor traversal
   */
  public final IHeaderResponse decorateHeaderResponse(final IHeaderResponse response)
  {
    final IHeaderResponse aggregatingResponse = new ResourceAggregator(response);

    if (headerResponseDecorator == null)
    {
      return aggregatingResponse;
    }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

    if (Application.exists())
    {
      HeaderContributorListenerCollection headerContributorListenerCollection =
          Application.get().getHeaderContributorListeners();
      IHeaderResponse headerResponse = headerContainer.getHeaderResponse();

      for (IHeaderContributor listener : headerContributorListenerCollection)
      {
        listener.renderHead(headerResponse);
      }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: {}", toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
        finally
        {
          RequestCycle.get().setResponse(oldResponse);
        }
        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            response.markRendered(behavior);
          }
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

    {
      return "";
    }
    List<HeaderItem> resp = responseFilterMap.get(filterName);
    final StringResponse strResponse = new StringResponse();
    IHeaderResponse headerRenderer = new HeaderResponse()
    {
      @Override
      protected Response getRealResponse()
      {
        return strResponse;
      }
    };

    if (Application.get().getResourceSettings().getUseDefaultResourceAggregator())
      headerRenderer = new ResourceAggregator(headerRenderer);

    for (HeaderItem curItem : resp)
    {
      headerRenderer.render(curItem);
    }
    headerRenderer.close();
    return strResponse.getBuffer();
  }
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

    {
      // Create a (string) response for all headers contributed by any component on the Page.
      final StringResponse response = new StringResponse();
      getRequestCycle().setResponse(response);

      IHeaderResponse headerResponse = getHeaderResponse();
      if (!response.equals(headerResponse.getResponse()))
      {
        getRequestCycle().setResponse(headerResponse.getResponse());
      }

      // Render the header sections of all components on the page
      AbstractHeaderRenderStrategy.get().renderHeader(this,
        new HeaderStreamState(markupStream, openTag), getPage());

      // Close the header response before rendering the header container itself
      // See https://issues.apache.org/jira/browse/WICKET-3728
      headerResponse.close();

      // Cleanup extraneous CR and LF from the response
      CharSequence output = getCleanResponse(response);

      // Automatically add <head> if necessary
View Full Code Here

Examples of org.apache.wicket.markup.head.IHeaderResponse

   *            the response Wicket created
   * @return the response Wicket should use in IHeaderContributor traversal
   */
  public final IHeaderResponse decorateHeaderResponse(final IHeaderResponse response)
  {
    final IHeaderResponse aggregatingResponse = new ResourceAggregator(response);

    if (headerResponseDecorator == null)
    {
      return aggregatingResponse;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.