Example usage for org.apache.wicket.request.resource ContextRelativeResourceReference ContextRelativeResourceReference

List of usage examples for org.apache.wicket.request.resource ContextRelativeResourceReference ContextRelativeResourceReference

Introduction

In this page you can find the example usage for org.apache.wicket.request.resource ContextRelativeResourceReference ContextRelativeResourceReference.

Prototype

public ContextRelativeResourceReference(final String name, final String minPostfix) 

Source Link

Document

Instantiates a new context relative resource reference for the given name.

Usage

From source file:com.gitblit.wicket.pages.BasePage.java

License:Apache License

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);
    response.render(JavaScriptHeaderItem.forReference(JQueryResourceReference.get()));

    if (app().settings().getBoolean(Keys.web.useResponsiveLayout, true)) {
        response.render(CssHeaderItem.forReference(
                Application.get().getSharedResources().get(Bootstrap.BOOTSTRAP_RESPONSIVE_CSS_RESOURCE)));
    }/*from  w ww  .  j  av  a  2  s . c  om*/
    if (app().settings().getBoolean(Keys.web.hideHeader, false)) {
        response.render(
                CssHeaderItem.forReference(new ContextRelativeResourceReference("/hideheader.css", false)));
    }
}

From source file:de.tudarmstadt.ukp.clarin.webanno.webapp.WicketApplication.java

License:Apache License

@Override
protected void init() {
    super.init();
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    if (!isInitialized) {
        // Enable dynamic switching between JQuery 1 and JQuery 2 based on the browser
        // identification. 
        getJavaScriptLibrarySettings().setJQueryReference(new DynamicJQueryResourceReference());

        mountPage("/login.html", getSignInPageClass());
        mountPage("/welcome.html", getHomePage());

        // Mount the other pages via @MountPath annotation on the page classes
        new AnnotatedMountScanner().scanPackage("de.tudarmstadt.ukp.clarin.webanno").mount(this);

        // FIXME Handling brat font/css resources should be moved to brat module
        mountResource("/style-vis.css",
                new CssResourceReference(WebAnnoResources.class, "client/css/style-vis.css"));
        mountResource("/style-ui.css",
                new CssResourceReference(WebAnnoResources.class, "client/css/style-ui.css"));
        mountResource("/static/fonts/PT_Sans-Caption-Web-Regular.ttf",
                new PackageResourceReference(WebAnnoResources.class, "fonts/PT_Sans-Caption-Web-Regular.ttf"));
        // For an unknown reason, this file doesn't load from the package... so still keeping
        // it in static under the webapp
        //            mountResource("/static/fonts/Liberation_Sans-Regular.ttf",
        //                    new PackageResourceReference(WebAnnoResources.class, "fonts/Liberation_Sans-Regular.ttf"));

        Properties settings = SettingsUtil.getSettings();
        String logoValue = settings.getProperty("style.logo");
        if (StringUtils.isNotBlank(logoValue) && new File(logoValue).canRead()) {
            getSharedResources().add("logo", new FileSystemResource(new File(logoValue)));
            mountResource("/images/logo.png", new SharedResourceReference("logo"));
        } else {//  w ww . jav  a 2s.co m
            mountResource("/images/logo.png", new ContextRelativeResourceReference("images/logo.png", false));
        }

        // Display stack trace instead of internal error
        if ("true".equalsIgnoreCase(settings.getProperty("debug.showExceptionPage"))) {
            getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);
        }

        isInitialized = true;
    }
}