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)
      {
        PageParameters parameters;
        if (pageId != null)
        {
          // WICKET-4594 - re-creating an expired page. Ignore the parsed parameters for the callback url
          parameters = new PageParameters();
        }
        else
        {
          parameters = pageParameters;
        }
        page = getPageSource().newPageInstance(pageClass, parameters);
        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)
    {
      if (pageClass == null || pageClass.equals(storedPageInstance.getClass()))
      {
        pageInstance = storedPageInstance;
        pageInstanceIsFresh = false;
        if (renderCount != null && pageInstance.getRenderCount() != renderCount)
        {
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

  {
    PageComponentInfo info = null;

    if (requestHandler instanceof RenderPageRequestHandler)
    {
      IRequestablePage page = ((RenderPageRequestHandler)requestHandler).getPage();

      PageInfo i = new PageInfo(page.getPageId());
      info = new PageComponentInfo(i, null);
    }
    else if (requestHandler instanceof ListenerInterfaceRequestHandler)
    {
      ListenerInterfaceRequestHandler handler = (ListenerInterfaceRequestHandler)requestHandler;
      IRequestablePage page = handler.getPage();
      String componentPath = handler.getComponentPath();
      RequestListenerInterface listenerInterface = handler.getListenerInterface();

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

      PageInfo pageInfo = new PageInfo(page.getPageId());
      ComponentInfo componentInfo = new ComponentInfo(renderCount,
        requestListenerInterfaceToString(listenerInterface), componentPath,
        handler.getBehaviorIndex());
      info = new PageComponentInfo(pageInfo, componentInfo);
    }
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("wicket/bookmarkable/" + PAGE_CLASS_NAME);
    IRequestHandler handler = encoder.mapRequest(getRequest(url));

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();
    assertEquals(PAGE_CLASS_NAME, page.getClass().getName());
    assertEquals(0, page.getPageParameters().getIndexedCount());
    assertTrue(page.getPageParameters().getNamedKeys().isEmpty());
  }
View Full Code Here

  {
    Url url = Url.parse("wicket/bookmarkable/" + PAGE_CLASS_NAME + "/indexed1?a=b&b=c");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));

    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler)handler).getPage();
    assertEquals(PAGE_CLASS_NAME, page.getClass().getName());

    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("wicket/bookmarkable/" + PAGE_CLASS_NAME + "?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.