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


Java AntPathMatcher.extractPathWithinPattern方法代码示例

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


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

示例1: getFile

import org.springframework.util.AntPathMatcher; //导入方法依赖的package包/类
@RequestMapping(value = "/{solution}/**", method = {RequestMethod.GET, RequestMethod.HEAD})
@ResponseBody
public ResponseEntity<FileSystemResource> getFile(@PathVariable("solution") String solution,
		HttpServletRequest request) {
	String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
	String bestMatchPattern = (String ) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
    AntPathMatcher apm = new AntPathMatcher();
    path = apm.extractPathWithinPattern(bestMatchPattern, path);
    File file = fileService.getFile(solution, path);
	if (file.exists() && file.isFile()) {
		try {
			String detect = tika.detect(file);
			MediaType mediaType = MediaType.parseMediaType(detect);
			return ResponseEntity.ok()
					.contentLength(file.length())
					.contentType(mediaType)
					.lastModified(file.lastModified())
					.body(new FileSystemResource(file));
		} catch (IOException e) {
			e.printStackTrace();
		}
	} else {
           throw new ResourceNotFoundException();
       }
	return null;
}
 
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:27,代码来源:FileController.java

示例2: extractMatched

import org.springframework.util.AntPathMatcher; //导入方法依赖的package包/类
public static String extractMatched(final HttpServletRequest request){

        String path = (String) request.getAttribute(
                HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
        String bestMatchPattern = (String ) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);

        AntPathMatcher apm = new AntPathMatcher();

        return apm.extractPathWithinPattern(bestMatchPattern, path);

    }
 
开发者ID:airsonic,项目名称:airsonic,代码行数:12,代码来源:ControllerUtils.java

示例3: extractPathFromPattern

import org.springframework.util.AntPathMatcher; //导入方法依赖的package包/类
/**
 * Extract path from a controller mapping. /controllerUrl/** => return matched **
 * @param request incoming request.
 * @return extracted path
 */
public static String extractPathFromPattern(final HttpServletRequest request){

    String path = (String) request.getAttribute(
            HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
    String bestMatchPattern = (String ) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);

    AntPathMatcher apm = new AntPathMatcher();
    String finalPath = apm.extractPathWithinPattern(bestMatchPattern, path);

    return finalPath;

}
 
开发者ID:chaokunyang,项目名称:amanda,代码行数:18,代码来源:HttpRequestUtil.java

示例4: extractPathFromPattern

import org.springframework.util.AntPathMatcher; //导入方法依赖的package包/类
public static String extractPathFromPattern(final HttpServletRequest request) {

        String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
        String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);

        AntPathMatcher apm = new AntPathMatcher();
        String finalPath = apm.extractPathWithinPattern(bestMatchPattern, path);

        return finalPath;

    }
 
开发者ID:sercxtyf,项目名称:onboard,代码行数:12,代码来源:WebUtils.java


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