当前位置: 首页>>代码示例>>Java>>正文


Java SecurePackageResourceGuard.addPattern方法代码示例

本文整理汇总了Java中org.apache.wicket.markup.html.SecurePackageResourceGuard.addPattern方法的典型用法代码示例。如果您正苦于以下问题:Java SecurePackageResourceGuard.addPattern方法的具体用法?Java SecurePackageResourceGuard.addPattern怎么用?Java SecurePackageResourceGuard.addPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.wicket.markup.html.SecurePackageResourceGuard的用法示例。


在下文中一共展示了SecurePackageResourceGuard.addPattern方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addResourcePatterns

import org.apache.wicket.markup.html.SecurePackageResourceGuard; //导入方法依赖的package包/类
protected void addResourcePatterns(final SecurePackageResourceGuard securePackageResourceGuard) {
    securePackageResourceGuard.addPattern("+*.ico");
    securePackageResourceGuard.addPattern("+*.webm");
    securePackageResourceGuard.addPattern("+*.ogv");
    securePackageResourceGuard.addPattern("+*.mp4");
    securePackageResourceGuard.addPattern("+*.woff2");
    securePackageResourceGuard.addPattern("+*.map");
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:9,代码来源:WebApplicationInitializer.java

示例2: init

import org.apache.wicket.markup.html.SecurePackageResourceGuard; //导入方法依赖的package包/类
@Override
public void init(WebApplication webApplication) {
	IPackageResourceGuard packageResourceGuard = webApplication.getResourceSettings().getPackageResourceGuard();
	if (packageResourceGuard instanceof SecurePackageResourceGuard) {
		SecurePackageResourceGuard guard = (SecurePackageResourceGuard) packageResourceGuard;
		for(String pattern : props.getPattern()){
			guard.addPattern(pattern);
		}
	}
	
	wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass())
			.withDetail("properties", props)
			.build());
	
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:16,代码来源:PackageResourceGuardConfig.java

示例3: init

import org.apache.wicket.markup.html.SecurePackageResourceGuard; //导入方法依赖的package包/类
public static void init(Application app) {

        IPackageResourceGuard packageResourceGuard = app.getResourceSettings().getPackageResourceGuard();

        if (packageResourceGuard instanceof SecurePackageResourceGuard) {
            SecurePackageResourceGuard guard = (SecurePackageResourceGuard) packageResourceGuard;
            guard.addPattern("+*.woff");
            guard.addPattern("+*.woff2");
            guard.addPattern("+*.eot");
            guard.addPattern("+*.svg");
            guard.addPattern("+*.ttf");
        }
    }
 
开发者ID:jkrasnay,项目名称:panelized,代码行数:14,代码来源:Panelized.java

示例4: init

import org.apache.wicket.markup.html.SecurePackageResourceGuard; //导入方法依赖的package包/类
@Override
    public void init() {
        super.init();

        getJavaScriptLibrarySettings().setJQueryReference(
                new PackageResourceReference(MidPointApplication.class,
                        "../../../../../webjars/adminlte/2.3.11/plugins/jQuery/jquery-2.2.3.min.js"));

        GuiComponents.init();

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

        ResourceSettings resourceSettings = getResourceSettings();
        resourceSettings.setParentFolderPlaceholder("$-$");
        resourceSettings.setHeaderItemComparator(new PriorityFirstComparator(true));
        SecurePackageResourceGuard guard = (SecurePackageResourceGuard) resourceSettings.getPackageResourceGuard();
        guard.addPattern("+*.woff2");

        List<IStringResourceLoader> resourceLoaders = resourceSettings.getStringResourceLoaders();
        resourceLoaders.add(0, new Utf8BundleStringResourceLoader("localization/Midpoint"));
        resourceLoaders.add(1, new Utf8BundleStringResourceLoader(SchemaConstants.SCHEMA_LOCALIZATION_PROPERTIES_RESOURCE_BASE_PATH));

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

        if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
            getDebugSettings().setAjaxDebugModeEnabled(true);
            getDebugSettings().setDevelopmentUtilitiesEnabled(true);
            initializeDevelopmentSerializers();
        }

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

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

        mount(new MountedMapper("/error", PageError.class, new PageParametersEncoder()));
        mount(new MountedMapper("/error/401", PageError401.class, new PageParametersEncoder()));
        mount(new MountedMapper("/error/403", PageError403.class, new PageParametersEncoder()));
        mount(new MountedMapper("/error/404", PageError404.class, new PageParametersEncoder()));
        mount(new MountedMapper("/error/410", PageError410.class, new PageParametersEncoder()));

        getRequestCycleListeners().add(new LoggingRequestCycleListener(this));

        //descriptor loader, used for customization
        new DescriptorLoader().loadData(this);
    }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:54,代码来源:MidPointApplication.java

