Example usage for org.apache.wicket.markup.html PackageResourceGuard PackageResourceGuard

List of usage examples for org.apache.wicket.markup.html PackageResourceGuard PackageResourceGuard

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html PackageResourceGuard PackageResourceGuard.

Prototype

public PackageResourceGuard() 

Source Link

Document

Construct.

Usage

From source file:org.cast.isi.ISIApplication.java

License:Open Source License

protected void init() {
    log.debug("Starting ISI Application Init");

    // TODO heikki find out which component requires this, and replace it with something empty in case this is not enabled
    getDebugSettings().setDevelopmentUtilitiesEnabled(true);

    // Set xml content Section and Page based on property file - these have to be set before
    // the super.init is called
    sectionElement = configuration.getProperty("isi.sectionElement");
    pageElement = configuration.getProperty("isi.pageElement");
    super.init();

    ISIEmailService.useAsServiceInstance();
    responseMetadata = new ResponseMetadata();

    getMarkupSettings().setDefaultBeforeDisabledLink("");
    getMarkupSettings().setDefaultAfterDisabledLink("");

    // Strip tags so that jQuery traversal doesn't break
    getMarkupSettings().setStripWicketTags(true);

    // Tells ResourceFinder to look in skin directory before looking in context dir.
    if (getCustomSkinDir() != null)
        getResourceSettings().addResourceFolder(getCustomSkinDir());
    getResourceSettings().addResourceFolder(getSkinDir());

    // Content elements are taggable
    TagService.get().configureTaggableClass('P', ContentElement.class);
    String requestedTags = configuration.getProperty("isi.defaultTags");
    if (StringUtils.isEmpty(requestedTags)) {
        requestedTags = "";
    }// w ww.j  av a  2  s . c  o  m
    if (!Strings.isEmpty(requestedTags))
        TagService.get().setDefaultTags(Arrays.asList(requestedTags.split("\\s*,\\s*")));

    configureResponseTypes();
    configureResponseSort();

    // load the xml documents and xsl transformers
    loadXmlFiles();
    loadXslFiles();

    // Tell dialog border to not use it's css
    List<ResourceReference> noStylesheets = Collections.emptyList();
    DialogBorder.setStyleReferences(noStylesheets);

    // TODO heikki: SecurePackageResourceGuard subclasses cause errors for some resources. For the moment, use PackageResourceGuard.
    //getResourceSettings().setPackageResourceGuard(new ISIPackageResourceGuard());
    //getResourceSettings().setPackageResourceGuard(new CwmPackageResourceGuard());
    getResourceSettings().setPackageResourceGuard(new PackageResourceGuard());

    this.getRequestCycleListeners().add(new AbstractRequestCycleListener() {
        @Override
        public IRequestHandler onException(RequestCycle cycle, Exception x) {
            if (x instanceof StalePageException)
                return null; // use normal exception processing for these
            PageParameters pageParameters = requestParameters2PageParameters(
                    cycle.getRequest().getQueryParameters());
            return new RenderPageRequestHandler(
                    new PageProvider(new ExceptionPage(pageParameters, new RuntimeException(x))));
        }
    });

    if (highlightsPanelOn)
        registerHighlighters();

    // Generally helpful log statement.
    if (!RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        log.warn("********************** Wicket is running in Deployment Mode **********************");
    }
    log.debug("Finished ISI Application Init");
}