/** * returns the {@link IBootstrapSettings} which are assigned to current application * * @return assigned {@link IBootstrapSettings} */ public static IBootstrapSettings getSettings() { if (Application.exists()) { return getSettings(Application.get()); } throw new IllegalStateException("there is no active application assigned to this thread."); }
/** * returns the {@link IBootstrapSettings} which are assigned to current application * * @return assigned {@link IBootstrapSettings} * @throws IllegalStateException if there's no application bound to current thread */ public static IBootstrapSettings getSettings() { if (Application.exists()) { return getSettings(Application.get()); } throw new IllegalStateException("there is no active application assigned to this thread."); }
private static String defaultEncryptionKey(String cookieKey) { if (Application.exists()) { return Application.get().getName(); } return cookieKey; }
private static String defaultEncryptionKey(String cookieKey) { if (Application.exists()) { return Application.get().getName(); } return cookieKey; }
/** * @return The configured version of Bootstrap */ protected String getVersion() { String version = IBootstrapSettings.VERSION; if (Application.exists()) { version = Bootstrap.getSettings().getVersion(); } return version; } }
/** * @return the default markup encoding or if no application is assigned: "UTF-8" */ protected Charset charset() { if (Application.exists()) { final String charset = Application.get().getMarkupSettings().getDefaultMarkupEncoding(); if (!Strings.isNullOrEmpty(charset)) { return Charset.forName(charset); } } return Charsets.UTF_8; }
private boolean useCdnResources() { boolean result = false; if (Application.exists()) { IBootstrapSettings settings = Bootstrap.getSettings(); result = settings.useCdnResources(); } return result; }
private void writeObject(ObjectOutputStream output) throws IOException { if (stopping && Application.exists()) { if (Application.get().getConfigurationType().equals(RuntimeConfigurationType.DEVELOPMENT)) { throw new WicketRuntimeException("Stopped plugin is still being referenced: " + (plugin != null ? plugin.getClass().getName() : "unknown")); } } output.defaultWriteObject(); }
private int getRequestsWindowSize() { int requestsWindowSize = 0; if (Application.exists()) { requestsWindowSize = Application.get() .getRequestLoggerSettings() .getRequestsWindowSize(); } return requestsWindowSize; } }
private int getRequestsWindowSize() { int requestsWindowSize = 0; if (Application.exists()) { requestsWindowSize = Application.get() .getRequestLoggerSettings() .getRequestsWindowSize(); } return requestsWindowSize; } }
/** * Constructor */ public Behavior() { if (Application.exists()) { Application.get().getBehaviorInstantiationListeners().onInstantiation(this); } }
/** * Constructor */ public Behavior() { if (Application.exists()) { Application.get().getBehaviorInstantiationListeners().onInstantiation(this); } }
/** * Returns whether to redirect when there is pageMap specified in bookmarkable URL * * @return true if always redirect when page map is specified */ protected boolean alwaysRedirectWhenPageMapIsSpecified() { // returns true if the pageId is unique, so we can get rid of the // pageMap name in the url this way return Application.exists() && Application.get().getSessionSettings().isPageIdUniquePerSession(); }
/** * Returns whether to redirect when there is pageMap specified in bookmarkable URL * * @return */ protected boolean alwaysRedirectWhenPageMapIsSpecified() { // returns true if the pageId is unique, so we can get rid of the // pageMap name in the url this way return Application.exists() && Application.get().getSessionSettings().isPageIdUniquePerSession(); }
@Override public SUser getUserIfAvailable() { String username = null; if (Application.exists() && SingularSession.exists()) { username = SingularSession.get().getUsername(); } if (username != null) { return actorDAO.retrieveByUserCod(username); } else { return null; } }
@Override public List<HeaderItem> getDependencies() { List<HeaderItem> dependencies = super.getDependencies(); ResourceReference wicketEventReference = WicketAjaxJQueryResourceReference.get(); if (Application.exists()) { wicketEventReference = Application.get().getJavaScriptLibrarySettings().getWicketAjaxReference(); } dependencies.add(JavaScriptHeaderItem.forReference(wicketEventReference)); return dependencies; } };
@Override public List<HeaderItem> getDependencies() { List<HeaderItem> dependencies = super.getDependencies(); ResourceReference wicketEventReference = WicketAjaxJQueryResourceReference.get(); if (Application.exists()) { wicketEventReference = Application.get().getJavaScriptLibrarySettings().getWicketAjaxReference(); } dependencies.add(JavaScriptHeaderItem.forReference(wicketEventReference)); return dependencies; } };
@Programmatic @Override public Locale getLocale() { // Request Cycle can be null, e.g. during the start of an application RequestCycle requestCycle = RequestCycle.get(); if (!Application.exists() || requestCycle == null) { // eg if request from RO viewer return null; } return RequestCycle.get().getRequest().getLocale(); }
private void onInternalDetach() { if (Session.exists()) { Session.get().internalDetach(); } if (Application.exists()) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (requestLogger != null) requestLogger.performLogging(); } }
private void onInternalDetach() { if (Session.exists()) { Session.get().internalDetach(); } if (Application.exists()) { IRequestLogger requestLogger = Application.get().getRequestLogger(); if (requestLogger != null) requestLogger.performLogging(); } }