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


Java ResourceHandlerRegistry类代码示例

本文整理汇总了Java中org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry的典型用法代码示例。如果您正苦于以下问题:Java ResourceHandlerRegistry类的具体用法?Java ResourceHandlerRegistry怎么用?Java ResourceHandlerRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResourceHandlerRegistry类属于org.springframework.web.servlet.config.annotation包,在下文中一共展示了ResourceHandlerRegistry类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // TODO: [email protected]/3/15  这里可能需要根据OS不同配置不同的路径,win:file后有3个/,linux:file后有2个/,因为linux的目录本身就是/开头 


        String separator = "/";
        if( os.contains("Linux") ){//如果是linux    // TODO: [email protected]/3/15  app_init 中判断OS 
            separator = "";
        }
        //win:   file:///c:dir_name
        //linux:  file:///home/wangc/dir_name
//        String reportResLocations = FILE_PREX+separator+ Param.USER_DIR+Param.HTML_PATH;
        //将所有的/report/请求至html报告的本地路径
//        registry.addResourceHandler("/report/**").addResourceLocations(reportResLocations);

        String reportResLocations = FILE_PREX+separator+ Param.USER_DIR+Param.HTML_PATH+File.separator;
        
//        reportResLocations = "file:///D:/workspace_HelloWorld/testing_platform/jmeter/html/";
        registry.addResourceHandler("/report/**").addResourceLocations(reportResLocations);
                              //file:///D:/workspace_HelloWorld/testing_platform/jmeter/html
        super.addResourceHandlers(registry);
    }
 
开发者ID:wang153723482,项目名称:testing_platform,代码行数:23,代码来源:StaticResourceConfiguration.java

示例2: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    // css resource
    registry
        .addResourceHandler("/css/**")
        .addResourceLocations("classpath:/static/css/");

    // js resource
    registry
        .addResourceHandler("/js/**")
        .addResourceLocations("classpath:/static/js/");

    // js resource
    registry
        .addResourceHandler("/vendors/**")
        .addResourceLocations("classpath:/static/vendors/");

    // img resource
    registry
        .addResourceHandler("/img/**")
        .addResourceLocations("classpath:/static/img/");
}
 
开发者ID:SourceLabOrg,项目名称:kafka-webview,代码行数:23,代码来源:WebConfig.java

示例3: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**")
            .addResourceLocations("/resources/")
            .setCachePeriod(0) //Set to 0 in order to send cache headers that prevent caching
    ;

    // Add WebJars for Bootstrap & jQuery
    if (!registry.hasMappingForPattern("/webjars/**")) {
        registry.addResourceHandler("/webjars/**").addResourceLocations(
                "classpath:/META-INF/resources/webjars/").resourceChain(true);
    }

    if (!registry.hasMappingForPattern("/**")) {
        registry.addResourceHandler("/**").addResourceLocations(
                CLASSPATH_RESOURCE_LOCATIONS);

    }
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:20,代码来源:WebMvcConfig.java

示例4: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**")
            .addResourceLocations("/resources/")
            .setCachePeriod(0) //Set to 0 in order to send cache headers that prevent caching
            .setCachePeriod(0)//Set to 0 in order to send cache headers that prevent caching
    ;

    // Add WebJars for Bootstrap & jQuery
    if (!registry.hasMappingForPattern("/webjars/**")) {
        registry.addResourceHandler("/webjars/**").addResourceLocations(
                "classpath:/META-INF/resources/webjars/").resourceChain(true);
    }

    if (!registry.hasMappingForPattern("/**")) {
        registry.addResourceHandler("/**").addResourceLocations(
                CLASSPATH_RESOURCE_LOCATIONS);

    }
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:20,代码来源:WebMvcConfig.java

示例5: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**")
            .addResourceLocations("/resources/")
            .setCachePeriod(0) //Set to 0 in order to send cache headers that prevent caching
    ;

    registry.addResourceHandler("/webjars/**")
            .addResourceLocations("classpath:/META-INF/resources/webjars/").resourceChain(true);

    // Add WebJars for Bootstrap & jQuery
    if (!registry.hasMappingForPattern("/webjars/**")) {
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/").resourceChain(true);
    }

    registry.addResourceHandler("/**")
            .addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);

    if (!registry.hasMappingForPattern("/**")) {
        registry.addResourceHandler("/**")
                .addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);

    }
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:26,代码来源:WebMvcConfig.java

示例6: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**")
            .addResourceLocations("/resources/")
            .setCachePeriod(0) //Set to 0 in order to send cache headers that prevent caching
            .setCachePeriod(0)//Set to 0 in order to send cache headers that prevent caching
    ;

    // Add WebJars for Bootstrap & jQuery
    if (!registry.hasMappingForPattern("/webjars/**")) {
        registry.addResourceHandler("/webjars/**").addResourceLocations(
                "classpath:/META-INF/resources/webjars/").resourceChain(true);
    }

    if (!registry.hasMappingForPattern("/**")) {
        registry.addResourceHandler("/**").addResourceLocations(
                CLASSPATH_RESOURCE_LOCATIONS);

    }
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:21,代码来源:WebMvcConfig.java

示例7: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/index.html")
            .addResourceLocations("classpath:/public/", "classpath:/static/")
            .setCacheControl(createCacheConfig(maxIndexCacheAge))
            .resourceChain(true)
            .addResolver(new PathResourceResolver());

    final ResourceChainRegistration registration = registry.addResourceHandler("/**")
            .addResourceLocations("classpath:/public/", "classpath:/static/",
                    "classpath:/META-INF/resources/")
            .setCacheControl(createCacheConfig(maxCacheAge))
            .resourceChain(true)
            .addResolver(new PathResourceResolver());

    if (propertyInjectionTransformer != null) {
        registration.addTransformer(propertyInjectionTransformer);
    }
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:20,代码来源:StaticWebResourceConfiguration.java

示例8: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry
            .addResourceHandler("/resources/**")
            .addResourceLocations("/resources/")
            .setCachePeriod(3600)
            .resourceChain(true)
            .addResolver(new PathResourceResolver());
}
 
开发者ID:EventSoftGroup,项目名称:EventSoft,代码行数:10,代码来源:MvcConfig.java

示例9: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
	registry
		.addResourceHandler("/css/**")
		.addResourceLocations("/js/")
		.setCachePeriod(31556926);
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:8,代码来源:SpringMvcConfig.java

示例10: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
	registry
		.addResourceHandler("/css/**")
		.addResourceLocations("/js/**")
		.setCachePeriod(31556926);
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:8,代码来源:SpringDispatcherConfig.java

示例11: addResourceHandlers

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; //导入依赖的package包/类
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    int cachePeriodInSeconds = (int) TimeUnit.DAYS.toSeconds(1);

    if (!registry.hasMappingForPattern("/webjars/**")) {
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/")
                .setCachePeriod(cachePeriodInSeconds);
    }
}
 
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:11,代码来源:SwaggerConfiguration.java


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