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


Java WebUtils.extractFullFilenameFromUrlPath方法代码示例

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


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

示例1: getMediaTypeKey

import org.springframework.web.util.WebUtils; //导入方法依赖的package包/类
@Override
protected String getMediaTypeKey(NativeWebRequest webRequest) {
	HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
	if (servletRequest == null) {
		logger.warn("An HttpServletRequest is required to determine the media type key");
		return null;
	}
	String path = urlPathHelper.getLookupPathForRequest(servletRequest);
	String filename = WebUtils.extractFullFilenameFromUrlPath(path);
	String extension = StringUtils.getFilenameExtension(filename);
	return (StringUtils.hasText(extension)) ? extension.toLowerCase(Locale.ENGLISH) : null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:PathExtensionContentNegotiationStrategy.java

示例2: getMediaTypeKey

import org.springframework.web.util.WebUtils; //导入方法依赖的package包/类
@Override
protected String getMediaTypeKey(NativeWebRequest webRequest) {
	HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
	if (request == null) {
		logger.warn("An HttpServletRequest is required to determine the media type key");
		return null;
	}
	String path = PATH_HELPER.getLookupPathForRequest(request);
	String filename = WebUtils.extractFullFilenameFromUrlPath(path);
	String extension = StringUtils.getFilenameExtension(filename);
	return (StringUtils.hasText(extension)) ? extension.toLowerCase(Locale.ENGLISH) : null;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:PathExtensionContentNegotiationStrategy.java

示例3: getPathExtension

import org.springframework.web.util.WebUtils; //导入方法依赖的package包/类
private String getPathExtension(HttpServletRequest request) {
    String fileName = WebUtils.extractFullFilenameFromUrlPath(request.getRequestURI());
    String extension = StringUtils.getFilenameExtension(fileName);
    return extension != null ? "." + extension : "";
}
 
开发者ID:tomwetjens,项目名称:spring-social-garmin,代码行数:6,代码来源:GarminConnectController.java

示例4: removePathExtension

import org.springframework.web.util.WebUtils; //导入方法依赖的package包/类
/**
 * Removes any path extension from the {@link HttpServletRequest#getRequestURI()
 * requestURI}. This method must be invoked before any calls to {@link #path(String)}
 * or {@link #pathSegment(String...)}.
 * <pre>
 *  // GET http://foo.com/rest/books/6.json
 *
 *  YourServletUriComponentsBuilder builder = YourServletUriComponentsBuilder.fromRequestUri(this.request);
 *  String ext = builder.removePathExtension();
 *  String uri = builder.path("/pages/1.{ext}").buildAndExpand(ext).toUriString();
 *
 *  assertEquals("http://foo.com/rest/books/6/pages/1.json", result);
 * </pre>
 * @return the removed path extension for possible re-use, or {@code null}
 * @since 4.0
 */
public String removePathExtension() {
    String extension = null;
    if (this.servletRequestURI != null) {
        String filename = WebUtils.extractFullFilenameFromUrlPath(this.servletRequestURI);
        extension = StringUtils.getFilenameExtension(filename);
        if (!StringUtils.isEmpty(extension)) {
            int end = this.servletRequestURI.length() - extension.length() + 1;
            replacePath(this.servletRequestURI.substring(0, end));
        }
        this.servletRequestURI = null;
    }
    return extension;
}
 
开发者ID:jaschenk,项目名称:Your-Microservice,代码行数:30,代码来源:YourServletUriComponentsBuilder.java

示例5: removePathExtension

import org.springframework.web.util.WebUtils; //导入方法依赖的package包/类
/**
 * Remove any path extension from the {@link HttpServletRequest#getRequestURI()
 * requestURI}. This method must be invoked before any calls to {@link #path(String)}
 * or {@link #pathSegment(String...)}.
 * <pre>
 * GET http://foo.com/rest/books/6.json
 *
 * ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromRequestUri(this.request);
 * String ext = builder.removePathExtension();
 * String uri = builder.path("/pages/1.{ext}").buildAndExpand(ext).toUriString();
 * assertEquals("http://foo.com/rest/books/6/pages/1.json", result);
 * </pre>
 * @return the removed path extension for possible re-use, or {@code null}
 * @since 4.0
 */
public String removePathExtension() {
	String extension = null;
	if (this.originalPath != null) {
		String filename = WebUtils.extractFullFilenameFromUrlPath(this.originalPath);
		extension = StringUtils.getFilenameExtension(filename);
		if (!StringUtils.isEmpty(extension)) {
			int end = this.originalPath.length() - (extension.length() + 1);
			replacePath(this.originalPath.substring(0, end));
		}
		this.originalPath = null;
	}
	return extension;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:29,代码来源:ServletUriComponentsBuilder.java


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