Package org.apache.wicket.request.cycle

Examples of org.apache.wicket.request.cycle.RequestCycle


    }

    @Override
    protected void respond(final AjaxRequestTarget target)
    {
      RequestCycle requestCycle = RequestCycle.get();
      boolean save = requestCycle.getRequest()
        .getRequestParameters()
        .getParameterValue("save")
        .toBoolean(false);

      if (save)
View Full Code Here


  protected abstract void onRequest(String input, RequestCycle requestCycle);

  @Override
  protected void respond(final AjaxRequestTarget target)
  {
    final RequestCycle requestCycle = RequestCycle.get();
    final String val = requestCycle.getRequest()
      .getRequestParameters()
      .getParameterValue(settings.getParameterName())
      .toOptionalString();

    onRequest(val, requestCycle);
View Full Code Here

      if (page == null)
      {
        throw new WicketRuntimeException("Error creating page for modal dialog.");
      }
      CharSequence pageUrl;
      RequestCycle requestCycle = RequestCycle.get();

      if (page.isPageStateless())
      {
        pageUrl = requestCycle.urlFor(page.getClass(), page.getPageParameters());
      }
      else
      {
        IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
        pageUrl = requestCycle.urlFor(handler);
      }

      appendAssignment(buffer, "settings.src", pageUrl);
    }
    else
View Full Code Here

  /**
   * @return The request for this component's active request cycle
   */
  public final Request getRequest()
  {
    RequestCycle requestCycle = getRequestCycle();
    if (requestCycle == null)
    {
      // Happens often with WicketTester when one forgets to call
      // createRequestCycle()
      throw new WicketRuntimeException("No RequestCycle is currently set!");
    }
    return requestCycle.getRequest();
  }
View Full Code Here

  {
    super.renderHead(component, response);

    CoreLibrariesContributor.contributeAjax(component.getApplication(), response);

    RequestCycle requestCycle = component.getRequestCycle();
    Url baseUrl = requestCycle.getUrlRenderer().getBaseUrl();
    CharSequence ajaxBaseUrl = Strings.escapeMarkup(baseUrl.toString());
    response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl +
      "\";", "wicket-ajax-base-url"));

    renderExtraHeaderContributors(component, response);
View Full Code Here

  public final void onRequest()
  {
    WebApplication app = (WebApplication)getComponent().getApplication();
    AjaxRequestTarget target = app.newAjaxRequestTarget(getComponent().getPage());

    RequestCycle requestCycle = RequestCycle.get();
    requestCycle.scheduleRequestHandlerAfterCurrent(target);

    respond(target);
  }
View Full Code Here

  /**
   * @return The request for this component's active request cycle
   */
  public final Request getRequest()
  {
    RequestCycle requestCycle = getRequestCycle();
    if (requestCycle == null)
    {
      // Happens often with WicketTester when one forgets to call
      // createRequestCycle()
      throw new WicketRuntimeException("No RequestCycle is currently set!");
    }
    return requestCycle.getRequest();
  }
View Full Code Here

      header = new AjaxHtmlHeaderContainer(this);
      final Page parentPage = component.getPage();
      parentPage.addOrReplace(header);
    }

    RequestCycle requestCycle = component.getRequestCycle();

    // save old response, set new
    Response oldResponse = requestCycle.setResponse(encodingHeaderResponse);

    try {
      encodingHeaderResponse.reset();

      // render the head of component and all it's children

      component.renderHead(header);

      if (component instanceof MarkupContainer)
      {
        ((MarkupContainer)component).visitChildren(new IVisitor<Component, Void>()
        {
          @Override
          public void component(final Component component, final IVisit<Void> visit)
          {
            if (component.isVisibleInHierarchy())
            {
              component.renderHead(header);
            }
            else
            {
              visit.dontGoDeeper();
            }
          }
        });
      }
    } finally {
      // revert to old response
      requestCycle.setResponse(oldResponse);
    }

    writeHeaderContribution(response);

    headerRendering = false;
View Full Code Here

  }

  @Override
  public void onResourceRequested()
  {
    RequestCycle requestCycle = RequestCycle.get();
    ServletWebRequest request = (ServletWebRequest)requestCycle.getRequest();

    // Grab a Meteor
    Meteor meteor = Meteor.build(request.getContainerRequest());
    String uuid = getUUID(meteor.getAtmosphereResource());
    component.getPage().setMetaData(ATMOSPHERE_UUID, uuid);
View Full Code Here

    }
  }

  private RenderPageRequestHandler createPageRequestHandler(PageProvider pageProvider)
  {
    RequestCycle requestCycle = RequestCycle.get();

    if (requestCycle == null)
    {
      throw new IllegalStateException(
        "there is no current request cycle attached to this thread");
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.cycle.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.