本文整理匯總了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;
}