List of usage examples for org.apache.wicket RuntimeConfigurationType DEVELOPMENT
RuntimeConfigurationType DEVELOPMENT
To view the source code for org.apache.wicket RuntimeConfigurationType DEVELOPMENT.
Click Source Link
From source file:de.tudarmstadt.ukp.clarin.webanno.webapp.home.page.ApplicationPageBase.java
License:Apache License
@Override protected void onConfigure() { super.onConfigure(); logoutPanel.setVisible(AuthenticatedWebSession.get().isSignedIn()); // Do not cache pages in development mode - allows us to make changes to the HMTL without // having to reload the application if (RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType())) { getApplication().getMarkupSettings().getMarkupFactory().getMarkupCache().clear(); getApplication().getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE); }// www .j av a 2 s . c om }
From source file:dk.frankbille.scoreboard.Start.java
License:Open Source License
public static void main(String[] args) throws Exception { System.setProperty("wicket.configuration", RuntimeConfigurationType.DEVELOPMENT.name()); int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); Server server = new Server(); SocketConnector connector = new SocketConnector(); // Set some timeout options to make debugging easier. connector.setMaxIdleTime(timeout);/*from w w w . j a v a 2 s . c o m*/ connector.setSoLingerTime(-1); connector.setPort(8080); server.addConnector(connector); WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath("/"); bb.setWar("src/main/webapp"); // START JMX SERVER // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); // server.getContainer().addEventListener(mBeanContainer); // mBeanContainer.start(); server.setHandler(bb); try { System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); server.start(); System.in.read(); System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); server.stop(); server.join(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } }
From source file:dk.teachus.frontend.TeachUsApplication.java
License:Apache License
@Override protected void init() { if (getServletContext().getInitParameter("doDynamicDataImport") != null) { getDynamicDataImport().doImport(); }//from w w w.j a va 2 s . co m // Settings CompoundAuthorizationStrategy authorizationStrategy = new CompoundAuthorizationStrategy(); authorizationStrategy.add(new TeachUsCookieAuthentication()); authorizationStrategy.add(new TeachUsAuthentication()); getSecuritySettings().setAuthorizationStrategy(authorizationStrategy); getApplicationSettings().setPageExpiredErrorPage(PageExpiredPage.class); getApplicationSettings().setInternalErrorPage(InternalErrorPage.class); getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); getMarkupSettings().setStripWicketTags(true); if (getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) { getRequestCycleSettings().addResponseFilter(new AjaxServerAndClientTimeFilter()); } loadConfiguration(); mountPages(); mountResources(); }
From source file:fi.ilmoeuro.membertrack.ui.MtApplication.java
License:Open Source License
@Override public RuntimeConfigurationType getConfigurationType() { if (appConfig.isDebug()) { return RuntimeConfigurationType.DEVELOPMENT; } else {//from w w w . j a va 2 s .co m return RuntimeConfigurationType.DEPLOYMENT; } }
From source file:gr.abiss.calipso.wicket.CalipsoApplication.java
License:Open Source License
@Override public void init() { super.init(); // DEVELOPMENT or DEPLOYMENT RuntimeConfigurationType configurationType = this.getConfigurationType(); if (RuntimeConfigurationType.DEVELOPMENT.equals(configurationType)) { logger.info("You are in DEVELOPMENT mode"); // getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); // getDebugSettings().setComponentUseCheck(true); getResourceSettings().setResourcePollFrequency(null); getDebugSettings().setComponentUseCheck(false); // getDebugSettings().setSerializeSessionAttributes(true); // getMarkupSettings().setStripWicketTags(false); // getExceptionSettings().setUnexpectedExceptionDisplay( // UnexpectedExceptionDisplay.SHOW_EXCEPTION_PAGE); // getAjaxSettings().setAjaxDebugModeEnabled(true); } else if (RuntimeConfigurationType.DEPLOYMENT.equals(configurationType)) { getResourceSettings().setResourcePollFrequency(null); getDebugSettings().setComponentUseCheck(false); // getDebugSettings().setSerializeSessionAttributes(false); // getMarkupSettings().setStripWicketTags(true); // getExceptionSettings().setUnexpectedExceptionDisplay( // UnexpectedExceptionDisplay.SHOW_INTERNAL_ERROR_PAGE); // getAjaxSettings().setAjaxDebugModeEnabled(false); }// w w w . j a va 2s .co m // initialize velocity try { Velocity.init(); if (logger.isInfoEnabled()) { logger.info("Initialized Velocity engine"); } } catch (Exception e) { // TODO Auto-generated catch block logger.error("Failed to initialize velocity engine", e); } // Set custom page for internal errors getApplicationSettings().setInternalErrorPage(CalipsoErrorPage.class); // don't break down on missing resources getResourceSettings().setThrowExceptionOnMissingResource(false); // Redirect to PageExpiredError Page if current page is expired getApplicationSettings().setPageExpiredErrorPage(CalipsoPageExpiredErrorPage.class); // get hold of spring managed service layer (see BasePage, BasePanel etc // for how it is used) ServletContext sc = getServletContext(); applicationContext = WebApplicationContextUtils.getWebApplicationContext(sc); calipsoService = (CalipsoService) applicationContext.getBean("calipsoService"); calipsoPropertiesEditor = new CalipsoPropertiesEditor(); // check if acegi-cas authentication is being used, get reference to // object to be used // by wicket authentication to redirect to right pages for login / // logout try { calipsoCasProxyTicketValidator = (CalipsoCasProxyTicketValidator) applicationContext .getBean("casProxyTicketValidator"); logger.info("casProxyTicketValidator retrieved from application context: " + calipsoCasProxyTicketValidator); } catch (NoSuchBeanDefinitionException nsbde) { logger.info( "casProxyTicketValidator not found in application context, CAS single-sign-on is not being used"); } // delegate wicket i18n support to spring i18n getResourceSettings().getStringResourceLoaders().add(new IStringResourceLoader() { @Override public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation) { return applicationContext.getMessage(key, null, null, locale); } @Override public String loadStringResource(Component component, String key, Locale locale, String style, String variation) { return applicationContext.getMessage(key, null, null, locale); } }); // add DB i18n resources getResourceSettings().getStringResourceLoaders().add(new IStringResourceLoader() { @Override public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation) { if (StringUtils.isNotBlank(locale.getVariant())) { // always ignore the variant locale = new Locale(locale.getLanguage(), locale.getCountry()); } String lang = locale.getLanguage(); I18nStringResource resource = CalipsoApplication.this.calipsoService .loadI18nStringResource(new I18nStringIdentifier(key, lang)); if (resource == null && !lang.equalsIgnoreCase("en")) { resource = CalipsoApplication.this.calipsoService .loadI18nStringResource(new I18nStringIdentifier(key, "en")); } return resource != null ? resource.getValue() : null; } @Override public String loadStringResource(Component component, String key, Locale locale, String style, String variation) { locale = component == null ? Session.get().getLocale() : component.getLocale(); if (StringUtils.isNotBlank(locale.getVariant())) { // always ignore the variant locale = new Locale(locale.getLanguage(), locale.getCountry()); } String lang = locale.getLanguage(); I18nStringResource resource = CalipsoApplication.this.calipsoService .loadI18nStringResource(new I18nStringIdentifier(key, lang)); if (resource == null && !lang.equalsIgnoreCase("en")) { resource = CalipsoApplication.this.calipsoService .loadI18nStringResource(new I18nStringIdentifier(key, "en")); } return resource != null ? resource.getValue() : null; } }); // cache resources. resource cache is cleared when creating/updating a space getResourceSettings().getLocalizer().setEnableCache(true); getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy() { @Override public boolean isActionAuthorized(Component c, Action a) { return true; } @Override public boolean isInstantiationAuthorized(Class clazz) { if (BasePage.class.isAssignableFrom(clazz)) { if (((CalipsoSession) Session.get()).isAuthenticated()) { return true; } if (calipsoCasProxyTicketValidator != null) { // attempt CAS authentication // ========================== // logger.debug("checking if context contains CAS authentication"); Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication != null && authentication.isAuthenticated()) { // logger.debug("security context contains CAS authentication, initializing session"); ((CalipsoSession) Session.get()).setUser((User) authentication.getPrincipal()); return true; } } // attempt remember-me auto login // ========================== if (attemptRememberMeAutoLogin()) { return true; } // attempt *anonymous* guest access if there are // spaces that allow it if (((CalipsoSession) Session.get()).getUser() == null) { List<Space> anonymousSpaces = getCalipso().findSpacesWhereAnonymousAllowed(); if (anonymousSpaces.size() > 0) { // logger.debug("Found "+anonymousSpaces.size() // + // " anonymousSpaces allowing ANONYMOUS access, initializing anonymous user"); User guestUser = new User();//getCalipso().loadUser(2); guestUser.setLoginName("guest"); guestUser.setName("Anonymous"); guestUser.setLastname("Guest"); guestUser.setLocale(Session.get().getLocale().getLanguage()); getCalipso().initImplicitRoles(guestUser, anonymousSpaces, RoleType.ANONYMOUS); // store user in session ((CalipsoSession) Session.get()).setUser(guestUser); return true; } else { if (logger.isDebugEnabled()) { // logger.debug("Found no public spaces."); } } } // allow registration if (clazz.equals(RegisterUserFormPage.class)) { return true; } // not authenticated, go to login page // logger.debug("not authenticated, forcing login, page requested was " // + clazz.getName()); if (calipsoCasProxyTicketValidator != null) { String serviceUrl = calipsoCasProxyTicketValidator.getLoginUrl(); // .getServiceProperties().getService(); String loginUrl = calipsoCasProxyTicketValidator.getLoginUrl(); // logger.debug("cas authentication: service URL: " // + serviceUrl); String redirectUrl = loginUrl + "?service=" + serviceUrl; // logger.debug("attempting to redirect to: " + // redirectUrl); throw new RestartResponseAtInterceptPageException(new RedirectPage(redirectUrl)); } else { throw new RestartResponseAtInterceptPageException(LoginPage.class); } } return true; } }); // TODO: create friendly URLs for all created pages // friendly URLs for selected pages if (calipsoCasProxyTicketValidator != null) { mountPage("/login", CasLoginPage.class); } else { mountPage("/login", LoginPage.class); } mountPage("/register", RegisterAnonymousUserFormPage.class); mountPage("/logout", LogoutPage.class); mountPage("/svn", SvnStatsPage.class); mountPage("/test", TestPage.class); mountPage("/casError", CasLoginErrorPage.class); mountPage("/item/", ItemViewPage.class); mountPage("/item/${itemId}", ItemViewPage.class); mountPage("/itemreport/", ItemTemplateViewPage.class); mountPage("/newItem/${spaceCode}", NewItemPage.class); // MixedParamUrlCodingStrategy newItemUrls = new MixedParamUrlCodingStrategy( // "/newItem", // NewItemPage.class, // new String[]{"spaceCode"} // ); // mount(newItemUrls); //fix for tinyMCE bug, see https://github.com/wicketstuff/core/issues/113 SecurePackageResourceGuard guard = (SecurePackageResourceGuard) getResourceSettings() .getPackageResourceGuard(); guard.addPattern("+*.htm"); this.getRequestCycleSettings().setTimeout(Duration.minutes(6)); this.getPageSettings().setVersionPagesByDefault(true); this.getExceptionSettings().setThreadDumpStrategy(ThreadDumpStrategy.THREAD_HOLDING_LOCK); }
From source file:guru.mmp.application.web.WebApplication.java
License:Apache License
/** * Returns the runtime configuration type for the Wicket web application. * * @return the runtime configuration type for the Wicket web application *///from w w w . j a v a 2 s . c om @Override public RuntimeConfigurationType getConfigurationType() { if (Debug.inDebugMode()) { return RuntimeConfigurationType.DEVELOPMENT; } else { return RuntimeConfigurationType.DEPLOYMENT; } }
From source file:it.av.youeat.web.YoueatApplication.java
License:Apache License
/** * @return true when running in development configuration, false for deployment configuration *///from w w w . j a va 2s .com public boolean inDevelopment() { return getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT); }
From source file:net.databinder.DataApplicationBase.java
License:Open Source License
/** * Reports if the program is running in a development environment, as determined by the * "wicket.configuration" environment variable or context/init parameter. If that variable * is unset or set to "development", the app is considered to be running in development. * @return true if running in a development environment *///from w w w. j av a 2s . c o m protected boolean isDevelopment() { return getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT); }
From source file:net.rrm.ehour.ui.EhourWebApplication.java
License:Open Source License
@Override public RuntimeConfigurationType getConfigurationType() { String development = RuntimeConfigurationType.DEVELOPMENT.name(); String deployment = RuntimeConfigurationType.DEPLOYMENT.name(); String configurationType = ehourSystemConfig.getConfigurationType(); if (configurationType == null || (!configurationType.equalsIgnoreCase(deployment) && !configurationType.equalsIgnoreCase(development))) { LOGGER.warn("Invalid configuration type defined in ehour.properties. Valid values are " + deployment + " or " + development); return RuntimeConfigurationType.DEVELOPMENT; }// ww w . j a va 2 s .co m return RuntimeConfigurationType.valueOf(configurationType.toUpperCase()); }
From source file:org.apache.isis.viewer.wicket.viewer.integration.isis.DeploymentTypeWicketAbstract.java
License:Apache License
public RuntimeConfigurationType getConfigurationType() { return getDeploymentCategory().isProduction() ? RuntimeConfigurationType.DEPLOYMENT : RuntimeConfigurationType.DEVELOPMENT; }