Package org.apache.wicket.response

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
      renderHeaderSections(getPage(), this);
      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


      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
        renderHead(header);

        // Make sure all Components interested in contributing to the header
        // and there attached behaviors are asked.
        final HtmlHeaderContainer finalHeader = header;
        visitChildren(new IVisitor<Component>()
        {
          /**
           * @see org.apache.wicket.Component.IVisitor#component(org.apache.wicket.Component)
           */
          public Object component(Component component)
          {
            component.renderHead(finalHeader);
            return CONTINUE_TRAVERSAL;
          }
        });
        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 <header> 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

   * @see org.apache.wicket.request.target.component.BookmarkablePageRequestTarget#respond(org.apache.wicket.RequestCycle)
   */
  @Override
  public void respond(RequestCycle requestCycle)
  {
    final StringResponse emailResponse = new StringResponse();
    final WebResponse originalResponse = (WebResponse)RequestCycle.get().getResponse();
    RequestCycle.get().setResponse(emailResponse);
    super.respond(requestCycle);
    onCapture(emailResponse);
    RequestCycle.get().setResponse(originalResponse);
View Full Code Here

  private final StringResponse bufferedResponse;

  public EmbeddedPortletHeaderResponse(Response realResponse)
  {
    this.realResponse = realResponse;
    bufferedResponse = new StringResponse();
  }
View Full Code Here

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

      try
      {
        final StringResponse bodyResponse = new StringResponse();
        contructResponseBody(bodyResponse, encoding);
        CharSequence filteredResponse = invokeResponseFilters(bodyResponse);
        response.write(filteredResponse);
      }
      finally
View Full Code Here

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

    try
    {
      final StringResponse bodyResponse = new StringResponse();
      constructResponseBody(bodyResponse, encoding);
      CharSequence filteredResponse = invokeResponseFilters(bodyResponse);
      response.write(filteredResponse);
    }
    finally
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, 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

    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
      AbstractHeaderRenderStrategy.get().renderHeader(this, getPage());

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

      // 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(markupStream, openTag);
View Full Code Here

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

      try
      {
        final StringResponse bodyResponse = new StringResponse();
        constructResponseBody(bodyResponse, encoding);
        CharSequence filteredResponse = invokeResponseFilters(bodyResponse);
        response.write(filteredResponse);
      }
      finally
View Full Code Here

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

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

              Component component = getParent().get(id);
              if (component == null)
              {
                component = ComponentResolvers.resolve(getParent(), markupStream,
                  currentTag, null);

                // Must not be a Page and it must be connected to a parent.
                if (component.getParent() == null)
                {
                  component = null;
                }
              }

              if (component != null)
              {
                component.render();
                markupStream.skipComponent();
              }
              else
              {
                markupStream.next();
              }
              childTags.put(id, response.getBuffer());
            }
            finally
            {
              // Restore the original response
              getRequestCycle().setResponse(webResponse);
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.