示例5: init

import org.apache.wicket.markup.html.SecurePackageResourceGuard; //导入方法依赖的package包/类
@Override
	public void init() {
		super.init();
		
		// injection Spring
		getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext));
		
		// nettoyage des tags Wicket
		getMarkupSettings().setStripWicketTags(true);
		
		// mise en place d'un timeout plus élevé histoire d'éviter les timeouts lors des téléchargements
		getRequestCycleSettings().setTimeout(DEFAULT_TIMEOUT);
		
		// configuration des ressources
		// depuis Wicket 1.5, il faut ajouter les patterns sur les ressources qu'on souhaite rendre accessible
		// on ajoute globalement l'accès aux ressources less et aux joyeusetés liés aux polices.
		SecurePackageResourceGuard packageResourceGuard = (SecurePackageResourceGuard) getResourceSettings().getPackageResourceGuard();
		packageResourceGuard.addPattern("+*.less");
		packageResourceGuard.addPattern("+*.scss");
		packageResourceGuard.addPattern("+*.woff");
		packageResourceGuard.addPattern("+*.eot");
		packageResourceGuard.addPattern("+*.svg");
		packageResourceGuard.addPattern("+*.ttf");
		packageResourceGuard.addPattern("+*.css.map");
		
		// la compression se fait au build quand c'est nécessaire ; on n'utilise pas la compression Wicket
		getResourceSettings().setJavaScriptCompressor(new NoOpTextCompressor());
		// utilisation des ressources minifiées que si on est en mode DEPLOYMENT
		getResourceSettings().setUseMinifiedResources(RuntimeConfigurationType.DEPLOYMENT.equals(getConfigurationType()));
		
		// gestion du cache sur les ressources
		getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy(new LastModifiedResourceVersion()));
		
		// surcharge des ressources jQuery et jQuery UI
		addResourceReplacement(WiQueryCoreThemeResourceReference.get(), JQueryUiCssResourceReference.get());
		
		// on place les éléments présents dans le wicket:head en premier
		getResourceSettings().setHeaderItemComparator(new PriorityFirstComparator(true));
		
		// configuration du disk data store de Wicket
		getStoreSettings().setInmemoryCacheSize(propertyService.get(WICKET_DISK_DATA_STORE_IN_MEMORY_CACHE_SIZE));
		getStoreSettings().setMaxSizePerSession(Bytes.megabytes(propertyService.get(WICKET_DISK_DATA_STORE_MAX_SIZE_PER_SESSION)));
		
		String wicketDiskDataStorePath = propertyService.get(WICKET_DISK_DATA_STORE_PATH);
		if (StringUtils.hasText(wicketDiskDataStorePath)) {
			try {
				File wicketDiskDataStoreFolder = new File(wicketDiskDataStorePath);
				FileUtils.forceMkdir(wicketDiskDataStoreFolder);
				
				getStoreSettings().setFileStoreFolder(wicketDiskDataStoreFolder);
			} catch (RuntimeException | IOException e) {
				LOGGER.error(String.format("Unable to define a specific path (%1$s) for wicket data store. Using the default one.",
						wicketDiskDataStorePath), e);
			}
		}
		
		mountCommonResources();
		mountCommonPages();
		
		mountApplicationResources();
		mountApplicationPages();
		
		registerLessImportScopes();
		// TODO SCSS
//		registerScssImportScopes();
		
		getResourceSettings().getStringResourceLoaders().addAll(
				0, // Override the keys in existing resource loaders with the following
				ImmutableList.of(
						new ClassStringResourceLoader(CoreWicketConsoleResources.class)
				)
		);
	}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:74,代码来源:CoreWicketApplication.java

示例6: setup

