List of usage examples for org.apache.wicket.protocol.http WebApplication mountPage
public <T extends Page> MountedMapper mountPage(final String path, final Class<T> pageClass)
From source file:gr.interamerican.wicket.utils.WicketUtils.java
License:Open Source License
/** * Mounts a number of bookmarkable wicket pages, from a resource properties file. * <br/>//from w w w. ja v a2s . co m * If a Page class is not found, an ERROR is logged to facilitate continuous integration * test execution. * * @param fPath * Resource path of properties file. * @param webApplication * {@link WebApplication} instance. */ @SuppressWarnings({ "unchecked", "nls" }) public static void mountBookmarkablePagesFromFile(String fPath, WebApplication webApplication) { Properties p = CollectionUtils.readProperties(fPath); Map<String, String> properties = Utils.cast(p); for (Map.Entry<String, String> entry : properties.entrySet()) { Class<?> clazz = null; try { clazz = Class.forName(entry.getValue()); } catch (ClassNotFoundException e) { String msg = StringUtils.concat("Non existant bookmarkable page class: ", entry.getValue().toString(), ". This is acceptable for unit tests, but FATAL in every other case and should be investigated."); LOGGER.error(msg); continue; } if (!Page.class.isAssignableFrom(clazz)) { throw new RuntimeException(entry.getValue() + " should extend " + Page.class.getName()); //$NON-NLS-1$ } webApplication.mountPage(entry.getKey(), (Class<Page>) clazz); } }
From source file:org.kantega.reststop.helloworld.wicket.HelloworldWicketPlugin.java
License:Apache License
public HelloworldWicketPlugin(WebApplication webApplication) { webApplication.mountPage("/hello", HelloPage.class); }
From source file:org.seasar.wicket.S2WicketFilter.java
License:Apache License
private void initInternal(final boolean isServlet, FilterConfig filterConfig) throws ServletException { // ???????????? destroy();/*from ww w .j av a2 s. co m*/ // ??? configuration = getInitParameter(filterConfig, "configuration", "development").toUpperCase(); configPath = getInitParameter(filterConfig, "configPath", "app.dicon"); debug = getInitParameter(filterConfig, "debug", null); reloadingClassPattern = getInitParameter(filterConfig, "reloadingClassPattern", null); useReloadingClassLoader = RuntimeConfigurationType.DEVELOPMENT.name().equalsIgnoreCase(configuration) && reloadingClassPattern != null; if (logger.isInfoEnabled()) { logger.info("[config] configuration='{}'", configuration); logger.info("[config] configPath='{}'", configPath); logger.info("[config] debug='{}'", debug); logger.info("[config] reloadingClassPattern='{}'", reloadingClassPattern); } if (RuntimeConfigurationType.DEVELOPMENT == RuntimeConfigurationType.valueOf(configuration) && reloadingClassPattern != null) { ReloadingClassLoader.getPatterns().clear(); // ?????????? // ??????????? for (String classPattern : reloadingClassPattern.split(",")) { if (!classPattern.startsWith("-")) { ReloadingClassLoader.includePattern(classPattern); } else { ReloadingClassLoader.excludePattern(classPattern.substring(1)); } } for (URL str : ReloadingClassLoader.getLocations()) { logger.info("[classpath] {}", str); } for (String str : ReloadingClassLoader.getPatterns()) { logger.info("[pattern] {}", str); } } ComponentDeployerFactory.setProvider(new ExternalComponentDeployerProvider()); S2Container s2container = S2ContainerFactory.create(configPath, getClassLoader()); s2container.setExternalContext(new HttpServletExternalContext()); s2container.setExternalContextComponentDefRegister(new HttpServletExternalContextComponentDefRegister()); s2container.getExternalContext().setApplication(filterConfig.getServletContext()); s2container.init(); SingletonS2ContainerFactory.setContainer(s2container); if (SmartDeployUtil.isHotdeployMode(SingletonS2ContainerFactory.getContainer())) { throw new ServletException("S2Wicket does not support HOT deploy mode."); } // Application???getHomePage()?????? // ???????????? super.init(isServlet, filterConfig); // ???WebApplication????????? WebApplication webApplication = (WebApplication) Application.get(filterConfig.getFilterName()); webApplication.getComponentInstantiationListeners().add(new ComponentInjectionListener()); applicationConfigType = webApplication.getConfigurationType(); applicationEncoding = webApplication.getRequestCycleSettings().getResponseRequestEncoding(); if (RuntimeConfigurationType.DEVELOPMENT == RuntimeConfigurationType.valueOf(configuration)) { webApplication.getFrameworkSettings() .setSerializer(new ReloadingJavaSerializer(webApplication.getApplicationKey())); if (debug != null) { webApplication.mountPage(debug, S2DebugPage.class); } } }