Package org.apache.wicket.core.request.handler

Examples of org.apache.wicket.core.request.handler.RenderPageRequestHandler


  protected IRequestHandler processBookmarkable(Class<? extends IRequestablePage> pageClass,
    PageParameters pageParameters)
  {
    PageProvider provider = new PageProvider(pageClass, pageParameters);
    provider.setPageSource(getContext());
    return new RenderPageRequestHandler(provider);
  }
View Full Code Here


      throw new PageExpiredException(String.format("Bookmarkable page id '%d' has expired.",
        pageInfo.getPageId()));
    }
    else
    {
      return new RenderPageRequestHandler(provider);
    }
  }
View Full Code Here

    else if (requestHandler instanceof RenderPageRequestHandler)
    {
      // possibly hybrid URL - bookmarkable URL with page instance information
      // but only allowed if the page was created by bookmarkable URL

      RenderPageRequestHandler handler = (RenderPageRequestHandler)requestHandler;

      if (!checkPageClass(handler.getPageClass()))
      {
        return null;
      }

      if (handler.getPageProvider().isNewPageInstance())
      {
        // no existing page instance available, don't bother creating new page instance
        PageInfo info = new PageInfo();
        UrlInfo urlInfo = new UrlInfo(new PageComponentInfo(info, null),
          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
      {
        return null;
      }

    }
    else if (requestHandler instanceof BookmarkableListenerInterfaceRequestHandler)
    {
      // listener interface URL with page class information
      BookmarkableListenerInterfaceRequestHandler handler = (BookmarkableListenerInterfaceRequestHandler)requestHandler;
      Class<? extends IRequestablePage> pageClass = handler.getPageClass();

      if (!checkPageClass(pageClass))
      {
        return null;
      }

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

      PageInfo pageInfo = getPageInfo(handler);
      ComponentInfo componentInfo = new ComponentInfo(renderCount,
        requestListenerInterfaceToString(handler.getListenerInterface()),
        handler.getComponentPath(), handler.getBehaviorIndex());

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

    return null;
  }
View Full Code Here

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

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

        {
          PageProvider provider = new PageProvider(info.getPageInfo().getPageId(),
            renderCount);
          provider.setPageSource(getContext());
          // render page
          return new RenderPageRequestHandler(provider);
        }
        else
        {
          ComponentInfo componentInfo = info.getComponentInfo();
View Full Code Here

    page.getPageParameters().set("a", "b");
    page.getPageParameters().set("b", "c");
    page.setCreatedBookmarkable(true);

    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);

    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME + "/i1/i2?15&a=b&b=c", url.toString());
  }
View Full Code Here

    page.getPageParameters().set("b", "c");

    page.setCreatedBookmarkable(false);

    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);

    // never allow bookmarkable render url for page that has not been created by bookmarkable
    // URL
View Full Code Here

    page.setBookmarkable(true);
    page.setCreatedBookmarkable(true);
    page.setPageStateless(true);

    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);

    Url url = encoder.mapHandler(handler);

    assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME, url.toString());
  }
View Full Code Here

                // so make sure there is a new transaction ready to go.
                if(getTransactionManager().getTransaction().getState().isComplete()) {
                    getTransactionManager().startTransaction();
                }
                if(handler instanceof RenderPageRequestHandler) {
                    RenderPageRequestHandler requestHandler = (RenderPageRequestHandler) handler;
                    if(requestHandler.getPage() instanceof ErrorPage) {
                        // do nothing
                        return;
                    }
                }
               
View Full Code Here

    public IRequestHandler onException(RequestCycle cycle, Exception ex) {
        PageProvider errorPageProvider = errorPageProviderFor(ex);
        // avoid infinite redirect loops
        RedirectPolicy redirectPolicy = ex instanceof PageExpiredException? RedirectPolicy.NEVER_REDIRECT: RedirectPolicy.ALWAYS_REDIRECT;
        return errorPageProvider != null
                ? new RenderPageRequestHandler(errorPageProvider, redirectPolicy)
                : null;
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.core.request.handler.RenderPageRequestHandler

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.