Java Code Examples for org.springframework.util.StringUtils#getFilename()

The following examples show how to use org.springframework.util.StringUtils#getFilename() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenMetadataGenerator.java    From artifactory-resource with Apache License 2.0 5 votes vote down vote up
private void generate(Directory root, File pomFile, boolean generateChecksums) {
	String name = StringUtils.getFilename(pomFile.getName());
	String extension = StringUtils.getFilenameExtension(pomFile.getName());
	String prefix = name.substring(0, name.length() - extension.length() - 1);
	File[] files = pomFile.getParentFile().listFiles((f) -> include(f, prefix));
	MultiValueMap<File, MavenCoordinates> fileCoordinates = new LinkedMultiValueMap<>();
	for (File file : files) {
		String rootPath = StringUtils.cleanPath(root.getFile().getPath());
		String relativePath = StringUtils.cleanPath(file.getPath()).substring(rootPath.length() + 1);
		fileCoordinates.add(file.getParentFile(), MavenCoordinates.fromPath(relativePath));
	}
	fileCoordinates.forEach((file, coordinates) -> writeMetadata(file, coordinates, generateChecksums));
}
 
Example 2
Source File: UrlResource.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * This implementation returns the name of the file that this URL refers to.
 * @see java.net.URL#getPath()
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.cleanedUrl.getPath());
}
 
Example 3
Source File: ClassPathResource.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * This implementation returns the name of the file that this class path
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
@Nullable
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 4
Source File: ServletContextResource.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * This implementation returns the name of the file that this ServletContext
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
@Nullable
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 5
Source File: UrlResource.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * This implementation returns the name of the file that this URL refers to.
 * @see java.net.URL#getPath()
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.cleanedUrl.getPath());
}
 
Example 6
Source File: ClassPathResource.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * This implementation returns the name of the file that this class path
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
@Nullable
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 7
Source File: ServletContextResource.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * This implementation returns the name of the file that this ServletContext
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
@Nullable
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 8
Source File: UrlResource.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This implementation returns the name of the file that this URL refers to.
 * @see java.net.URL#getPath()
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.cleanedUrl.getPath());
}
 
Example 9
Source File: PortletContextResource.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 10
Source File: FileUtil.java    From mica with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 获取文件后缀名
 *
 * @param path 文件路径
 * @return {String}
 */
@Nullable
public static String getFilename(@Nullable String path) {
	return StringUtils.getFilename(path);
}
 
Example 11
Source File: ServletContextResource.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * This implementation returns the name of the file that this ServletContext
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 12
Source File: ClassPathResource.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * This implementation returns the name of the file that this class path
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 13
Source File: ClassPathResource.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * This implementation returns the name of the file that this class path
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.path);
}
 
Example 14
Source File: ServletContextResource.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * This implementation returns the name of the file that this ServletContext
 * resource refers to.
 * @see org.springframework.util.StringUtils#getFilename(String)
 */
@Override
public String getFilename() {
	return StringUtils.getFilename(this.path);
}