Java 类org.springframework.mail.javamail.ConfigurableMimeFileTypeMap 实例源码

项目:jplantuml    文件:FileItemReader.java   
public FileItemReader(Path inputDirectory, ConfigurableMimeFileTypeMap map) {
    Assert.notNull(inputDirectory);
    Assert.isTrue(isDirectory(inputDirectory));
    Assert.isTrue(isReadable(inputDirectory));
    this.map = map;
    this.inputDirectory = inputDirectory;
}
项目:bamboobsc    文件:FSUtils.java   
public static String getMimeType(String filename) throws Exception {
    ConfigurableMimeFileTypeMap mfm = new ConfigurableMimeFileTypeMap();        
    return mfm.getContentType(filename);
}
项目:r01fb    文件:JavaMailSenderImplBase.java   
public JavaMailSenderImplBase() {
    ConfigurableMimeFileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
    fileTypeMap.afterPropertiesSet();
    _defaultFileTypeMap = fileTypeMap;
}
项目:jplantuml    文件:PlantUmlConfig.java   
@Bean
public ItemReader<Path> reader() {
    return new FileItemReader(Paths.get(settings.directoryIn()), new ConfigurableMimeFileTypeMap());
}
项目:eHMP    文件:ResourceHttpMessageConverter.java   
public ConfigurableMimeFileTypeMap getFileTypeMap() {
    return fileTypeMap;
}
项目:eHMP    文件:ResourceHttpMessageConverter.java   
public void setFileTypeMap(ConfigurableMimeFileTypeMap fileTypeMap) {
    this.fileTypeMap = fileTypeMap;
}
项目:eHMP    文件:ResourceHttpRequestHandler.java   
public ConfigurableMimeFileTypeMap getFileTypeMap() {
    return fileTypeMap;
}
项目:eHMP    文件:ResourceHttpRequestHandler.java   
public void setFileTypeMap(ConfigurableMimeFileTypeMap fileTypeMap) {
    this.fileTypeMap = fileTypeMap;
}
项目:eionet.webq    文件:FileDownloadController.java   
/**
 * 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);
}