glassfish-web.xml vs sun-web.xml vs web.xml [英] glassfish-web.xml vs sun-web.xml vs web.xml

查看:223
本文介绍了glassfish-web.xml vs sun-web.xml vs web.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能解释 glassfish-web.xml sun-web.xml 之间的主要区别(或提供了链接) C $ C>和的web.xml

Could someone explain the main differences (or provide a link to) between glassfish-web.xml, sun-web.xml and web.xml?

我可以只使用与GlassFish网.xml 在我的webapp中,并跳过其他人?

Can I use just glassfish-web.xml in my webapp and skip the others?

推荐答案

    strong> web.xml :由Java EE定义的标准部署描述符(特别是Servlet JSR,但被许多JSR使用)。它用于指定Web容器使用的元数据,以跨应用程序服务器(例如servlet的URL端点)以可移植的方式部署应用程序。在Java EE 6及更高版本中,当Java代码中的注释提供元数据(如@WebServlet)时,它是可选的(取决于您使用的技术)。 .xml :每个应用程序服务器都提供特定于实现的功能。要为GlassFish配置这些功能,请使用glassfish-web.xml。这是记录在 GlassFish文档
  • sun- web.xml :传统的特定于应用程序服务器的部署描述符,并且已被glassfish-web.xml取代。 Sun在被Oracle收购后拥有这个名字已经不再合理了。此文件名仍然支持向后兼容性,但你应该迁移到Glassfish的-web.xml中。

    • web.xml: Standard deployment descriptor defined by Java EE (Servlet JSR in particular, but used by many JSRs). It is used to specify the metadata used by the web container to deploy the application in a portable manner across application servers (such as the URL endpoint of a servlet). In Java EE 6 and beyond, it is optional (depending on technologies that you use) when metadata is provided by annotations in your Java code, like @WebServlet.
    • glassfish-web.xml: Each application server offers implementation-specific features. To configure these features for GlassFish, use glassfish-web.xml. This is documented in the GlassFish Documentation.
    • sun-web.xml: Legacy application-server specific deployment descriptor, and has been replaced by glassfish-web.xml. It no longer made sense to have this name after Sun was acquired by Oracle. This file name is still supported for backwards compatibility, but you should migrate to glassfish-web.xml.
    • 您可能会或可能不会需要一个web.xml文件。这取决于您使用的Java EE功能。默认情况下,请勿使用这些文件中的任何一个,并简单地使用Java Web标记(如@WebServlet)。在构建应用程序时,可能会开始使用某些需要web.xml文件的功能(如定义JavaServer Faces FacesServlet),然后使用web.xml文件。至于glassfish-web.xml,如果您为您的应用程序配置了GlassFish特有的功能,则只能使用一个。

      You may or may not need a web.xml file. It depends on the Java EE features you use. By default, don't use any of these files and simply use Java EE annotations like @WebServlet. As you build out your app and perhaps begin using some features that require the web.xml file (like to define the JavaServer Faces FacesServlet), then use a web.xml file. As for the glassfish-web.xml, you only use one if you have GlassFish-specific features to configure for your application.

      Java EE教程也是一个好方法学习Java EE,并与 Java EE 7 SDK 以及GlassFish 4。

      The Java EE tutorial is also a good way to learn Java EE, and is bundled with the Java EE 7 SDK along with GlassFish 4.

      这篇关于glassfish-web.xml vs sun-web.xml vs web.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