protected IDataStore newDataStore() { StoreSettings storeSettings = getStoreSettings(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); File fileStoreFolder = storeSettings.getFileStoreFolder(); return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession); }
@Override public int getInmemoryCacheSize() { return application.getStoreSettings().getInmemoryCacheSize(); }
@Override public int getAsynchronousQueueCapacity() { return application.getStoreSettings().getAsynchronousQueueCapacity(); }
@Override public void init(WebApplication webApplication) { StoreSettings storeSettings = webApplication.getStoreSettings(); if (props.getAsynchronous() != null) { storeSettings.setAsynchronous(props.getAsynchronous()); } if (props.getAsynchronousQueueCapacity() != null) { storeSettings.setAsynchronousQueueCapacity(props.getAsynchronousQueueCapacity()); } if (props.getFileStoreFolder() != null) { storeSettings.setFileStoreFolder(new File(props.getFileStoreFolder())); } if (props.getInmemoryCacheSize() != null) { storeSettings.setInmemoryCacheSize(props.getInmemoryCacheSize()); } storeSettings.setMaxSizePerSession(TypeParser.parse(props.getSessionSize(), props.getSessionUnit())); wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass()) .withDetail("properties", props) .build()); }
@Override public IPageManager apply(IPageManagerContext pageManagerContext) { IDataStore dataStore = newDataStore(); StoreSettings storeSettings = getStoreSettings(); IPageStore pageStore; if (dataStore.canBeAsynchronous() && storeSettings.isAsynchronous()) { int capacity = storeSettings.getAsynchronousQueueCapacity(); dataStore = new AsynchronousDataStore(dataStore, capacity); pageStore = newPageStore(dataStore); if (pageStore.canBeAsynchronous()) { pageStore = new AsynchronousPageStore(pageStore, capacity); } } else { pageStore = newPageStore(dataStore); } return new PageStoreManager(application.getName(), pageStore, pageManagerContext); }
@Override public String getFileStoreFolder() { return application.getStoreSettings().getFileStoreFolder().getAbsolutePath(); }
getMarkupSettings().setStripWicketTags(true); getStoreSettings().setFileStoreFolder(Bootstrap.getTempDir()); getStoreSettings().setInmemoryCacheSize(1000);
@Override public long getMaxSizePerSession() { return application.getStoreSettings().getMaxSizePerSession().bytes(); }
/** * Initializes the page store. */ private void initPageStore() { //pf.configuration.web.cachedPagesPerSession", 10); getStoreSettings().setInmemoryCacheSize(10); // Set custom page store setPageManagerProvider(new DefaultPageManagerProvider(this) { @Override protected IPageStore newPageStore(IDataStore dataStore) { return new InMemoryPageStore(); } }); }
@Override public boolean isAsynchronous() { return application.getStoreSettings().isAsynchronous(); }
@Override public void init() { super.init(); setPageManagerProvider(new RequirementPageManagerProvider(this)); getStoreSettings().setMaxSizePerSession(Bytes.megabytes(20)); getRequestCycleSettings().setTimeout(Duration.minutes(5)); getRequestCycleListeners().add(new SingularRequirementContextListener()); Locale.setDefault(new Locale("pt", "BR"));//NOSONAR getApplicationSettings().setAccessDeniedPage(Page403.class); getApplicationSettings().setPageExpiredErrorPage(Page410.class); // Don't forget to check your Application server for this getApplicationSettings().setDefaultMaximumUploadSize(Bytes.megabytes(10)); getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setStripComments(true); getMarkupSettings().setDefaultMarkupEncoding(StandardCharsets.UTF_8.name()); getComponentOnConfigureListeners().add(component -> { boolean outputId = !component.getRenderBodyOnly(); component.setOutputMarkupId(outputId).setOutputMarkupPlaceholderTag(outputId); }); getComponentInstantiationListeners().add(new SpringComponentInjector(this, getApplicationContext(), true)); new SingularAnnotatedMountScanner().mountPages(this); if (RuntimeConfigurationType.DEVELOPMENT == getConfigurationType()) { getDebugSettings().setComponentPathAttributeName("wicketdebug"); WicketSerializationDebugUtil.configurePageSerializationDebug(this, this.getClass()); } }
@Override public void init(WebApplication webApplication) { StoreSettings storeSettings = webApplication.getStoreSettings(); if (props.getAsynchronous() != null) { storeSettings.setAsynchronous(props.getAsynchronous()); } if (props.getAsynchronousQueueCapacity() != null) { storeSettings.setAsynchronousQueueCapacity(props.getAsynchronousQueueCapacity()); } if (props.getFileStoreFolder() != null) { storeSettings.setFileStoreFolder(new File(props.getFileStoreFolder())); } if (props.getInmemoryCacheSize() != null) { storeSettings.setInmemoryCacheSize(props.getInmemoryCacheSize()); } storeSettings.setMaxSizePerSession(TypeParser.parse(props.getSessionSize(), props.getSessionUnit())); wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass()) .withDetail("properties", props) .build()); }
@Override public IPageManager apply(IPageManagerContext pageManagerContext) { IDataStore dataStore = newDataStore(); StoreSettings storeSettings = getStoreSettings(); IPageStore pageStore; if (dataStore.canBeAsynchronous() && storeSettings.isAsynchronous()) { int capacity = storeSettings.getAsynchronousQueueCapacity(); dataStore = new AsynchronousDataStore(dataStore, capacity); pageStore = newPageStore(dataStore); if (pageStore.canBeAsynchronous()) { pageStore = new AsynchronousPageStore(pageStore, capacity); } } else { pageStore = newPageStore(dataStore); } return new PageStoreManager(application.getName(), pageStore, pageManagerContext); }
protected IDataStore newDataStore() { StoreSettings storeSettings = getStoreSettings(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); File fileStoreFolder = storeSettings.getFileStoreFolder(); return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession); }
/** * Constructor. */ public InMemoryPageStore() { this.cacheSize = Application.get().getStoreSettings().getInmemoryCacheSize(); this.cache = new HashMap<>(); this.indices = new HashMap<>(); }
@Override protected IDataStore newDataStore() { StoreSettings storeSettings = application.getStoreSettings(); File fileStoreFolder = storeSettings.getFileStoreFolder(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); dataStore = new DebugDiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession); return dataStore; } }
protected IPageStore newPageStore(IDataStore dataStore) { int inmemoryCacheSize = getStoreSettings().getInmemoryCacheSize(); ISerializer pageSerializer = application.getFrameworkSettings().getSerializer(); return new DefaultPageStore(pageSerializer, dataStore, inmemoryCacheSize); }
@Override protected IDataStore newDataStore() { StoreSettings storeSettings = application.getStoreSettings(); File fileStoreFolder = storeSettings.getFileStoreFolder(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); dataStore = new DebugDiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession); return dataStore; } }
protected IPageStore newPageStore(IDataStore dataStore) { int inmemoryCacheSize = getStoreSettings().getInmemoryCacheSize(); ISerializer pageSerializer = application.getFrameworkSettings().getSerializer(); return new DefaultPageStore(pageSerializer, dataStore, inmemoryCacheSize); }
final Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); final File fileStoreFolder = storeSettings.getFileStoreFolder(); return new DiskDataStore(this.getName(), fileStoreFolder, maxSizePerSession);