/** * Construct. * * @param sessionId * @param application * @param name */ private SecondLevelCachePageMap(String sessionId, Application application, String name) { super(name); applicationKey = application.getApplicationKey(); this.sessionId = sessionId; }
/** * Construct. * * @param sessionId * @param application * @param name */ private SecondLevelCachePageMap(String sessionId, Application application, String name) { super(name); applicationKey = application.getApplicationKey(); this.sessionId = sessionId; }
/** * Construct. * * @param application */ public FrameworkSettings(final Application application) { serializer = new JavaSerializer(application.getApplicationKey()); }
/** * Construct. * * @param workDir */ public SimpleSynchronousFilePageStore(File workDir) { defaultWorkDir = workDir; defaultWorkDir.mkdirs(); appName = Application.get().getApplicationKey(); }
/** * Construct. * * @param application */ public FrameworkSettings(final Application application) { serializer = new JavaSerializer(application.getApplicationKey()); }
/** * Construct. * * @param workDir */ public SimpleSynchronousFilePageStore(File workDir) { defaultWorkDir = workDir; defaultWorkDir.mkdirs(); appName = Application.get().getApplicationKey(); }
/** * Construct. * * @param dir * The directory to save to. */ public TestFilePageStore(File dir) { defaultWorkDir = dir; appName = Application.get().getApplicationKey(); }
/** * Construct. */ public AtmosphereBehavior() { applicationKey = Application.get().getApplicationKey(); }
/** * Construct. * * @param dir * The directory to save to. */ public TestFilePageStore(File dir) { defaultWorkDir = dir; appName = Application.get().getApplicationKey(); }
/** * Construct. */ public AtmosphereBehavior() { applicationKey = Application.get().getApplicationKey(); }
public static Brix get(Application application) { if (application == null) { throw new IllegalArgumentException("application cannot be null"); } Brix brix = application.getMetaData(APP_KEY); if (brix == null) { throw new IllegalStateException( "Could not find instance of Brix associated with application: " + application.getApplicationKey() + ". Make sure Brix.attachTo(this) was called in application's init() method"); } return brix; }
/** * Retrieves the InjectionHolder responsible for the active {@link org.apache.wicket.Application}. Therefore this will only work in an * active Wicket context! * * @return Injector */ public static PaxWicketInjector getInjector() { String applicationName = Application.get().getApplicationKey(); PaxWicketInjector injector = null; synchronized (instance.injectorMap) { injector = instance.injectorMap.get(applicationName); } if (injector == null) { throw new IllegalStateException(String.format("No Injector is set for application %s", Application.get().getApplicationKey())); } return injector; }
/** * Retrieves the InjectionHolder responsible for the active {@link Application}. Therefore this will only work in an * active Wicket context! */ public static PaxWicketInjector getInjector() { String applicationName = Application.get().getApplicationKey(); PaxWicketInjector injector = null; synchronized (instance.injectorMap) { injector = instance.injectorMap.get(applicationName); } if (injector == null) { throw new IllegalStateException(String.format("No Injector is set for application %s", Application.get().getApplicationKey())); } return injector; }
/** * Retrieves the InjectionHolder responsible for the active {@link org.apache.wicket.Application}. Therefore this will only work in an * active Wicket context! * * @return Injector */ public static PaxWicketInjector getInjector() { String applicationName = Application.get().getApplicationKey(); PaxWicketInjector injector = null; synchronized (instance.injectorMap) { injector = instance.injectorMap.get(applicationName); } if (injector == null) { throw new IllegalStateException(String.format("No Injector is set for application %s", Application.get().getApplicationKey())); } return injector; }
protected ConfigurationParameters getApplicationParameters() { ConfigurationParameters params = parameters.get(Application.get().getApplicationKey()); if (params == null) { try { Application app = Application.get(); if (app.getApplicationKey() == null) { throw new WicketRuntimeException(); } params = new ConfigurationParameters(); parameters.put(app.getApplicationKey(), params); } catch (WicketRuntimeException wre) { throw new IllegalStateException("Application is not ready."); } } return params; }
/** * Configures the specified application. This method allows for CdiConfiguration to be setup at the Application * Level. Use the {@link CdiWicketFilter} as the filterClass or add the {@link CdiWebApplicationFactory} to the * Standard WicketFilter with init-param applicationFactoryClassName for setup during Application Initialization. * This allows for Injected classes in the WebApplication to be ready before init() is called. * * @param application * @deprecated Application Level Configuration replaced with {@link CdiWicketFilter} */ @Deprecated public void configure(Application application) { ConfigurationParameters params = getApplicationParameters(); configure(application.getApplicationKey(), application, params); }
public ICrypt newCrypt() { WebRequestCycle rc = (WebRequestCycle)RequestCycle.get(); // get http session, create if necessary HttpSession session = rc.getWebRequest().getHttpServletRequest().getSession(true); // retrieve or generate encryption key from session final String keyAttr = rc.getApplication().getApplicationKey() + "." + getClass().getName(); String key = (String)session.getAttribute(keyAttr); if (key == null) { // generate new key key = session.getId() + "." + UUID.randomUUID().toString(); session.setAttribute(keyAttr, key); } // build the crypt based on session key ICrypt crypt = new SunJceCrypt(); crypt.setKey(key); return crypt; } }
/** * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT. */ protected void internalDestroy() { // Clear caches of Class keys so the classloader can be garbage // collected (WICKET-625) PropertyResolver.destroy(this); getMarkupSettings().getMarkupCache().shutdown(); onDestroy(); callDestroyers(); applicationKeyToApplication.remove(getApplicationKey()); Session.unset(); RequestContext.unset(); RequestCycle.set(null); }
/** * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT. */ public void internalDestroy() { applicationListeners.onBeforeDestroyed(this); // destroy detach listener final IDetachListener detachListener = getFrameworkSettings().getDetachListener(); if (detachListener != null) { detachListener.onDestroyListener(); } // Clear caches of Class keys so the classloader can be garbage // collected (WICKET-625) PropertyResolver.destroy(this); MarkupFactory markupFactory = getMarkupSettings().getMarkupFactory(); if (markupFactory.hasMarkupCache()) { markupFactory.getMarkupCache().shutdown(); } onDestroy(); destroyInitializers(); internalGetPageManager().destroy(); getSessionStore().destroy(); applicationKeyToApplication.remove(getApplicationKey()); }
public void init(final Application application) { // disable ModificationWatcher application.getResourceSettings().setResourcePollFrequency(null); // use plain JDK Object(Input|Output)Stream ISerializer serializer = new GaeObjectSerializer(application.getApplicationKey()); application.getFrameworkSettings().setSerializer(serializer); // save older version of pages in the HttpSession final IDataStoreEvictionStrategy evictionStrategy; if (application instanceof GaeApplication) { evictionStrategy = ((GaeApplication)application).getEvictionStrategy(); } else { evictionStrategy = new PageNumberEvictionStrategy(10); } application.setPageManagerProvider(new GaePageManagerProvider(application, evictionStrategy)); // disable file cleaning because it starts a new thread application.getResourceSettings().setFileCleaner(null); }