Example #1
0
 /** @see java.lang.Object#equals(java.lang.Object) */
 @Override
 public boolean equals(final Object obj) {
   if (obj instanceof AjaxRequestHandler) {
     AjaxRequestHandler that = (AjaxRequestHandler) obj;
     return update.equals(that.update);
   }
   return false;
 }
Example #2
0
  /**
   * @see
   *     org.apache.wicket.core.request.handler.IPageRequestHandler#detach(org.apache.wicket.request.IRequestCycle)
   */
  @Override
  public void detach(final IRequestCycle requestCycle) {
    if (logData == null) {
      logData = new PageLogData(page);
    }

    update.detach(requestCycle);
  }
Example #3
0
  /**
   * @see
   *     org.apache.wicket.core.request.handler.IPageRequestHandler#respond(org.apache.wicket.request.IRequestCycle)
   */
  @Override
  public final void respond(final IRequestCycle requestCycle) {
    final RequestCycle rc = (RequestCycle) requestCycle;
    final WebResponse response = (WebResponse) requestCycle.getResponse();

    if (shouldRedirectToPage(requestCycle)) {
      // the page itself has been added to the request target, we simply issue a redirect
      // back to the page
      IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
      final String url = rc.urlFor(handler).toString();
      response.sendRedirect(url);
      return;
    }

    respondersFrozen = true;

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

    final Application app = page.getApplication();

    page.send(app, Broadcast.BREADTH, this);

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

    // Set content type based on markup type for page
    update.setContentType(response, encoding);

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

    final StringResponse bodyResponse = new StringResponse();
    update.writeTo(bodyResponse, encoding);
    CharSequence filteredResponse = invokeResponseFilters(bodyResponse);
    response.write(filteredResponse);
  }
Example #4
0
  private boolean shouldRedirectToPage(IRequestCycle requestCycle) {
    if (update.containsPage()) {
      return true;
    }

    if (((WebRequest) requestCycle.getRequest()).isAjax() == false) {
      // the request was not sent by wicket-ajax.js - this can happen when an Ajax request was
      // intercepted with #redirectToInterceptPage() and then the original request is re-sent
      // by the browser on a subsequent #continueToOriginalDestination()
      return true;
    }

    return false;
  }
Example #5
0
 @Override
 public IHeaderResponse getHeaderResponse() {
   return update.getHeaderResponse();
 }
Example #6
0
 @Override
 public final void prependJavaScript(CharSequence javascript) {
   update.prependJavaScript(javascript);
 }
Example #7
0
 /** @see java.lang.Object#hashCode() */
 @Override
 public int hashCode() {
   int result = "AjaxRequestHandler".hashCode();
   result += update.hashCode() * 17;
   return result;
 }
Example #8
0
 @Override
 public final Collection<? extends Component> getComponents() {
   return update.getComponents();
 }
Example #9
0
 @Override
 public void add(Component component, String markupId) {
   update.add(component, markupId);
 }