Example usage for org.apache.wicket Application getHomePage

List of usage examples for org.apache.wicket Application getHomePage

Introduction

In this page you can find the example usage for org.apache.wicket Application getHomePage.

Prototype

public abstract Class<? extends Page> getHomePage();

Source Link

Document

Application subclasses must specify a home page class by implementing this abstract method.

Usage

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

License:Apache License

/**
 * TODO for daisuke//from www .java2 s  .c om
 * 
 * @param application {@link Application}
 * @throws NullPointerException ?{@code null}???
 * @since 1.2
 */
public static void replaceHomePageMapper(final Application application) {
    Args.notNull(application, "application");
    ICompoundRequestMapper mappers = application.getRootRequestMapperAsCompound();
    IRequestMapper homePageMapper = null;
    for (IRequestMapper mapper : mappers) {
        if (mapper instanceof HomePageMapper) {
            homePageMapper = mapper;
            break;
        }
    }
    if (homePageMapper != null) {
        mappers.remove(homePageMapper);
    }
    mappers.add(new FixedUrlHomePageMapper(new ClassProvider<Page>(null) {

        @Override
        public Class<Page> get() {
            @SuppressWarnings("unchecked")
            Class<Page> homePage = (Class<Page>) application.getHomePage();
            return homePage;
        }
    }));
}