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


  /**
   * @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

  /**
   * @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
   */
  public void respond(RequestCycle requestCycle)
  {
    WebResponse response = (WebResponse)requestCycle.getResponse();
    final String encoding = Application.get()
      .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.setDateHeader("Expires", System.currentTimeMillis());
    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("\"?><ajax-response></ajax-response>");
  }
View Full Code Here

  {
    IRequestTarget target = new IRequestTarget()
    {
      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 comps = getChoices(val);
        renderer.renderHeader(r);
        while (comps.hasNext())
        {
View Full Code Here

  {
    super.configureResponse();

    if (getWebRequestCycle().getResponse() instanceof WebResponse)
    {
      final WebResponse response = getWebRequestCycle().getWebResponse();
      setHeaders(response);
    }
  }
View Full Code Here

  /**
   * @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;
    }

    Iterator it = respondListeners.iterator();
    while (it.hasNext())
    {
      ITargetRespondListener listener = (ITargetRespondListener)it.next();
      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
    it = prependJavascripts.iterator();
    while (it.hasNext())
    {
      String js = (String)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 = (String)it.next();
      respondInvocation(response, js);
    }
    it = appendJavascripts.iterator();
    while (it.hasNext())
    {
      String js = (String)it.next();
      respondInvocation(response, js);
    }

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

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

        // this is to avoid https://issues.apache.org/jira/browse/WICKET-923 in Firefox
        final WebResponse response = getWebRequestCycle().getWebResponse();
        response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store");
    }
View Full Code Here

     * See: http://www.richardnichols.net/2010/03/apache-wicket-force-page-reload-to-fix-ajax-back/
     */
    @Override
    protected void configureResponse() {
        super.configureResponse();
        WebResponse response = getWebRequestCycle().getWebResponse();
        response.setHeader("Cache-Control",
              "no-cache, max-age=0,must-revalidate, no-store");
    }
View Full Code Here

      }
    }

    String url = getUrl(protocol.toString().toLowerCase(), port, request);

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

    // an attempt to rewrite a secure jsessionid into nonsecure, doesnt seem to work
    // Session session = Session.get();
    // if (!session.isTemporary())
    // {
    // response.addCookie(new Cookie("JSESSIONID", session.getId()));
    // }

    response.redirect(url);
  }
View Full Code Here

      }

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

      @Override
      protected void outputDevelopmentModeWarning()
      {
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.