Examples of StringResponse


Examples of org.apache.wicket.response.StringResponse

    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

Examples of org.apache.wicket.response.StringResponse

        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

Examples of org.apache.wicket.response.StringResponse

      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

Examples of org.apache.wicket.response.StringResponse

      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, 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

Examples of org.apache.wicket.response.StringResponse

    // Temporarily replace the web response with a String response
    final Response webResponse = getResponse();

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

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

      // In any case, first render the header section directly associated
      // with the markup
      super.onComponentTagBody(markupStream, openTag);

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

      // Automatically add <head> if necessary
      CharSequence output = response.getBuffer();
      if (output.length() > 0)
      {
        if (output.charAt(0) == '\r')
        {
          for (int i = 2; i < output.length(); i += 2)
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

    responseObject.setContentType(response, encoding);

    // Make sure it is not cached by a client
    response.disableCaching();

    final StringResponse bodyResponse = new StringResponse();
    responseObject.writeTo(bodyResponse, encoding);
    CharSequence filteredResponse = invokeResponseFilters(bodyResponse);
    response.write(filteredResponse);
  }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

    {
      return;
    }
    for (IHeaderResponseFilter filter : filters)
    {
      responseFilterMap.put(filter.getName(), new StringResponse());
    }
  }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

  {
    if (filterName == null)
    {
      return "";
    }
    StringResponse resp = responseFilterMap.get(filterName);
    return resp == null ? "" : resp.getBuffer();
  }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

      // Make sure it is not cached by a client
      response.disableCaching();

      try
      {
        final StringResponse bodyResponse = new StringResponse();
        contructResponseBody(bodyResponse, encoding);
        invokeResponseFilters(bodyResponse);
        response.write(bodyResponse.getBuffer());
      }
      finally
      {
        // restore the original response
        RequestCycle.get().setResponse(response);
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

   * @throws Exception
   */
  @Test
  public void writeJavaScriptUrl() throws Exception
  {
    StringResponse response = new StringResponse();
    String url = "some/url;jsessionid=1234?p1=v1&p2=v2";
    String id = "some&bad%id";
    boolean defer = true;
    String charset = "some&bad%%charset";
    JavaScriptUtils.writeJavaScriptUrl(response, url, id, defer, charset);

    assertEquals("<script type=\"text/javascript\" id=\"some&amp;bad%id\" defer=\"defer\" charset=\"some&amp;bad%%charset\" src=\"some/url;jsessionid=1234?p1=v1&p2=v2\"></script>\n", response.toString());
  }
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.