各种类型文件的Content-Type

2024-03-28 04:48
文章标签 type content 各种类型

本文主要是介绍各种类型文件的Content-Type,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

介绍

Content-Type,即内容类型,一般是指网页中存在的Content-Type,用于定义网络文件的类型和网页的编码,决定文件接收方将以什么形式、什么编码读取这个文件,这就是经常看到一些Asp网页点击的结果却是下载到的一个文件或一张图片的原因。

ContentType属性指定响应的 HTTP内容类型。如果未指定 ContentType,默认为TEXT/HTML。

protected HttpServletResponse res() {HttpServletResponse response = ServletActionContext.getResponse();response.setCharacterEncoding("utf-8");response.setContentType("text/html;charset=utf-8");return response;
}

Spring MVC中具体运用,点击导出PDF文件:

response.setCharacterEncoding("utf-8");
response.setContentType("application/pdf");

 

What are the Microsoft Office MIME Types?

 

Ext

MIME Type

.doc

application/msword

.dot

application/msword

.docx

application/vnd.openxmlformats-officedocument.wordprocessingml.document

.dotx

application/vnd.openxmlformats-officedocument.wordprocessingml.template

.docm

application/vnd.ms-word.document.macroEnabled.12

.dotm

application/vnd.ms-word.template.macroEnabled.12

.xls

application/vnd.ms-excel

.xlt

application/vnd.ms-excel

.xla

application/vnd.ms-excel

.xlsx

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

.xltx

application/vnd.openxmlformats-officedocument.spreadsheetml.template

.xlsm

application/vnd.ms-excel.sheet.macroEnabled.12

.xltm

application/vnd.ms-excel.template.macroEnabled.12

.xlam

application/vnd.ms-excel.addin.macroEnabled.12

.xlsb

application/vnd.ms-excel.sheet.binary.macroEnabled.12

.ppt

application/vnd.ms-powerpoint

.pot

application/vnd.ms-powerpoint

.pps

application/vnd.ms-powerpoint

.ppa

application/vnd.ms-powerpoint

.pptx

application/vnd.openxmlformats-officedocument.presentationml.presentation

.potx

application/vnd.openxmlformats-officedocument.presentationml.template

.ppsx

application/vnd.openxmlformats-officedocument.presentationml.slideshow

.ppam

application/vnd.ms-powerpoint.addin.macroEnabled.12

.pptm

application/vnd.ms-powerpoint.presentation.macroEnabled.12

.potm

application/vnd.ms-powerpoint.template.macroEnabled.12

.ppsm

application/vnd.ms-powerpoint.slideshow.macroEnabled.12

 

 

 

参考文档:

1. http://qd5.iteye.com/blog/1564040

2. http://filext.com/faq/office_mime_types.php

3. http://tool.oschina.net/commons

这篇关于各种类型文件的Content-Type的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/854490

相关文章

解决Spring运行时报错:Consider defining a bean of type ‘xxx.xxx.xxx.Xxx‘ in your configuration

《解决Spring运行时报错:Considerdefiningabeanoftype‘xxx.xxx.xxx.Xxx‘inyourconfiguration》该文章主要讲述了在使用S... 目录问题分析解决方案总结问题Description:Parameter 0 of constructor in x

Android fill_parent、match_parent、wrap_content三者的作用及区别

这三个属性都是用来适应视图的水平或者垂直大小,以视图的内容或尺寸为基础的布局,比精确的指定视图的范围更加方便。 1、fill_parent 设置一个视图的布局为fill_parent将强制性的使视图扩展至它父元素的大小 2、match_parent 和fill_parent一样,从字面上的意思match_parent更贴切一些,于是从2.2开始,两个属性都可以使用,但2.3版本以后的建议使

Oracle type (自定义类型的使用)

oracle - type   type定义: oracle中自定义数据类型 oracle中有基本的数据类型,如number,varchar2,date,numeric,float....但有时候我们需要特殊的格式, 如将name定义为(firstname,lastname)的形式,我们想把这个作为一个表的一列看待,这时候就要我们自己定义一个数据类型 格式 :create or repla

Caused by: org.hibernate.MappingException: Could not determine type for: org.cgh.ssh.pojo.GoodsType,

MappingException:这个主要是类映射上的异常,Could not determine type for: org.cgh.ssh.pojo.GoodsType,这句话表示GoodsType这个类没有被映射到

兔子--The method setLatestEventInfo(Context, CharSequence, CharSequence, PendingIntent) from the type

notification.setLatestEventInfo(context, title, message, pendingIntent);     不建议使用 低于API Level 11版本,也就是Android 2.3.3以下的系统中,setLatestEventInfo()函数是唯一的实现方法。  Intent  intent = new Intent(

Unity Adressables 使用说明(四)分发远程内容(Distribute Remote Content)

概述 远程分发内容可以减少应用程序的初始下载大小和安装时间。你还可以更新远程分发的资源,而无需重新发布应用程序或游戏。 当你将远程 URL 分配为 Group 的加载路径(Load Path)时,Addressables 系统会从该 URL 加载组中的资源。当你启用Build Remote Catalog选项时,Addressables 会在 Remote Catalog 中查找任何远程资源的

AI模型:追求全能还是专精?-- 之6 语言复杂度类别(Category 0~3 类)和语言功能性类型(Type 0~Ⅲ 型)之2

Q17、我前面说过,语言复杂度的0~3级(Category 0~3)表示了语言的的上下文相关性 : 完全不相关, 单相关的 单词上下文, 双相关的句子上下文 全相关的文章上下文 。我准备翻译为 Context - irrelative /relative/correlative/ full-correlative,显式表达了语言复杂度的0~3级(Category 0~3)区别的上下文相关性是一种关

【TS高频面试题】interface与type的区别

参考文章 一、基本概念 1. type(类型别名) 用来给一个类型起新名字,使用 type 创建类型别名。 2. interface(接口) 专门用于定义对象的结构(比如属性和方法) 二、相同点 (1)都可以描述对象或函数 interface interface User {name: stringage: number}interface SetUser {(name: st

ssh登录服务器报错“no matching host key type found. Their offer: ssh-rsa,ssh-dss”解决方法

这个错误表明你尝试使用 ssh 连接到远程服务器时,客户端和服务器之间没有匹配的 host key 类型。具体来说,远程服务器提供了 ssh-rsa 和 ssh-dss 类型的 host key,但你的 SSH 客户端配置可能不再支持这些较旧的算法。最近的 OpenSSH 版本默认禁用了不够安全的算法,如 ssh-rsa 和 ssh-dss。 解决方法 临时启用 ssh-rsa: 你可以在

Numpy中type()、ndim、shape、size、dtype、astype的用法

目录 numpy基础介绍示例分析及总结:itemsize、nbytes函数 numpy基础介绍 Numpy 补充了Python语言所欠缺的数值计算能力,是其它数据分析及机器学习库的底层库。因其完全标准C语言实现,运行效率充分优化。最重要一点是开源免费。numpy的核心是矩阵(即多维数组)。 示例 import numpy as nparr =np.array([[1,2,3]