Example usage for org.apache.wicket.request.component IRequestablePage isPageStateless

List of usage examples for org.apache.wicket.request.component IRequestablePage isPageStateless

Introduction

In this page you can find the example usage for org.apache.wicket.request.component IRequestablePage isPageStateless.

Prototype


boolean isPageStateless();

Source Link

Document

Gets whether the page is stateless.

Usage

From source file:jp.javelindev.wicket.FixedUrlMountedMapper.java

License:Apache License

/**
 * {@inheritDoc }/*from   ww w  .jav  a  2s.c  o  m*/
 * <p>
 * ?????????URL?ID???<br>
 * ????????ID?ID?????ID?
 * ??URL?ID????
 */
@Override
public Url mapHandler(IRequestHandler requestHandler) {
    //requestHandler?RenderPageRequestHandler??????
    //?????
    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 = null;

            //????????????ID???????ID?
            //??URL?ID???
            if (!page.isPageStateless() && !isStoredPage(handler.getPageClass(), page.getPageId())) {
                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 {
        return super.mapHandler(requestHandler);
    }
}

From source file:jp.xet.uncommons.wicket.fixedurl.FixedUrlMountedMapper.java

License:Apache License

/**
 * {@inheritDoc}/*from ww  w  . j av  a2  s .c  o  m*/
 * 
 * <p>?????????URL?ID???</p>
 * 
 * <p>????????ID?ID?????ID?
 * ??URL?ID????</p>
 */
@Override
public Url mapHandler(IRequestHandler requestHandler) {
    // requestHandler?RenderPageRequestHandler??????
    // ?????
    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()) == false) {
            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 = null;

            // ????????????ID???????ID?
            // ??URL?ID???
            Class<? extends Page> pageClass = handler.getPageClass().asSubclass(Page.class);
            if (!page.isPageStateless()
                    && !isStoredPage(pageClass, page.getPageParameters(), page.getPageId())) {
                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 {
        return super.mapHandler(requestHandler);
    }
}