Example usage for org.apache.wicket.util.lang Bytes gigabytes

List of usage examples for org.apache.wicket.util.lang Bytes gigabytes

Introduction

In this page you can find the example usage for org.apache.wicket.util.lang Bytes gigabytes.

Prototype

public static Bytes gigabytes(final double gigabytes) 

Source Link

Document

Instantiate immutable Bytes value object..

Usage

From source file:nl.knaw.dans.dccd.web.WicketApplication.java

License:Apache License

@Override
protected void init() {
    try {/*from  w w w  .  j a  va 2 s .  c  om*/
        DccdUserService.getService().createInitialAdminUser();
    } catch (UserServiceException e) {
        logger.warn("Failed to create initial LDAP users", e);
    }

    IApplicationSettings settings = getApplicationSettings();

    // Note: maybe get it from the dccd configuration settings file
    settings.setDefaultMaximumUploadSize(Bytes.gigabytes(1));

    //TODO this doesn't work anymore, needs debugging!
    List<IStringResourceLoader> rloaders = getResourceSettings().getStringResourceLoaders();
    getResourceSettings().addStringResourceLoader(
            //new DebugStringResourceLoader(rloaders, "&lt;", "&gt", Locale.ENGLISH)
            new DebugStringResourceLoader(rloaders, "{", "}", Locale.ENGLISH));

    //settings.setAccessDeniedPage(AccessDeniedPage.class);
    //settings.setPageExpiredErrorPage(PageExpiredErrorPage.class);
    settings.setInternalErrorPage(InternalErrorPage.class);

    // uploading stuff
    EasyUploadStatusCommand uploadStatusResource = new EasyUploadStatusCommand();
    //uploadStatusResource.registerAsSharedResource(this);
    getSharedResources().add(uploadStatusResource.RESOURCE_NAME, uploadStatusResource);
    EasyUploadCancelCommand uploadCancelResource = new EasyUploadCancelCommand();
    //uploadCancelResource.registerAsSharedResource(this);
    getSharedResources().add(uploadCancelResource.RESOURCE_NAME, uploadCancelResource);

    // for the Combined Upload Status on the UploadFilesPage
    CombinedUploadStatusCommand combinedUploadStatusResource = new CombinedUploadStatusCommand();
    combinedUploadStatusResource.registerAsSharedResource(this);

    // search pages are bookmarkable
    mountBookmarkablePage("/search", PublicSearchResultPage.class);
    mountBookmarkablePage("/advancedsearch", AdvSearchPage.class);

    // other (main) pages 
    mountBookmarkablePage("/organisations", OrganisationListPage.class);
    mountBookmarkablePage("/about", AboutPage.class);
    mountBookmarkablePage("/contact", ContactPage.class);

    mountBookmarkablePage("/termsofuse", TermsOfUsePage.class);
    mountBookmarkablePage("/acknowledgements", AcknowledgementsPage.class);

    mountBookmarkablePage("/myprojects", MyProjectsSearchResultPage.class);
    mountBookmarkablePage("/upload", UploadFilesPage.class);
    mountBookmarkablePage("/members", MemberListPage.class);

    // allows to view a project using id's like the SID, but should be PID in the future
    //mountBookmarkablePage("/project", ProjectViewPage.class);
    // RESTfull encoding is nicer
    mount(new MixedParamUrlCodingStrategy("/project", ProjectViewPage.class,
            new String[] { ProjectViewPage.SID_PARAM_KEY, ProjectViewPage.STREAMID_PARAM_KEY }));
}