META-INF 为什么叫 META-INF?
我试图解释网络应用程序的基础知识。我在 META-INF 和 WEB-INF 上遇到了这个问题。这些目录是如何获得这些名称的?
I am trying to explain the fundamentals of web applications. I came across this question on META-INF and WEB-INF. How did those directories get those names?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Jar 文件实际上是带有额外信息和可能更好的索引的 ZIP 文件。将额外信息打包到 ZIP 文件中时,将其放置在不太可能与正常 ZIP 文件内容冲突的位置非常重要。
选择 META-INF 作为可以存储 JAR 文件信息的目录是尝试使用目录作为 ZIP 文件中的名称空间。基本上,如果它存储在 META-INF 中,它就是元数据信息,或者(在元的可能含义中选择)“自我信息”或“抽象信息”。
这允许在 ZIP 文件本身内存储影响 ZIP 文件处理的信息,而不会破坏 ZIP 文件打包。这是关键,因为它不需要创建新的、可移植的压缩格式并为了 Java 代码打包的目的而推广它。随着人们逐渐习惯 META-INF 的实用性,ZIP 文件中为特定的打包格式创建了新的“名称空间”,例如“WEB-INF”。
ZIP 文件格式的第一个“扩展”是添加清单或 MANIFEST.MF 以及可选添加索引列表(以加快项目提取速度)。现在,此类文件(由于具有已知的扩展名称空间)已经能够以许多其他方式扩展,例如最近添加的用于服务注册的子目录“services”。
当您考虑 ZIP 文件包含文件和目录时,只有使用目录作为名称空间才有意义。
Jar files are actually ZIP files with extra information and possibly better indexing. When packing the extra information into the ZIP file it becomes important to place it in a location which is not likely to conflict with normal ZIP file contents.
The selection of META-INF as a directory in which information about the JAR file could be stored was an attempt to use directories as a name space within the ZIP file. Basically, if it was stored in META-INF, it was Meta-data Information, or (picking amongst the possible meanings of meta), "self information" or "abstract information".
This allowed the storage of information which would impact the handling of the ZIP file within the ZIP file itself, without breaking the ZIP file packaging. This was key, as it prevented the need to create a new, portable compression format and popularize it for the purpose of Java code packaging. As people became accustomed to the utility of META-INF, new "name spaces" in the ZIP file were created for specific packaging formats, for example "WEB-INF".
The first "extensions" to the ZIP file format was the addition of a manifest, or MANIFEST.MF and the optional addition of an index list (to speed item extraction). Now such files (due to having a known extension name space) have been able to extend in many other ways, like the recent addition of the sub-directory "services" for service registration.
When you consider that ZIP files contain files and directories, it only makes sense to use a directory as a name space.
元
Web
我认为“Inf”是“信息”的缩写。
Meta
Web
"Inf" I would imagine is short for "information."
如果我没记错的话,meta-inf 是用于元信息的。这可能是完全错误的。如果这是正确的,您可能会猜测 web-inf 用于网络信息:-P
If I remember correctly meta-inf is for meta information. This may be totally wrong. If that is correct you could probably guess that web-inf is for web information :-P