本文整理汇总了Java中org.springframework.mail.javamail.ConfigurableMimeFileTypeMap类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableMimeFileTypeMap类的具体用法?Java ConfigurableMimeFileTypeMap怎么用?Java ConfigurableMimeFileTypeMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurableMimeFileTypeMap类属于org.springframework.mail.javamail包,在下文中一共展示了ConfigurableMimeFileTypeMap类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FileItemReader
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap; //导入依赖的package包/类
public FileItemReader(Path inputDirectory, ConfigurableMimeFileTypeMap map) {
Assert.notNull(inputDirectory);
Assert.isTrue(isDirectory(inputDirectory));
Assert.isTrue(isReadable(inputDirectory));
this.map = map;
this.inputDirectory = inputDirectory;
}
示例2: getMimeType
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap; //导入依赖的package包/类
public static String getMimeType(String filename) throws Exception {
ConfigurableMimeFileTypeMap mfm = new ConfigurableMimeFileTypeMap();
return mfm.getContentType(filename);
}
示例3: JavaMailSenderImplBase
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap; //导入依赖的package包/类
public JavaMailSenderImplBase() {
ConfigurableMimeFileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
fileTypeMap.afterPropertiesSet();
_defaultFileTypeMap = fileTypeMap;
}
示例4: reader
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap; //导入依赖的package包/类
@Bean
public ItemReader<Path> reader() {
return new FileItemReader(Paths.get(settings.directoryIn()), new ConfigurableMimeFileTypeMap());
}
示例5: getFileTypeMap
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap; //导入依赖的package包/类
public ConfigurableMimeFileTypeMap getFileTypeMap() {
return fileTypeMap;
}
示例6: setFileTypeMap
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap; //导入依赖的package包/类
public void setFileTypeMap(ConfigurableMimeFileTypeMap fileTypeMap) {
this.fileTypeMap = fileTypeMap;
}
示例7: writeProjectFileToResponse
import org.springframework.mail.javamail.ConfigurableMimeFileTypeMap; //导入依赖的package包/类
/**
* Writes project file to response.
*
* @param name file name
* @param projectFile project file object
* @param response http response
* @param disposition inline or attachment
*/
private void
writeProjectFileToResponse(String name, ProjectFile projectFile, HttpServletResponse response, String disposition,
String format) {
ConfigurableMimeFileTypeMap mimeTypesMap = new ConfigurableMimeFileTypeMap();
String contentType = mimeTypesMap.getContentType(name);
// check if default
if (mimeTypesMap.getContentType("").equals(contentType)) {
if (name.endsWith(".xhtml")) {
contentType = MediaType.APPLICATION_XHTML_XML_VALUE;
} else if (name.endsWith(".js")) {
contentType = "application/javascript";
} else if (name.endsWith(".json")) {
contentType = MediaType.APPLICATION_JSON_VALUE;
} else {
contentType = MediaType.APPLICATION_XML_VALUE;
}
// TODO check if there are more missing mime types
}
byte[] fileContent = projectFile.getFileContent();
if ("json".equals(format)) {
fileContent = jsonXMLConverter.convertXmlToJson(projectFile.getFileContent());
contentType = MediaType.APPLICATION_JSON_VALUE;
disposition = "inline";
}
if (contentType.startsWith("text") || contentType.startsWith("application")) {
contentType += ";charset=UTF-8";
}
response.setContentType(contentType);
setContentDisposition(response, disposition + ";filename=" + name);
if (projectFile.getUpdated() != null) {
response.setDateHeader("Last-Modified", projectFile.getUpdated().getTime());
} else if (projectFile.getCreated() != null) {
response.setDateHeader("Last-Modified", projectFile.getCreated().getTime());
}
writeToResponse(response, fileContent);
}