List of usage examples for org.apache.wicket Application get
public static Application get()
From source file:org.wicketstuff.push.dojo.AbstractDefaultDojoBehavior.java
License:Apache License
/** * @see wicket.ajax.AbstractDefaultAjaxBehavior#renderHead(wicket.markup.html.IHeaderResponse) *///from www .j a va 2 s. co m @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); // Dojo configuration final StringBuffer dojoConfig = new StringBuffer(); dojoConfig.append("var djConfig = {};\n"); // enable dojo debug if our configuration type is DEVELOPMENT final RuntimeConfigurationType configurationType = Application.get().getConfigurationType(); if (configurationType.equals(RuntimeConfigurationType.DEVELOPMENT)) { dojoConfig.append("djConfig.isDebug = true;\n"); dojoConfig.append("djConfig.parseOnLoad = true;\n"); } else { dojoConfig.append("djConfig.isDebug = false;\n"); } // render dojo config response.render(JavaScriptHeaderItem.forScript(dojoConfig.toString(), COMETD_DOJO_CONFIG_ID)); response.render(JavaScriptHeaderItem.forReference(getDojoResourceReference())); }
From source file:org.wicketstuff.push.dojo.AbstractDefaultDojoBehavior.java
License:Apache License
/** * Get the reference to the Dojo scripts. * //from w w w .ja va 2 s . co m * @return */ public ResourceReference getDojoResourceReference() { if (Application.get().getMetaData(USE_CUSTOM_DOJO_DIST) == null || !(Application.get().getMetaData(USE_CUSTOM_DOJO_DIST) instanceof PackageResourceReference)) { return DOJO; } else { return Application.get().getMetaData(USE_CUSTOM_DOJO_DIST); } }
From source file:org.wicketstuff.push.timer.TimerPushService.java
License:Apache License
public static TimerPushService get() { return get(Application.get()); }
From source file:org.wicketstuff.rest.resource.AbstractRestResource.java
License:Apache License
/** * Utility method to convert string values to the corresponding objects. * * @param clazz//from w w w. j av a 2s .co m * the type of the object we want to obtain. * @param value * the string value we want to convert. * @return the object corresponding to the converted string value, or null if value parameter is * null */ public static Object toObject(Class<?> clazz, String value) throws IllegalArgumentException { if (value == null) return null; // we use the standard Wicket conversion mechanism to obtain the // converted value. try { IConverter<?> converter = Application.get().getConverterLocator().getConverter(clazz); return converter.convertToObject(value, Session.get().getLocale()); } catch (Exception e) { WebResponse response = getCurrentWebResponse(); response.setStatus(400); log.debug("Could not find a suitable converter for value '" + value + "' of type '" + clazz + "'"); return null; } }
From source file:org.wicketstuff.rest.utils.wicket.bundle.DefaultBundleResolver.java
License:Apache License
@Override public String getMessage(String key, Map<String, Object> vars) { String resourceValue = null;//ww w . java 2 s . c o m List<IStringResourceLoader> resourceLoaders = Application.get().getResourceSettings() .getStringResourceLoaders(); Locale locale = Session.get().getLocale(); String style = Session.get().getStyle(); outerloop: for (IStringResourceLoader stringResourceLoader : resourceLoaders) { for (Class<?> clazz : targetClasses) { resourceValue = stringResourceLoader.loadStringResource(clazz, key, locale, style, null); if (resourceValue != null) { break outerloop; } } } StringConverterInterpolator interpolator = new StringConverterInterpolator( resourceValue != null ? resourceValue : "", vars, false, locale); return interpolator.toString(); }
From source file:org.wicketstuff.rest.utils.wicket.bundle.StringConverterInterpolator.java
License:Apache License
private IConverter<?> getConverter(Class<? extends Object> clazz) { return Application.get().getConverterLocator().getConverter(clazz); }
From source file:org.wicketstuff.rest.utils.wicket.DefaultBundleResolver.java
License:Apache License
@Override public String getMessage(String key, Map<String, Object> vars) { String resourceValue = null;//from www .j av a2s . co m List<IStringResourceLoader> resourceLoaders = Application.get().getResourceSettings() .getStringResourceLoaders(); Locale locale = Session.get().getLocale(); String style = Session.get().getStyle(); for (IStringResourceLoader stringResourceLoader : resourceLoaders) { resourceValue = stringResourceLoader.loadStringResource(clazz, key, locale, style, null); if (resourceValue != null) break; } StringConverterInterpolator interpolator = new StringConverterInterpolator( resourceValue != null ? resourceValue : "", vars, false, locale); return interpolator.toString(); }
From source file:org.wicketstuff.rest.utils.wicket.StringConverterInterpolator.java
License:Apache License
private IConverter getConverter(Class<? extends Object> clazz) { return Application.get().getConverterLocator().getConverter(clazz); }
From source file:org.wicketstuff.security.checks.AbstractSecurityCheck.java
License:Apache License
/** * Utility method to get the factory to create {@link WaspAction}s. * // ww w. ja v a 2s.c o m * @return the factory * @see WaspApplication#getActionFactory() */ protected ActionFactory getActionFactory() { return ((WaspApplication) Application.get()).getActionFactory(); }
From source file:org.wicketstuff.security.checks.AbstractSecurityCheck.java
License:Apache License
/** * Utility method to get the class of the loginpage. * //from w ww. jav a 2s .c o m * @return the login page * @see WaspApplication#getLoginPage() */ protected final Class<? extends Page> getLoginPage() { return ((WaspApplication) Application.get()).getLoginPage(); }