import org.apache.wicket.markup.html.SecurePackageResourceGuard; //导入方法依赖的package包/类
protected void setup() {
    setupListeners();

    // set HeaderRenderStrategy = ParentFirstHeaderRenderStrategy
    System.setProperty("Wicket_HeaderRenderStrategy",
            "org.apache.wicket.markup.renderStrategy.ParentFirstHeaderRenderStrategy");

    // look for pages at the root of the web-app
    IResourceSettings resourceSettings = getResourceSettings();
    resourceSettings.addResourceFolder("");
    IPackageResourceGuard packageResourceGuard = resourceSettings.getPackageResourceGuard();
    if (packageResourceGuard instanceof SecurePackageResourceGuard) {
        SecurePackageResourceGuard resourceGuard = (SecurePackageResourceGuard) packageResourceGuard;
        resourceGuard.addPattern("+Icon");
    }

    // ResourcePackage resources are locale insensitive
    NoLocaleResourceStreamLocator locator = new NoLocaleResourceStreamLocator();
    locator.addNoLocaleClass(ResourcePackage.class);
    resourceSettings.setResourceStreamLocator(new CachingResourceStreamLocator(locator));

    // add the addons authorization strategy
    AddonsAuthorizationStrategy addonsAuthorizationStrategy = new AddonsAuthorizationStrategy();
    Injector.get().inject(addonsAuthorizationStrategy);
    getAuthorizationStrategy().add(addonsAuthorizationStrategy);

    // increase request timeout to support long running transactions
    IRequestCycleSettings requestCycleSettings = getRequestCycleSettings();
    requestCycleSettings.setTimeout(Duration.hours(5));

    // set error pages
    IApplicationSettings applicationSettings = getApplicationSettings();
    applicationSettings.setPageExpiredErrorPage(PageExpiredErrorPage.class);
    applicationSettings.setAccessDeniedPage(AccessDeniedPage.class);
    applicationSettings.setInternalErrorPage(InternalErrorPage.class);

    // markup settings
    IMarkupSettings markupSettings = getMarkupSettings();
    markupSettings.setDefaultMarkupEncoding("UTF-8");
    markupSettings.setCompressWhitespace(true);
    markupSettings.setStripComments(true);
    markupSettings.setStripWicketTags(true);

    //QA settings
    if (modes.contains(ConstantValues.qa)) {
        getComponentInstantiationListeners().add(new AddWicketPathListener());
    }

    // RTFACT-4619, fixed by patching HeaderBufferingWebResponse
    getRequestCycleSettings().setBufferResponse(false);

    // RTFACT-4636
    getPageSettings().setVersionPagesByDefault(false);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:55,代码来源:ArtifactoryApplication.java

示例7: init

import org.apache.wicket.markup.html.SecurePackageResourceGuard; //导入方法依赖的package包/类
@Override
public void init() {
    super.init();

    getJavaScriptLibrarySettings().setJQueryReference(
            new PackageResourceReference(MidPointApplication.class,
                    "../../../../../webjars/adminlte/2.3.11/plugins/jQuery/jquery-2.2.3.min.js"));

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

    ResourceSettings resourceSettings = getResourceSettings();
    resourceSettings.setParentFolderPlaceholder("$-$");
    resourceSettings.setHeaderItemComparator(new PriorityFirstComparator(true));
    SecurePackageResourceGuard guard = (SecurePackageResourceGuard) resourceSettings.getPackageResourceGuard();
    guard.addPattern("+*.woff2");

    List<IStringResourceLoader> resourceLoaders = resourceSettings.getStringResourceLoaders();
    resourceLoaders.add(0, new MidPointStringResourceLoader(localizationService));

    resourceSettings.setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);

    if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        getDebugSettings().setAjaxDebugModeEnabled(true);
        getDebugSettings().setDevelopmentUtilitiesEnabled(true);
        initializeDevelopmentSerializers();
    }

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

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

    mount(new MountedMapper("/error", PageError.class, new PageParametersEncoder()));
    mount(new MountedMapper("/error/401", PageError401.class, new PageParametersEncoder()));
    mount(new MountedMapper("/error/403", PageError403.class, new PageParametersEncoder()));
    mount(new MountedMapper("/error/404", PageError404.class, new PageParametersEncoder()));
    mount(new MountedMapper("/error/410", PageError410.class, new PageParametersEncoder()));

    getRequestCycleListeners().add(new LoggingRequestCycleListener(this));

    getAjaxRequestTargetListeners().add(new AjaxRequestTarget.AbstractListener() {

        @Override
        public void updateAjaxAttributes(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes) {
            // check whether behavior will use POST method, if not then don't put CSRF token there
            if (!isPostMethodTypeBehavior(behavior, attributes)) {
                return;
            }

            CsrfToken csrfToken = SecurityUtils.getCsrfToken();
            if (csrfToken == null) {
                return;
            }

            String parameterName = csrfToken.getParameterName();
            String value = csrfToken.getToken();

            attributes.getExtraParameters().put(parameterName, value);
        }
    });

    getSessionListeners().add((ISessionListener) asyncWebProcessManager);

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

    // for schrodinger selenide library
    initializeSchrodinger();
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:75,代码来源:MidPointApplication.java


注:本文中的org.apache.wicket.markup.html.SecurePackageResourceGuard.addPattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。