Search in sources :

Example 11 with Bytes

use of org.apache.wicket.util.lang.Bytes in project wicket by apache.

the class UrlResourceStreamTest method lastModifiedForResourceInJar.

/**
 * lastModified() shouldn't change the content length if the file isn't really changed.
 *
 * @throws IOException
 */
@Test
public void lastModifiedForResourceInJar() throws IOException {
    String anyClassInJarFile = "/java/lang/String.class";
    URL url = getClass().getResource(anyClassInJarFile);
    UrlResourceStream stream = new UrlResourceStream(url);
    Bytes length = stream.length();
    stream.lastModifiedTime();
    assertEquals(stream.length(), length);
    stream.close();
}
Also used : UrlResourceStream(org.apache.wicket.core.util.resource.UrlResourceStream) Bytes(org.apache.wicket.util.lang.Bytes) URL(java.net.URL) Test(org.junit.Test)

Example 12 with Bytes

use of org.apache.wicket.util.lang.Bytes in project wicket by apache.

the class DefaultPageManagerProvider method newDataStore.

protected IDataStore newDataStore() {
    StoreSettings storeSettings = getStoreSettings();
    Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
    File fileStoreFolder = storeSettings.getFileStoreFolder();
    return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession);
}
Also used : StoreSettings(org.apache.wicket.settings.StoreSettings) Bytes(org.apache.wicket.util.lang.Bytes) DiskDataStore(org.apache.wicket.pageStore.DiskDataStore) File(java.io.File)

Aggregations

Bytes (org.apache.wicket.util.lang.Bytes)12 Test (org.junit.Test)5 File (java.io.File)2 IModel (org.apache.wicket.model.IModel)2 StoreSettings (org.apache.wicket.settings.StoreSettings)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 FileItem (org.apache.commons.fileupload.FileItem)1 FileUploadException (org.apache.commons.fileupload.FileUploadException)1 ServletFileUpload (org.apache.commons.fileupload.servlet.ServletFileUpload)1 Page (org.apache.wicket.Page)1 UrlResourceStream (org.apache.wicket.core.util.resource.UrlResourceStream)1 SessionSizeModel (org.apache.wicket.devutils.inspector.SessionSizeModel)1 WebPage (org.apache.wicket.markup.html.WebPage)1 DiskDataStore (org.apache.wicket.pageStore.DiskDataStore)1