Package org.apache.wicket.protocol.http

Examples of org.apache.wicket.protocol.http.WebResponse


  /**
   * @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
   */
  public final void respond(final RequestCycle requestCycle)
  {
    final WebResponse response = (WebResponse)requestCycle.getResponse();

    if (markupIdToComponent.values().contains(page))
    {
      // the page itself has been added to the request target, we simply issue a redirect back
      // to the page
      final String url = requestCycle.urlFor(page).toString();
      response.redirect(url);
      return;
    }

    for (ITargetRespondListener listener : respondListeners)
    {
      listener.onTargetRespond(this);
    }

    final Application app = Application.get();

    // Determine encoding
    final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();

    // Set content type based on markup type for page
    response.setCharacterEncoding(encoding);
    response.setContentType("text/xml; charset=" + encoding);

    // Make sure it is not cached by a client
    response.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
    response.setHeader("Cache-Control", "no-cache, must-revalidate");
    response.setHeader("Pragma", "no-cache");

    response.write("<?xml version=\"1.0\" encoding=\"");
    response.write(encoding);
    response.write("\"?>");
    response.write("<ajax-response>");

    // invoke onbeforerespond event on listeners
    fireOnBeforeRespondListeners();

    // normal behavior
    Iterator<String> it = prependJavascripts.iterator();
    while (it.hasNext())
    {
      String js = it.next();
      respondInvocation(response, js);
    }

    // process added components
    respondComponents(response);

    fireOnAfterRespondListeners(response);

    // execute the dom ready javascripts as first javascripts
    // after component replacement
    it = domReadyJavascripts.iterator();
    while (it.hasNext())
    {
      String js = it.next();
      respondInvocation(response, js);
    }
    it = appendJavascripts.iterator();
    while (it.hasNext())
    {
      String js = it.next();
      respondInvocation(response, js);
    }

    response.write("</ajax-response>");
  }
View Full Code Here


    {

      public void respond(RequestCycle requestCycle)
      {

        WebResponse r = (WebResponse)requestCycle.getResponse();

        // Determine encoding
        final String encoding = Application.get()
          .getRequestCycleSettings()
          .getResponseRequestEncoding();
        r.setCharacterEncoding(encoding);
        r.setContentType("text/xml; charset=" + encoding);

        // Make sure it is not cached by a
        r.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
        r.setHeader("Cache-Control", "no-cache, must-revalidate");
        r.setHeader("Pragma", "no-cache");

        Iterator<T> comps = getChoices(val);
        renderer.renderHeader(r);
        while (comps.hasNext())
        {
View Full Code Here

    try
    {
      // preventing the response to component from being cached
      if (requestCycle.getResponse() instanceof WebResponse)
      {
        WebResponse response = (WebResponse)requestCycle.getResponse();
        response.disableCaching();
      }
      // Let pages render itself
      if (component instanceof Page)
      {
        // Use the default Page request target, if component is a Page
View Full Code Here

    // Determine encoding
    final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();

    // Set content type based on markup type for page
    final WebResponse response = (WebResponse)requestCycle.getResponse();
    response.setCharacterEncoding(encoding);
    response.setContentType("text/xml; charset=" + encoding);

    // Make sure it is not cached by a client
    response.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
    response.setHeader("Cache-Control", "no-cache, must-revalidate");
    response.setHeader("Pragma", "no-cache");

    response.write("<?xml version=\"1.0\" encoding=\"");
    response.write(encoding);
    response.write("\"?>");
    response.write("<ajax-response>");

    // invoke onbeforerespond event on listeners
    fireOnBeforeRespondListeners();

    // normal behavior
    Iterator<String> it = prependJavascripts.iterator();
    while (it.hasNext())
    {
      String js = it.next();
      respondInvocation(response, js);
    }

    // process added components
    respondComponents(response);

    fireOnAfterRespondListeners(response);

    // execute the dom ready javascripts as first javascripts
    // after component replacement
    it = domReadyJavascripts.iterator();
    while (it.hasNext())
    {
      String js = it.next();
      respondInvocation(response, js);
    }
    it = appendJavascripts.iterator();
    while (it.hasNext())
    {
      String js = it.next();
      respondInvocation(response, js);
    }

    response.write("</ajax-response>");
  }
View Full Code Here

        return ConcretePage2.class;
      }
     
      protected WebResponse newWebResponse(HttpServletResponse servletResponse)
      {
        return new WebResponse(servletResponse);
      }
     
      protected void outputDevelopmentModeWarning()
      {
        // Do nothing.
View Full Code Here

  protected void configureResponse()
  {
    super.configureResponse();

    if (getWebRequestCycle().getResponse() instanceof WebResponse) {
      final WebResponse response = getWebRequestCycle().getWebResponse();
      response.setHeader("Pragma", "no-cache");
      response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate"); // no-store
    }
  }
View Full Code Here

        return homePage;
      }

      protected WebResponse newWebResponse(final HttpServletResponse servletResponse)
      {
        return new WebResponse(servletResponse);
      }

      protected void outputDevelopmentModeWarning()
      {
        // Do nothing.
View Full Code Here

    /**
     * @see org.apache.wicket.protocol.http.WebApplication#newWebResponse(javax.servlet.http.HttpServletResponse)
     */
    protected WebResponse newWebResponse(final HttpServletResponse servletResponse)
    {
      return new WebResponse(servletResponse);
    }
View Full Code Here

    // Determine encoding
    final String encoding = app.getRequestCycleSettings().getResponseRequestEncoding();

    // Set content type based on markup type for page
    final WebResponse response = (WebResponse)requestCycle.getResponse();
    response.setCharacterEncoding(encoding);
    response.setContentType("text/xml; charset=" + encoding);

    // Make sure it is not cached by a client
    response.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
    response.setHeader("Cache-Control", "no-cache, must-revalidate");
    response.setHeader("Pragma", "no-cache");

    response.write("<?xml version=\"1.0\" encoding=\"");
    response.write(encoding);
    response.write("\"?>");
    response.write("<ajax-response>");

    // invoke onbeforerespond event on listeners
    fireOnBeforeRespondListeners();

    // normal behavior
    Iterator it = prependJavascripts.iterator();
    while (it.hasNext())
    {
      String js = (String)it.next();
      respondInvocation(response, js);
    }

    // process added components
    respondComponents(response);

    fireOnAfterRespondListeners(response);

    it = appendJavascripts.iterator();
    while (it.hasNext())
    {
      String js = (String)it.next();
      respondInvocation(response, js);
    }

    response.write("</ajax-response>");
  }
View Full Code Here

   *
   * @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
   */
  public void respond(RequestCycle requestCycle)
  {
    WebResponse webResponse = ((WebRequestCycle)requestCycle).getWebResponse();
    HttpServletResponse httpServletResponse = webResponse.getHttpServletResponse();
    try
    {
      if (message != null)
      {
        httpServletResponse.sendError(errorCode, message);
View Full Code Here

TOP

Related Classes of org.apache.wicket.protocol.http.WebResponse

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.