java 属性文件的 MIME 类型是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6248130/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the MIME type for properties files?
提问by ashishjmeshram
What is the MIME type for properties file?
属性文件的 MIME 类型是什么?
Here is a list of all the files with different extensions but here I could not see any MIME type for the properties file.
这是具有不同扩展名的所有文件的列表,但在这里我看不到属性文件的任何 MIME 类型。
I have a properties file in my scripts folder and I am trying to read it in another scripts. When run as simple HTML file and a script file it works properly but when I put it in my web application which uses Spring MVC, its not able to read the properties file.
我的脚本文件夹中有一个属性文件,我试图在另一个脚本中读取它。当作为简单的 HTML 文件和脚本文件运行时,它可以正常工作,但是当我将它放入使用 Spring MVC 的 Web 应用程序时,它无法读取属性文件。
The error I get is
我得到的错误是
No media type found for ServletContext resource [Messages_en.properties] -returning 404.
找不到 ServletContext 资源 [Messages_en.properties] 的媒体类型 - 返回 404。
Please help.
请帮忙。
采纳答案by Nico
According to Apache HTTPd's Mime type listwhich is probably the most extensive you can find, there is no definition for properties files.
根据 Apache HTTPd 的 Mime 类型列表,这可能是您能找到的最广泛的类型,没有对属性文件的定义。
It's not clear to me what you're trying to achieve, but generally text/plain
works well with properties files.
我不清楚您要实现的目标,但通常text/plain
适用于属性文件。
回答by Ondra ?i?ka
Commonly used is text/x-java-properties
. E.g. project MoinMoin uses that.
常用的是text/x-java-properties
。例如项目 MoinMoin 使用它。
回答by Chucky
According to IANA Media Typeswhich is the most authoritative source, there is no standard MIME type for Java Properties files.
根据最权威的IANA 媒体类型,Java 属性文件没有标准的 MIME 类型。
Apache HTTPD / Subversion MIME type lists (which are referenced in other answers as the one from @nico) are simply a copy of IANA's.
Apache HTTPD / Subversion MIME 类型列表(在其他答案中引用为来自@nico 的列表)只是 IANA 的副本。
RFC2046specifies that Media Types (formerly known as MIME types) and Media Subtypes will be assigned and listed by the IANA. (Source IANA Media Types)
RFC2046指定媒体类型(以前称为 MIME 类型)和媒体子类型将由 IANA 分配和列出。(来源IANA 媒体类型)
Anyway, I've to agree with @Ondra ?i?kathat a few non-authoritative - but relevant - sources (like Tracand CaCert.org, for instance) are seemingly converging onto the text/x-java-properties
type, which is correctly using the `x-' prefix.
无论如何,我必须同意@Ondra ?i?ka 的观点,即一些非权威但相关的来源(例如Trac和CaCert.org)似乎正在收敛到text/x-java-properties
正确使用 `x -' 字首。
There is not a dozen places where this MIME type is used, though.
但是,使用这种 MIME 类型的地方并不多。