Example usage for org.apache.wicket.request.mapper CompoundRequestMapper iterator

List of usage examples for org.apache.wicket.request.mapper CompoundRequestMapper iterator

Introduction

In this page you can find the example usage for org.apache.wicket.request.mapper CompoundRequestMapper iterator.

Prototype

@Override
    public Iterator<IRequestMapper> iterator() 

Source Link

Usage

From source file:org.jabylon.rest.ui.wicket.JabylonApplication.java

License:Open Source License

private void internalUmount(String path) {
    //workaround so wicket doesn't choke because the thread context isn't filled (wrong thread)
    Application application = ThreadContext.getApplication();
    if (application == null)
        ThreadContext.setApplication(JabylonApplication.this);
    if (ThreadContext.getSession() == null)
        ThreadContext.setSession(new WebSession(createFakeRequest(null)));
    //        unmount(path);
    /*//  w w  w.ja  v a  2 s  .c  om
     * umount seems to be greedy, e.g. a prefix match is enough.
     * That's troublesome because umount /settings/log will also umount /settings
     */
    ICompoundRequestMapper rootRequestMapperAsCompound = getRootRequestMapperAsCompound();
    if (rootRequestMapperAsCompound instanceof CompoundRequestMapper) {
        CompoundRequestMapper compound = (CompoundRequestMapper) rootRequestMapperAsCompound;
        Iterator<IRequestMapper> it = compound.iterator();
        while (it.hasNext()) {
            IRequestMapper iRequestMapper = it.next();
            if (iRequestMapper instanceof ResouceAwareMountedMapper) {
                ResouceAwareMountedMapper mapper = (ResouceAwareMountedMapper) iRequestMapper;
                if (path.equals(mapper.getMountPath())) {
                    logger.info("Unmounting  {}", path);
                    getRootRequestMapperAsCompound().remove(mapper);
                }
            }
        }
    }
}