List of usage examples for org.apache.wicket.application DefaultClassResolver DefaultClassResolver
DefaultClassResolver
From source file:com.gfactor.web.wicket.loader.OsgiClassResolver.java
License:Apache License
public OsgiClassResolver() { this.wrappedClassResolver = new DefaultClassResolver(); }
From source file:com.norconex.jefmon.about.AboutDialog.java
License:Apache License
private PropertiesConfiguration getAboutProperties() { try {/*from w ww . j a va2s .co m*/ URL resource = new DefaultClassResolver().getClassLoader().getResource("about.properties"); return new PropertiesConfiguration(resource); } catch (ConfigurationException e) { throw new JEFMonException("Exception while reading about.properties", e); } }
From source file:com.norconex.jefmon.server.JEFMonServer.java
License:Apache License
/** * Set configuration type by looking for dev.properties file. * /*from www.j a va 2 s . co m*/ * This method must be called very early. * * The default behavior is to set as RuntimeConfigurationType.DEPLOYMENT */ private void initRuntimeConfiguration() { URL resource = new DefaultClassResolver().getClassLoader().getResource("dev.properties"); if (resource == null) { app.setConfigurationType(RuntimeConfigurationType.DEPLOYMENT); return; } try { PropertiesConfiguration properties = new PropertiesConfiguration(resource); String value = properties.getString("wicket." + Application.CONFIGURATION, RuntimeConfigurationType.DEPLOYMENT.toString()); app.setConfigurationType(RuntimeConfigurationType.valueOf(value.toUpperCase())); } catch (ConfigurationException e) { throw new JEFMonException("Exception while reading dev.propeties.", e); } }
From source file:org.efaps.ui.wicket.EFapsApplication.java
License:Apache License
/** * @see org.apache.wicket.protocol.http.WebApplication#init() *//*from w w w. j a v a 2 s .c om*/ @Override protected void init() { super.init(); final String appKey = getInitParameter(AbstractFilter.INITPARAM_APP_KEY); final String loginRolesTmp = getInitParameter(AbstractFilter.INITPARAM_LOGIN_ROLES); final Set<UUID> temp = new HashSet<>(); if (loginRolesTmp != null) { final String[] loginRolesAr = loginRolesTmp.split(","); for (final String loginRole : loginRolesAr) { temp.add(UUID.fromString(loginRole)); } } AppAccessHandler.init(appKey, temp); final Map<String, String> map = new HashMap<>(); for (final AppConfigHandler.Parameter param : AppConfigHandler.Parameter.values()) { final String configTmp = getInitParameter(param.getKey()); if (configTmp != null) { map.put(param.getKey(), configTmp); } } if (!map.containsKey(AppConfigHandler.Parameter.TEMPFOLDER.getKey())) { map.put(AppConfigHandler.Parameter.TEMPFOLDER.getKey(), getStoreSettings().getFileStoreFolder().toURI().toString()); } AppConfigHandler.init(map); getJavaScriptLibrarySettings().setJQueryReference(new DynamicJQueryResourceReference()); getApplicationSettings().setPageExpiredErrorPage(LoginPage.class); getApplicationSettings().setInternalErrorPage(UnexpectedErrorPage.class); final CompoundClassResolver resolver = new CompoundClassResolver(); resolver.add(new DefaultClassResolver()); resolver.add(new AbstractClassResolver() { @Override public ClassLoader getClassLoader() { return EFapsClassLoader.getInstance(); } }); getApplicationSettings().setClassResolver(resolver); getApplicationSettings().setUploadProgressUpdatesEnabled(true); getDebugSettings().setAjaxDebugModeEnabled(false); getDebugSettings().setDevelopmentUtilitiesEnabled(false); setPageManagerProvider(new EFapsPageManagerProvider(this)); getStoreSettings().setMaxSizePerSession( Bytes.megabytes(Configuration.getAttributeAsInteger(ConfigAttribute.STORE_MAXSIZEPERSESSION))); getStoreSettings() .setInmemoryCacheSize(Configuration.getAttributeAsInteger(ConfigAttribute.STORE_INMEMORYCACHE)); getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setCompressWhitespace(true); getMarkupSettings().setAutomaticLinking(false); getRequestCycleSettings().setGatherExtendedBrowserInfo(true); getRequestCycleListeners().add(new EFapsRequestCycleListener()); getRequestLoggerSettings().setRequestLoggerEnabled(false); getSecuritySettings().setAuthorizationStrategy(new EFapsFormBasedAuthorizationStartegy()); getResourceSettings().setJavaScriptCompressor(new DefaultJavaScriptCompressor()); // allow svg resources final IPackageResourceGuard guard = getResourceSettings().getPackageResourceGuard(); if (guard instanceof SecurePackageResourceGuard) { ((SecurePackageResourceGuard) guard).addPattern("+*.svg"); } setHeaderResponseDecorator(new IHeaderResponseDecorator() { @Override public IHeaderResponse decorate(final IHeaderResponse _response) { return new EFapsResourceAggregator(_response); } }); getRequestCycleSettings().addResponseFilter(new IResponseFilter() { @Override public AppendingStringBuffer filter(final AppendingStringBuffer _responseBuffer) { final AppendingStringBuffer ret; if (RequestCycle.get().getActiveRequestHandler() instanceof ACAjaxRequestTarget) { ret = new AppendingStringBuffer().append(_responseBuffer.subSequence(0, _responseBuffer.length() - XmlPartialPageUpdate.END_ROOT_ELEMENT.length())); } else { ret = _responseBuffer; } return ret; } }); }