Example usage for org.apache.wicket.markup.head PriorityFirstComparator PriorityFirstComparator

List of usage examples for org.apache.wicket.markup.head PriorityFirstComparator PriorityFirstComparator

Introduction

In this page you can find the example usage for org.apache.wicket.markup.head PriorityFirstComparator PriorityFirstComparator.

Prototype

public PriorityFirstComparator(boolean renderPageFirst) 

Source Link

Document

Construct.

Usage

From source file:com.evolveum.midpoint.web.security.MidPointApplication.java

License:Apache License

@Override
public void init() {
    super.init();

    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    IResourceSettings resourceSettings = getResourceSettings();
    resourceSettings.setHeaderItemComparator(new PriorityFirstComparator(true));

    resourceSettings.setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setDefaultBeforeDisabledLink("");
    getMarkupSettings().setDefaultAfterDisabledLink("");

    if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        getDebugSettings().setAjaxDebugModeEnabled(true);
        getDebugSettings().setDevelopmentUtilitiesEnabled(true);
    }//from w w  w . jav  a2s  . c  o m

    //pretty url for resources (e.g. images)
    mountFiles(ImgResources.BASE_PATH, ImgResources.class);

    //exception handling an error pages
    IApplicationSettings appSettings = getApplicationSettings();
    appSettings.setAccessDeniedPage(PageError401.class);
    appSettings.setInternalErrorPage(PageError.class);
    appSettings.setPageExpiredErrorPage(PageError.class);

    mount(new MountedMapper("/error", PageError.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/401", PageError401.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/403", PageError403.class, MidPointPageParametersEncoder.ENCODER));
    mount(new MountedMapper("/error/404", PageError404.class, MidPointPageParametersEncoder.ENCODER));

    getRequestCycleListeners().add(new AbstractRequestCycleListener() {

        @Override
        public IRequestHandler onException(RequestCycle cycle, Exception ex) {
            return new RenderPageRequestHandler(new PageProvider(new PageError(ex)));
        }
    });

    // todo wicket atmosphere was disabled because of form file upload and redirection url problems.
    //        //ajax push (just an experiment)
    //        eventBus = new EventBus(this);
    //        eventBus.getParameters().setLogLevel(AtmosphereLogLevel.DEBUG);
    //
    //        //enable simple task notifications here
    //        taskManager.registerTaskListener(new TaskListener() {
    //
    //            @Override
    //            public void onTaskStart(Task task) {
    //                EventBus bus = getEventBus();
    //                bus.post(new NotifyMessage("Task start", WebMiscUtil.getOrigStringFromPoly(task.getName()) + " started.",
    //                        OperationResultStatus.SUCCESS));
    //            }
    //
    //            @Override
    //            public void onTaskFinish(Task task, TaskRunResult runResult) {
    //                EventBus bus = getEventBus();
    //                bus.post(new NotifyMessage("Task finish", WebMiscUtil.getOrigStringFromPoly(task.getName()) + " finished.",
    //                        OperationResultStatus.parseStatusType(task.getResultStatus())));
    //            }
    //
    //            @Override
    //            public void onTaskThreadStart(Task task, boolean isRecovering) {
    //
    //            }
    //
    //            @Override
    //            public void onTaskThreadFinish(Task task) {
    //
    //            }
    //        });

    //descriptor loader, used for customization
    new DescriptorLoader().loadData(this);
}