Package org.apache.wicket

Examples of org.apache.wicket.RequestCycle


    }

    @Override
    protected void respond(AjaxRequestTarget target)
    {
      RequestCycle requestCycle = RequestCycle.get();
      boolean save = Boolean.valueOf(requestCycle.getRequest().getParameter("save"))
        .booleanValue();

      if (save)
      {
        editor.processInput();
View Full Code Here


   * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget)
   */
  @Override
  protected void respond(AjaxRequestTarget target)
  {
    final RequestCycle requestCycle = RequestCycle.get();
    final String val = requestCycle.getRequest().getParameter("q");
    onRequest(val, requestCycle);
  }
View Full Code Here

   * @param url
   *            The url which describes the component path and the interface to be called.
   */
  private void dispatchEvent(final Page page, final String url)
  {
    RequestCycle rc = RequestCycle.get();
    IRequestCycleProcessor processor = rc.getProcessor();
    final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode(
      new FormDispatchRequest(rc.getRequest(), url));
    IRequestTarget rt = processor.resolve(rc, requestParameters);
    if (rt instanceof IListenerInterfaceRequestTarget)
    {
      IListenerInterfaceRequestTarget interfaceTarget = ((IListenerInterfaceRequestTarget)rt);
      interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget());
View Full Code Here

    totalCreatedSessions.incrementAndGet();
  }

  RequestData getCurrentRequest()
  {
    RequestCycle requestCycle = RequestCycle.get();
    RequestData rd = requestCycle.getMetaData(REQUEST_DATA);
    if (rd == null)
    {
      rd = new RequestData();
      requestCycle.setMetaData(REQUEST_DATA, rd);
      active.incrementAndGet();
    }
    return rd;
  }
View Full Code Here

   * @param url
   *            The url which describes the component path and the interface to be called.
   */
  private void dispatchEvent(final Page page, final String url)
  {
    RequestCycle rc = RequestCycle.get();
    IRequestCycleProcessor processor = rc.getProcessor();
    final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode(
      new FormDispatchRequest(rc.getRequest(), url));
    IRequestTarget rt = processor.resolve(rc, requestParameters);
    if (rt instanceof ListenerInterfaceRequestTarget)
    {
      ListenerInterfaceRequestTarget interfaceTarget = ((ListenerInterfaceRequestTarget)rt);
      interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget());
View Full Code Here

          .getResponseRequestEncoding());

        createRequestContext(request, response);

        // Create request cycle
        final RequestCycle cycle = webApplication.newRequestCycle(request, response);

        try
        {
          // Process request
          cycle.request();

          return cycle.wasHandled();
        }
        catch (AbortException e)
        {
          // noop
        }
View Full Code Here

  /**
   * @see org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy#matches(java.lang.String)
   */
  public boolean matches(String path)
  {
    RequestCycle rc = RequestCycle.get();

    // the null check is necessary, as this method is first time called from WicketFilter when
    // no RequestCycle exists yet
    if (rc != null && ((WebRequest)rc.getRequest()).isAjax())
    {
      // HybridUrlCodingStrategy doesn't make sense for ajax request
      return false;
    }

View Full Code Here

      }

      AjaxLink link = (AjaxLink)linkComponent;

      setupRequestAndResponse(true);
      RequestCycle requestCycle = createRequestCycle();
      callOnBeginRequest(requestCycle);
      AjaxRequestTarget target = new AjaxRequestTarget(link.getPage());
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
      target.respond(requestCycle);
      requestCycle.detach();
    }
    // AjaxFallbackLinks is processed like an AjaxLink if isAjax is true
    // If it's not handling of the linkComponent is passed through to the
    // Link.
    else if (linkComponent instanceof AjaxFallbackLink && isAjax)
    {
      AjaxFallbackLink link = (AjaxFallbackLink)linkComponent;

      setupRequestAndResponse(true);
      RequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = new AjaxRequestTarget(link.getPage());
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
      target.respond(requestCycle);
      requestCycle.detach();
    }
    // if the link is an AjaxSubmitLink, we need to find the form
    // from it using reflection so we know what to submit.
    else if (linkComponent instanceof AjaxSubmitLink)
    {
      // If it's not ajax we fail
      if (isAjax == false)
      {
        fail("Link " + path + "is an AjaxSubmitLink and " +
          "will not be invoked when AJAX (javascript) is disabled.");
      }

      AjaxSubmitLink link = (AjaxSubmitLink)linkComponent;

      // We cycle through the attached behaviors and select the
      // LAST matching behavior as the one we handle.
      List behaviors = link.getBehaviors();
      AjaxFormSubmitBehavior ajaxFormSubmitBehavior = null;
      for (Iterator iter = behaviors.iterator(); iter.hasNext();)
      {
        Object behavior = iter.next();
        if (behavior instanceof AjaxFormSubmitBehavior)
        {
          AjaxFormSubmitBehavior submitBehavior = (AjaxFormSubmitBehavior)behavior;
          ajaxFormSubmitBehavior = submitBehavior;
        }
      }

      String failMessage = "No form submit behavior found on the submit link. Strange!!";
      notNull(failMessage, ajaxFormSubmitBehavior);

      setupRequestAndResponse(true);
      RequestCycle requestCycle = createRequestCycle();

      submitAjaxFormSubmitBehavior(ajaxFormSubmitBehavior);

      // Ok, finally we "click" the link
      ajaxFormSubmitBehavior.onRequest();

      // process the request target
      requestCycle.getRequestTarget().respond(requestCycle);
      requestCycle.detach();
    }
    /*
     * If the link is a submitlink then we pretend to have clicked it
     */
    else if (linkComponent instanceof SubmitLink)
View Full Code Here

   * @return {@link AjaxRequestTarget} instance if current request is an Ajax request,
   *         <code>null</code> otherwise.
   */
  public static AjaxRequestTarget get()
  {
    final RequestCycle requestCycle = RequestCycle.get();
    if (requestCycle != null)
    {
      if (requestCycle.getRequestTarget() instanceof AjaxRequestTarget)
      {
        return (AjaxRequestTarget)requestCycle.getRequestTarget();
      }
    }
    return null;
  }
View Full Code Here

  /**
   * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget)
   */
  protected void respond(AjaxRequestTarget target)
  {
    final RequestCycle requestCycle = RequestCycle.get();
    final String val = requestCycle.getRequest().getParameter("q");
    onRequest(val, requestCycle);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.RequestCycle

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.