Package org.apache.wicket.request.cycle

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


  public final RequestCycle createRequestCycle(final Request request, final Response response)
  {
    RequestCycleContext context = new RequestCycleContext(request, response,
      getRootRequestMapper(), getExceptionMapperProvider().get());

    RequestCycle requestCycle = getRequestCycleProvider().get(context);
    requestCycle.getListeners().add(requestCycleListeners);
    requestCycle.getListeners().add(new AbstractRequestCycleListener()
    {
      @Override
      public void onDetach(final RequestCycle requestCycle)
      {
        if (Session.exists())
View Full Code Here


  private static class DefaultRequestCycleProvider implements IRequestCycleProvider
  {
    @Override
    public RequestCycle get(final RequestCycleContext context)
    {
      return new RequestCycle(context);
    }
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

  /**
   * @return the FilteringHeaderResponse being used in this RequestCycle
   */
  public static FilteringHeaderResponse get()
  {
    RequestCycle requestCycle = RequestCycle.get();
    if (requestCycle == null)
    {
      throw new IllegalStateException(
        "You can only get the FilteringHeaderResponse when there is a RequestCycle present");
    }
    FilteringHeaderResponse response = requestCycle.getMetaData(RESPONSE_KEY);
    if (response == null)
    {
      throw new IllegalStateException(
        "No FilteringHeaderResponse is present in the request cycle.  This may mean that you have not decorated the header response with a FilteringHeaderResponse.  Simply calling the FilteringHeaderResponse constructor sets itself on the request cycle");
    }
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

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

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

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

        pageUrl = requestCycle.urlFor(handler);
        String ie8_pageUrl = requestCycle.getUrlRenderer().renderRelativeUrl(
          requestCycle.mapUrlFor(handler));
        appendAssignment(buffer, "settings.ie8_src", ie8_pageUrl);
      }

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

      @Override
      protected void onSubmit(AjaxRequestTarget target)
      {
        BookmarkablePageRequestHandler bookmarkablePageRequestHandler = new BookmarkablePageRequestHandler(
          new PageProvider(Index.class));
        RequestCycle requestCycle = RequestCycle.get();
        CharSequence urlFor = requestCycle.urlFor(bookmarkablePageRequestHandler);
        target.add(label);
      }

      @Override
      protected void onError(AjaxRequestTarget target)
View Full Code Here

   */
  public final String getId()
  {
    if (id == null)
    {
      RequestCycle requestCycle = RequestCycle.get();
      if (requestCycle != null)
      {
        id = getSessionStore().getSessionId(requestCycle.getRequest(), false);
      }
      // we have one?
      if (id != null)
      {
        dirty();
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.