Example usage for org.apache.wicket.request.mapper.info PageInfo getPageId

List of usage examples for org.apache.wicket.request.mapper.info PageInfo getPageId

Introduction

In this page you can find the example usage for org.apache.wicket.request.mapper.info PageInfo getPageId.

Prototype

public Integer getPageId() 

Source Link

Usage

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

License:Apache License

/**
 * {@inheritDoc }/*from   www.  j a  va  2  s  . c  om*/
 * <p>
 * request?pageId??????????????????ID??
 * ???????????ID???
 */
@Override
public IRequestHandler mapRequest(Request request) {
    UrlInfo urlInfo = parseRequest(request);

    // check if the URL is long enough and starts with the proper segments
    if (urlInfo != null) {
        PageComponentInfo info = urlInfo.getPageComponentInfo();
        Class<? extends IRequestablePage> pageClass = urlInfo.getPageClass();
        PageParameters pageParameters = urlInfo.getPageParameters();

        Integer storedPageId = getStoredPageId(pageClass);
        boolean reload = pageParameters != null && pageParameters.getNamedKeys().contains("reload");

        //?ID?????????????
        //???ID?ID????????????
        //ID?????????????
        //processBookmarkable??????PageProvider???
        //?PageProvider?????????IDID???
        //reload????????????
        if (reload || ((info == null || info.getPageInfo().getPageId() == null) && storedPageId == null)) {
            // if there are is no page instance information (only page map name - optionally)
            // then this is a simple bookmarkable URL

            if (reload) {
                pageParameters.remove("reload");
            }

            return processBookmarkable(pageClass, pageParameters);
        } else if (((info != null && info.getPageInfo() != null && info.getPageInfo().getPageId() != null)
                || storedPageId != null) && (info == null || info.getComponentInfo() == null)) {
            // if there is page instance information in the URL but no component and listener
            // interface then this is a hybrid URL - we need to try to reuse existing page
            // instance

            // URL?ID?????????????
            // URL?ID?????storedPageID != null ???storedPageIdID????
            PageInfo pageInfo = info == null ? null : info.getPageInfo();
            if ((pageInfo == null || pageInfo.getPageId() == null) && storedPageId != null) {
                pageInfo = new PageInfo(storedPageId);
            }

            return processHybrid(pageInfo, pageClass, pageParameters, null);
        } else if (info != null && info.getComponentInfo() != null) {
            // with both page instance and component+listener this is a listener interface URL
            return processListener(info, pageClass, pageParameters);
        }
    }
    return null;
}

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

License:Apache License

/**
 * {@inheritDoc}/*from   w  ww. ja  v a 2s.c o m*/
 * 
 * <p>request?pageId??????????????????ID??
 * ???????????ID???</p>
 */
@Override
@SuppressWarnings("null")
public IRequestHandler mapRequest(Request request) {
    UrlInfo urlInfo = parseRequest(request);

    // check if the URL is long enough and starts with the proper segments
    if (urlInfo != null) {
        PageComponentInfo info = urlInfo.getPageComponentInfo();
        Class<? extends Page> pageClass = urlInfo.getPageClass().asSubclass(Page.class);
        PageParameters pageParameters = urlInfo.getPageParameters();

        Integer storedPageId = getStoredPageId(pageClass, pageParameters);
        boolean reload = pageParameters != null && pageParameters.getNamedKeys().contains(KEY_RELOAD);

        // ?ID?????????????
        // ???ID?ID????????????
        // ID?????????????
        // processBookmarkable??????PageProvider???
        // ?PageProvider?????????IDID???
        // reload????????????
        if (reload || ((info == null || info.getPageInfo().getPageId() == null) && storedPageId == null)) {
            // if there are is no page instance information (only page map name - optionally)
            // then this is a simple bookmarkable URL

            if (reload) {
                pageParameters.remove(KEY_RELOAD);
            }

            return processBookmarkable(pageClass, pageParameters);
        } else if (((info != null && info.getPageInfo() != null && info.getPageInfo().getPageId() != null)
                || storedPageId != null) && (info == null || info.getComponentInfo() == null)) {
            // if there is page instance information in the URL but no component and listener
            // interface then this is a hybrid URL - we need to try to reuse existing page
            // instance

            // URL?ID?????????????
            // URL?ID?????storedPageID != null ???storedPageIdID????
            PageInfo pageInfo = info == null ? null : info.getPageInfo();
            if ((pageInfo == null || pageInfo.getPageId() == null) && storedPageId != null) {
                pageInfo = new PageInfo(storedPageId);
            }

            return processHybrid(pageInfo, pageClass, pageParameters, null);
        } else if (info != null && info.getComponentInfo() != null) {
            // with both page instance and component+listener this is a listener interface URL
            return processListener(info, pageClass, pageParameters);
        }
    }
    return null;
}