html 的 ContentType

本文详细列举了各种文件格式对应的MIME类型,包括图像、音频、视频、文档等多种类别,为开发者提供了一份全面的参考资料。
html 的 ContentType

ContentTypes : "svg","image/svg+xml"
ContentTypes : "ez","application/andrew-inset"
ContentTypes : "hqx","application/mac-binhex40"
ContentTypes : "cpt","application/mac-compactpro"
ContentTypes : "doc","application/msword"
ContentTypes : "bin","application/octet-stream"
ContentTypes : "dms","application/octet-stream"
ContentTypes : "lha","application/octet-stream"
ContentTypes : "lzh","application/octet-stream"
ContentTypes : "exe","application/octet-stream"
ContentTypes : "class","application/octet-stream"
ContentTypes : "so","application/octet-stream"
ContentTypes : "dll","application/octet-stream"
ContentTypes : "oda","application/oda"
ContentTypes : "pdf","application/pdf"
ContentTypes : "ai","application/postscript"
ContentTypes : "eps","application/postscript"
ContentTypes : "ps","application/postscript"
ContentTypes : "smi","application/smil"
ContentTypes : "smil","application/smil"
ContentTypes : "mif","application/vnd.mif"
ContentTypes : "xls","application/vnd.ms-excel"
ContentTypes : "ppt","application/vnd.ms-powerpoint"
ContentTypes : "wbxml","application/vnd.wap.wbxml"
ContentTypes : "wmlc","application/vnd.wap.wmlc"
ContentTypes : "wmlsc","application/vnd.wap.wmlscriptc"
ContentTypes : "bcpio","application/x-bcpio"
ContentTypes : "vcd","application/x-cdlink"
ContentTypes : "pgn","application/x-chess-pgn"
ContentTypes : "cpio","application/x-cpio"
ContentTypes : "csh","application/x-csh"
ContentTypes : "dcr","application/x-director"
ContentTypes : "dir","application/x-director"
ContentTypes : "dxr","application/x-director"
ContentTypes : "dvi","application/x-dvi"
ContentTypes : "spl","application/x-futuresplash"
ContentTypes : "gtar","application/x-gtar"
ContentTypes : "hdf","application/x-hdf"
ContentTypes : "js","application/x-javascript"
ContentTypes : "skp","application/x-koan"
ContentTypes : "skd","application/x-koan"
ContentTypes : "skt","application/x-koan"
ContentTypes : "skm","application/x-koan"
ContentTypes : "latex","application/x-latex"
ContentTypes : "nc","application/x-netcdf"
ContentTypes : "cdf","application/x-netcdf"
ContentTypes : "sh","application/x-sh"
ContentTypes : "shar","application/x-shar"
ContentTypes : "swf","application/x-shockwave-flash"
ContentTypes : "sit","application/x-stuffit"
ContentTypes : "sv4cpio","application/x-sv4cpio"
ContentTypes : "sv4crc","application/x-sv4crc"
ContentTypes : "tar","application/x-tar"
ContentTypes : "tcl","application/x-tcl"
ContentTypes : "tex","application/x-tex"
ContentTypes : "texinfo","application/x-texinfo"
ContentTypes : "texi","application/x-texinfo"
ContentTypes : "t","application/x-troff"
ContentTypes : "tr","application/x-troff"
ContentTypes : "roff","application/x-troff"
ContentTypes : "man","application/x-troff-man"
ContentTypes : "me","application/x-troff-me"
ContentTypes : "ms","application/x-troff-ms"
ContentTypes : "ustar","application/x-ustar"
ContentTypes : "src","application/x-wais-source"
ContentTypes : "xhtml","application/xhtml+xml"
ContentTypes : "xht","application/xhtml+xml"
ContentTypes : "zip","application/zip"
ContentTypes : "au","audio/basic"
ContentTypes : "snd","audio/basic"
ContentTypes : "mid","audio/midi"
ContentTypes : "midi","audio/midi"
ContentTypes : "kar","audio/midi"
ContentTypes : "mpga","audio/mpeg"
ContentTypes : "mp2","audio/mpeg"
ContentTypes : "mp3","audio/mpeg"
ContentTypes : "aif","audio/x-aiff"
ContentTypes : "aiff","audio/x-aiff"
ContentTypes : "aifc","audio/x-aiff"
ContentTypes : "m3u","audio/x-mpegurl"
ContentTypes : "ram","audio/x-pn-realaudio"
ContentTypes : "rm","audio/x-pn-realaudio"
ContentTypes : "rpm","audio/x-pn-realaudio-plugin"
ContentTypes : "ra","audio/x-realaudio"
ContentTypes : "wav","audio/x-wav"
ContentTypes : "pdb","chemical/x-pdb"
ContentTypes : "xyz","chemical/x-xyz"
ContentTypes : "bmp","image/bmp"
ContentTypes : "gif","image/gif"
ContentTypes : "ief","image/ief"
ContentTypes : "jpeg","image/jpeg"
ContentTypes : "jpg","image/jpeg"
ContentTypes : "jpe","image/jpeg"
ContentTypes : "png","image/png"
ContentTypes : "tiff","image/tiff"
ContentTypes : "tif","image/tiff"
ContentTypes : "djvu","image/vnd.djvu"
ContentTypes : "djv","image/vnd.djvu"
ContentTypes : "wbmp","image/vnd.wap.wbmp"
ContentTypes : "ras","image/x-cmu-raster"
ContentTypes : "pnm","image/x-portable-anymap"
ContentTypes : "pbm","image/x-portable-bitmap"
ContentTypes : "pgm","image/x-portable-graymap"
ContentTypes : "ppm","image/x-portable-pixmap"
ContentTypes : "rgb","image/x-rgb"
ContentTypes : "xbm","image/x-xbitmap"
ContentTypes : "xpm","image/x-xpixmap"
ContentTypes : "xwd","image/x-xwindowdump"
ContentTypes : "igs","model/iges"
ContentTypes : "iges","model/iges"
ContentTypes : "msh","model/mesh"
ContentTypes : "mesh","model/mesh"
ContentTypes : "silo","model/mesh"
ContentTypes : "wrl","model/vrml"
ContentTypes : "vrml","model/vrml"
ContentTypes : "css","text/css"
ContentTypes : "html","text/html"
ContentTypes : "htm","text/html"
ContentTypes : "asc","text/plain"
ContentTypes : "txt","text/plain"
ContentTypes : "rtx","text/richtext"
ContentTypes : "rtf","text/rtf"
ContentTypes : "sgml","text/sgml"
ContentTypes : "sgm","text/sgml"
ContentTypes : "tsv","text/tab-separated-values"
ContentTypes : "wml","text/vnd.wap.wml"
ContentTypes : "wmls","text/vnd.wap.wmlscript"
ContentTypes : "etx","text/x-setext"
ContentTypes : "xsl","text/xml"
ContentTypes : "xml","text/xml"
ContentTypes : "mpeg","video/mpeg"
ContentTypes : "mpg","video/mpeg"
ContentTypes : "mpe","video/mpeg"
ContentTypes : "qt","video/quicktime"
ContentTypes : "mov","video/quicktime"
ContentTypes : "mxu","video/vnd.mpegurl"
ContentTypes : "avi","video/x-msvideo"
ContentTypes : "movie","video/x-sgi-movie"
ContentTypes : "ice","x-conference/x-cooltalk"
ContentTypes : "form","application/x-www-form-urlencoded"
### 问题分析 当使用 Apache CXF 客户端调用 WebService 时,出现 `org.apache.cxf.interceptor.Fault: Response was of unexpected text/html ContentType` 错误,通常表示客户端接收到的响应内容类型不是预期的 `application/soap+xml` 或 `text/xml`,而是 `text/html`。这表明服务端返回了 HTML 页面而非 SOAP 响应,常见于服务未正确部署、请求路径错误或服务器发生内部异常导致重定向到错误页面(如 404 页面)等情况。 --- ### 解决方案 #### 1. 检查服务地址是否正确 确保客户端调用的服务地址与实际部署的服务地址一致。如果地址错误,服务器可能会返回 HTML 错误页面而不是 SOAP 响应。可以使用浏览器或 Postman 工具访问该 URL 验证是否能获取 WSDL 或正常响应[^3]。 ```java MyService service = new MyService(); MyPort port = service.getMyPort(); BindingProvider bp = (BindingProvider) port; bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://correct/service/url"); ``` #### 2. 查看服务端日志 检查服务端日志是否有异常抛出,例如空指针、类加载失败等,这些异常可能导致服务未正常响应,从而返回 HTML 错误页面。服务端配置文件中也可能存在命名空间不一致或参数缺失等问题,导致无法正确处理请求。 #### 3. 设置 Content-Type 请求头 在客户端设置正确的 Content-Type 请求头,确保请求被识别为 SOAP 消息: ```java Map<String, Object> reqContext = ((BindingProvider) port).getRequestContext(); reqContext.put("Content-Type", "text/xml; charset=utf-8"); ``` #### 4. 使用拦截器查看原始响应 通过添加自定义拦截器打印原始响应内容,确认服务端返回的数据格式是否为 XML 或 SOAP 格式,以判断问题出在客户端解析阶段还是服务端响应阶段: ```java public class LoggingInInterceptor extends AbstractSoapInterceptor { public LoggingInInterceptor() { super(Phase.PRE_PROTOCOL); } @Override public void handleMessage(SoapMessage message) throws Fault { InputStream is = message.getContent(InputStream.class); String response = IOUtils.toString(is); System.out.println("Response: " + response); } } ``` #### 5. 检查服务端命名空间和接口定义 若服务端实现类未指定正确的命名空间或接口定义与客户端不一致,也可能导致解析失败。确保服务端类和方法注解中的命名空间与客户端生成的代码一致: ```java @WebService(targetNamespace = "http://example.com/ns") public class MyServiceImpl implements MyServicePort { // 方法实现 } ``` --- ### 相关问题
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值