本文整理汇总了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;
}
示例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 : "";
}
示例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;
}
示例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;
}