Package org.apache.wicket.request.component

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


  public boolean isNewPageInstance()
  {
    boolean isNew = pageInstance == null;
    if (isNew && pageId != null)
    {
      IRequestablePage storedPageInstance = getStoredPage(pageId);
      if (storedPageInstance != null)
      {
        pageInstance = storedPageInstance;
        isNew = false;
      }
View Full Code Here


  }

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

    boolean freshCreated = false;

    if (pageId != null)
    {
      page = getStoredPage(pageId);
    }

    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

   *            the id of the page to look for.
   * @return the found page instance by id.
   */
  private IRequestablePage getStoredPage(final int pageId)
  {
    IRequestablePage storedPageInstance = getPageSource().getPageInstance(pageId);
    if (storedPageInstance != null &&
      (pageClass == null || pageClass.equals(storedPageInstance.getClass())))
    {
      pageInstance = storedPageInstance;
      pageInstanceIsFresh = false;
      if (pageInstance != null)
      {
View Full Code Here

  @Override
  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 (page.isPageStateless())
        {
          Page p = (Page)page;
          p.internalInitialize();
          p.internalPrepareForRender(false);
          component = page.get(componentPath);
        }
      }
    }
    if (component == null)
    {
View Full Code Here

    IRequestHandler handler = encoder.mapRequest(request);
    assertNotNull("A handler should be resolved for relative url to a page instance url!",
      handler);

    IRequestablePage page = ((IPageRequestHandler)handler).getPage();
    assertEquals(page.getClass().getName(), PAGE_CLASS_NAME);
  }
View Full Code Here

    IRequestHandler handler = encoder.mapRequest(request);
    assertNotNull("A handler should be resolved for relative url to a bookmarkable page url!",
      handler);

    IRequestablePage page = ((IPageRequestHandler)handler).getPage();
    assertEquals(page.getClass().getName(), PAGE_CLASS_NAME);
  }
View Full Code Here

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

        return buildUrl(urlInfo);
      }

      IRequestablePage page = handler.getPage();

      if (checkPageInstance(page) &&
        (!pageMustHaveBeenCreatedBookmarkable() || page.wasCreatedBookmarkable()))
      {
        PageInfo info = getPageInfo(handler);
        PageComponentInfo pageComponentInfo = info != null ? new PageComponentInfo(info,
          null) : null;

        UrlInfo urlInfo = new UrlInfo(pageComponentInfo, page.getClass(),
          handler.getPageParameters());
        return buildUrl(urlInfo);
      }
      else
      {
View Full Code Here

    Args.notNull(handler, "handler");

    Integer pageId = null;
    if (handler.isPageInstanceCreated())
    {
      IRequestablePage page = handler.getPage();

      if (page.isPageStateless() == false)
      {
        pageId = page.getPageId();
      }
    }

    return new PageInfo(pageId);
  }
View Full Code Here

   */
  protected BufferedWebResponse renderPage(Url targetUrl, RequestCycle requestCycle)
  {
    // get the page before checking for a scheduled request handler because
    // the page may call setResponsePage in its constructor
    IRequestablePage requestablePage = getPage();

    IRequestHandler scheduled = requestCycle.getRequestHandlerScheduledAfterCurrent();

    if (scheduled != null)
    {
      // no need to render
      return null;
    }

    // keep the original response
    final WebResponse originalResponse = (WebResponse)requestCycle.getResponse();

    // buffered web response for page
    BufferedWebResponse response = new BufferedWebResponse(originalResponse);

    // keep the original base URL
    Url originalBaseUrl = requestCycle.getUrlRenderer().setBaseUrl(targetUrl);

    try
    {
      requestCycle.setResponse(response);
      requestablePage.renderPage();

      if (scheduled == null && requestCycle.getRequestHandlerScheduledAfterCurrent() != null)
      {
        // This is a special case.
        // During page render another request handler got scheduled and will want to
View Full Code Here

  {
    Url url = Url.parse(PAGE_CLASS_NAME);
    IRequestHandler handler = encoder.mapRequest(getRequest(url));

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();
    assertEquals(PAGE_CLASS_NAME, page.getClass().getSimpleName());
    assertEquals(0, page.getPageParameters().getIndexedCount());
    assertTrue(page.getPageParameters().getNamedKeys().isEmpty());
  }
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.