Package org.apache.wicket.request.component

Examples of org.apache.wicket.request.component.IRequestablePage


      }
    };

    IRequestHandler handler = encoder.mapRequest(request);

    IRequestablePage page = ((IPageRequestHandler) handler).getPage();
    checkPage(page, 4);
  }
View Full Code Here


      }
    };

    IRequestHandler handler = encoder.mapRequest(request);

    IRequestablePage page = ((IPageRequestHandler) handler).getPage();
    checkPage(page, 4);
  }
View Full Code Here

          handler.getPageClass(), handler.getPageParameters());

        return buildUrl(urlInfo);
      }

      IRequestablePage page = handler.getPage();

      if (!pageMustHaveBeenCreatedBookmarkable() || page.wasCreatedBookmarkable())
      {
        PageInfo info = null;
        if (!page.isPageStateless())
        {
          info = new PageInfo(page.getPageId());
        }
        PageComponentInfo pageComponentInfo = info != null ? new PageComponentInfo(info,
          null) : null;

        UrlInfo urlInfo = new UrlInfo(pageComponentInfo, page.getClass(),
          handler.getPageParameters());
        return buildUrl(urlInfo);
      }
      else
      {
        return null;
      }

    }
    else if (requestHandler instanceof BookmarkableListenerInterfaceRequestHandler)
    {
      // listener interface URL with page class information
      BookmarkableListenerInterfaceRequestHandler handler = (BookmarkableListenerInterfaceRequestHandler)requestHandler;
      IRequestablePage page = handler.getPage();

      if (!checkPageClass(page.getClass()))
      {
        return null;
      }

      Integer renderCount = null;
      if (handler.getListenerInterface().isIncludeRenderCount())
      {
        renderCount = page.getRenderCount();
      }

      PageInfo pageInfo = new PageInfo(page.getPageId());
      ComponentInfo componentInfo = new ComponentInfo(renderCount,
        requestListenerInterfaceToString(handler.getListenerInterface()),
        handler.getComponent().getPageRelativePath(), handler.getBehaviorIndex());

      UrlInfo urlInfo = new UrlInfo(new PageComponentInfo(pageInfo, componentInfo),
        page.getClass(), handler.getPageParameters());
      return buildUrl(urlInfo);
    }

    return null;
  }
View Full Code Here

  private IRequestablePage getPageInstance(Integer pageId,
    Class<? extends IRequestablePage> pageClass, PageParameters pageParameters,
    Integer renderCount)
  {
    IRequestablePage page = null;

    boolean freshCreated = false;

    if (pageId != null)
    {
      page = getPageSource().getPageInstance(pageId);
      if (page != null && pageClass != null && page.getClass().equals(pageClass) == false)
      {
        page = null;
      }
      else if (page != null && pageParameters != null)
      {
        page.getPageParameters().overwriteWith(pageParameters);
      }
    }
    if (page == null)
    {
      if (pageClass != null)
      {
        page = getPageSource().newPageInstance(pageClass, pageParameters);
        freshCreated = true;
      }
    }

    if (page != null && !freshCreated)
    {
      if (renderCount != null && page.getRenderCount() != renderCount)
      {
        throw new StalePageException(page);
      }
    }
View Full Code Here

  /**
   * @see org.apache.wicket.request.IRequestHandler#respond(org.apache.wicket.request.IRequestCycle)
   */
  public void respond(final IRequestCycle requestCycle)
  {
    final IRequestablePage page = getPage();
    if (getComponent().getPage() == page)
    {
      boolean isAjax = ((WebRequest)requestCycle.getRequest()).isAjax();
      if (isAjax == false && listenerInterface.isRenderPageAfterInvocation())
      {
        // schedule page render after current request handler is done. this can be
        // overridden
        // during invocation of listener
        // method (i.e. by calling RequestCycle#setResponsePage)
        RedirectPolicy policy = page.isPageStateless() ? RedirectPolicy.NEVER_REDIRECT
          : RedirectPolicy.AUTO_REDIRECT;
        requestCycle.scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandler(
          new PageProvider(page), policy));
      }

View Full Code Here

   */
  public IRequestableComponent getComponent()
  {
    if (component == null)
    {
      IRequestablePage page = getPageInstance();
      component = page.get(componentPath);
      if (component == null)
      {

        /*
         * on stateless pages it is possible that the component may not yet exist because it
         * couldve been created in one of the lifecycle callbacks of this page. Lets invoke
         * the callbacks to give the page a chance to create the missing component.
         */

        // make sure this page instance was just created so the page can be stateless
        if (getPageId() == null)
        {
          Page p = (Page)page;
          p.internalInitialize();
          p.internalPrepareForRender(false);
          component = page.get(componentPath);
        }
      }
    }
    if (component == null)
    {
View Full Code Here

   * @see org.apache.wicket.request.mapper.IPageSource#getPageInstance(int)
   */
  public IRequestablePage getPageInstance(final int pageId)
  {
    IManageablePage manageablePage = Application.get().getPageManager().getPage(pageId);
    IRequestablePage requestablePage = null;
    if (manageablePage instanceof IRequestablePage)
    {
      requestablePage = (IRequestablePage)manageablePage;
    }
    return requestablePage;
View Full Code Here

  {
    Url url = Url.parse("some/mount/path");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();

    assertEquals(0, page.getPageParameters().getIndexedCount());
    assertTrue(page.getPageParameters().getNamedKeys().isEmpty());
  }
View Full Code Here

  {
    Url url = Url.parse("some/mount/path/indexed1?a=b&b=c");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();

    PageParameters p = page.getPageParameters();
    assertEquals(1, p.getIndexedCount());
    assertEquals("indexed1", p.get(0).toString());

    assertEquals(2, p.getNamedKeys().size());
    assertEquals("b", p.get("a").toString());
View Full Code Here

  {
    Url url = Url.parse("some/mount/path?15");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();
    checkPage(page, 15);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.component.IRequestablePage

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.