Example usage for org.apache.wicket.core.request.mapper MountedMapper MountedMapper

List of usage examples for org.apache.wicket.core.request.mapper MountedMapper MountedMapper

Introduction

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

Prototype

public MountedMapper(String mountPath, Supplier<Class<? extends IRequestablePage>> pageClassProvider) 

Source Link

Document

Construct.

Usage

From source file:lt.inventi.wicket.shiro.ShiroWicketPlugin.java

License:Apache License

/**
 * Installs this {@code ShiroWicketPlugin} by doing the following:
 * <ul>/*from   w w w  .  ja v a 2 s. c om*/
 * <li>Sets itself as the {@link IAuthorizationStrategy}</li>
 * <li>And as the {@link IUnauthorizedComponentInstantiationListener}</li>
 * <li>And as an {@link IRequestCycleListener}</li>
 * <li>Mounts the login page</li>
 * <li>Mounts the logout page</li>
 * </ul>
 */
public void install(WebApplication app) {
    Args.notNull(app, "app");

    ISecuritySettings settings = app.getSecuritySettings();
    settings.setAuthorizationStrategy(this);
    settings.setUnauthorizedComponentInstantiationListener(this);
    app.getRequestCycleListeners().add(this);

    // Mount bookmarkable URLs
    if (this.loginPath != null) {
        app.mount(new MountedMapper(this.loginPath, this.loginPage));
    }
    if (this.logoutPath != null) {
        app.mount(new MountedMapper(this.logoutPath, this.logoutPage));
    }

    // Install self in app metadata so that static get() can work
    ShiroWicketPlugin.set(app, this);
}

From source file:org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.java

License:Apache License

protected void mountPage(final String mountPath, final PageType pageType) {
    final Class<? extends Page> pageClass = this.pageClassRegistry.getPageClass(pageType);
    mount(new MountedMapper(mountPath, pageClass));
}

From source file:org.wicketstuff.annotation.scan.AnnotatedMountScanner.java

License:Apache License

/**
 * Returns the default mapper given a mount path and class.
 * /*from   w  w  w. jav  a 2s.  c  o m*/
 * @param mountPath
 * @param pageClass
 * @return {@link MountedMapper}
 */
public IRequestMapper getRequestMapper(String mountPath, Class<? extends IRequestablePage> pageClass) {
    if ("/".equals(mountPath)) {
        return new HomePageMapper(pageClass);
    }
    return new MountedMapper(mountPath, pageClass);
}

From source file:org.wicket_sapporo.guiceApp.GuiceApplication.java

License:Apache License

/**
 * @see org.apache.wicket.Application#init()
 *///from  w ww.  j av a  2s.c  o m
@Override
public void init() {
    super.init();
    // ????
    getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
    // Wicket???HTML?
    getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
    // IE6/7/8 ? JQuery1, ???JQuery2
    getJavaScriptLibrarySettings().setJQueryReference(new DynamicJQueryResourceReference());
    // MountedMapper
    mount(new MountedMapper("/guice_signin", GuiceSignInPage.class));
    mount(new MountedMapper("/guice_signed", GuiceSignedPage.class));
    // GoogleGuice?Injector??
    initGuice();
}

From source file:org.wicket_sapporo.springApp.SpringApplication.java

License:Apache License

/**
 * @see org.apache.wicket.Application#init()
 *///w w  w  . j a va2 s.  c o m
@Override
public void init() {
    super.init();
    // ????
    getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
    // Wicket???HTML?
    getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
    // IE6/7/8 ? JQuery1, ???JQuery2
    getJavaScriptLibrarySettings().setJQueryReference(new DynamicJQueryResourceReference());
    // MountedMapper
    mount(new MountedMapper("/spring_signin", SpringSignInPage.class));
    mount(new MountedMapper("/spring_signed", SpringSignedPage.class));
    // Spring?Injector??
    initSpring();
}

From source file:org.wicket_sapporo.workshop01.WS01Application.java

License:Apache License

/**
 * ?URL?/* w w  w .j av a2s  .com*/
 */
private void mountPage() {
    // ????URL???3????.
    mount(new MountedMapper("/query_receipt", MountedIdReceiptPage.class));
    mount(new MountedMapper("/arbitrary_receipt", ArbitraryIdReceiptPage.class,
            new UrlPathPageParametersEncoder()));
    mount(new MountedMapper("/named_receipt/${param1}/${param2}", NamedIdReceiptPage.class));

    mount(new MountedMapper("/SignIn", SimpleSignInPage.class));
    mount(new MountedMapper("/Signed", SignedPage.class));
}

From source file:org.xaloon.wicket.component.mount.DefaultPageMountScannerListener.java

License:Apache License

@Override
protected IRequestMapper getMountedMapper(Class<? extends IRequestablePage> pageClass) {
    String value = org.xaloon.wicket.util.UrlUtils.generateFullvalue(pageClass);
    if (StringUtils.isEmpty(value)) {
        throw new RuntimeException("Could not mount class: " + pageClass);
    }/*from   w ww. j  av  a 2  s .co m*/
    return new MountedMapper(value, pageClass);
}

From source file:org.xaloon.wicket.component.mount.DefaultPageMountScannerListener.java

License:Apache License

@SuppressWarnings("unchecked")
@Override/*from   w w w .  j  av a  2 s .  com*/
protected IRequestMapper getMountedMapper(Entry<String, Class<?>> item) {
    return new MountedMapper(item.getKey(), (Class<? extends IRequestablePage>) item.getValue());
}

From source file:org.xaloon.wicket.component.mount.impl.SuffixPageMountingListener.java

License:Apache License

private IRequestMapper createRequestMapper(Class<? extends IRequestablePage> pageClass, String value) {
    if (StringUtils.isEmpty(value)) {
        throw new RuntimeException("Could not mount class: " + pageClass);
    }/*from   w  ww  .ja  v  a 2s.  c  om*/
    if (value.contains(PARAMETER_VALUE)) {
        StringBuilder valueBuilder = new StringBuilder(value.substring(0, value.indexOf(PARAMETER_VALUE)));
        valueBuilder.append(suffix);
        valueBuilder.append(value.substring(value.indexOf(PARAMETER_VALUE)));
        value = valueBuilder.toString();
    } else {
        value = value + suffix;
    }
    return new MountedMapper(value, pageClass);
}

From source file:org.xaloon.wicket.component.mount.impl.TrailingSlashPageMountingListener.java

License:Apache License

private IRequestMapper createRequestMapper(Class<? extends IRequestablePage> pageClass, String value) {
    String suffix = DelimiterEnum.SLASH.value();
    if (StringUtils.isEmpty(value)) {
        throw new RuntimeException("Could not mount class: " + pageClass);
    }/*from   ww  w . j a va  2  s . co  m*/
    if (!value.endsWith(suffix)) {
        value = value + suffix;
    }
    return new MountedMapper(value, pageClass);
}