Examples of StringResponse


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

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

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

Examples of org.apache.wicket.response.StringResponse

   * @throws Exception
   */
  @Test
  public void writeLinkUrl() throws Exception
  {
    StringResponse response = new StringResponse();
    String url = "some/url;jsessionid=1234?with=parameters&p1=v1";
    String media = "some&bad&media";
    CssUtils.writeLinkUrl(response, url, media, "markupId");

    assertEquals("<link rel=\"stylesheet\" type=\"text/css\" href=\"some/url;jsessionid=1234?with=parameters&amp;p1=v1\" media=\"some&amp;bad&amp;media\" id=\"markupId\" />", response.toString());
  }
View Full Code Here

Examples of org.apache.wicket.response.StringResponse

   *
   * @return Response object. Must not be null
   */
  protected Response newResponse()
  {
    return new StringResponse();
  }
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, 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

Examples of org.apache.wicket.response.StringResponse

    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

Examples of org.apache.wicket.response.StringResponse

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

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

Examples of org.apache.wicket.response.StringResponse

 
  @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

Examples of org.apache.wicket.response.StringResponse

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