Package org.apache.wicket.response

Examples of org.apache.wicket.response.StringResponse


   *
   * @return Response object. Must not be null
   */
  protected Response newResponse()
  {
    return new StringResponse();
  }
View Full Code Here


      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));
          }
        }
View Full Code Here

      add(header);

      Response orgResponse = getRequestCycle().getResponse();
      try
      {
        final StringResponse response = new StringResponse();
        getRequestCycle().setResponse(response);

        // Render all header sections of all components on the page
        AbstractHeaderRenderStrategy.get().renderHeader(header, null, getPage());
        response.close();

        if (response.getBuffer().length() > 0)
        {
          // @TODO it is not yet working properly. JDo to fix it
          log.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
          log.error("You probably forgot to add a <body> or <head> tag to your markup since no Header Container was \n" +
            "found but components were found which want to write to the <head> section.\n" +
            response.getBuffer());
          log.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        }
      }
      catch (Exception e)
      {
View Full Code Here

    if (filterName == null || !responseFilterMap.containsKey(filterName))
    {
      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

     * Prepare
     */
    @Before
    public void before()
    {
        final Response realResponse = new StringResponse();

        headerResponse = new HeaderResponse()
        {
            @Override
            protected Response getRealResponse()
View Full Code Here

 
  @Before
  public void before()
  {
    Request request = mock(Request.class);
    Response response = new StringResponse() {
      @Override
      public String encodeURL(CharSequence url)
      {
        return url + JSESSIONID;
      }
View Full Code Here

    final Response webResponse = getResponse();

    try
    {
      // 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
View Full Code Here

    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());
View Full Code Here

        attributes = new Attributes(cycle.getRequest(), cycle.getResponse());
      }
      else
      {
        // use empty request and response in case of non-http thread. WICKET-5532
        attributes = new Attributes(new MockWebRequest(Url.parse("")), new StringResponse());
      }
      byte[] processedBytes = processResponse(attributes, bytes);
      return new ByteArrayInputStream(processedBytes);
    }
View Full Code Here

      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));
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.wicket.response.StringResponse

Copyright © 2018 www.massapicom. 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.