Servlet 3.0 new Features

Source: Internet
Author: User

1. Add annotation support, these annotation are mainly in the Javax.servlet.annotation package, the servlet can not only use these annotation, but also can use other common Java annotations.
2. Add servlet modular functionality, the official term is web fragment, that is, a Web project can have multiple similar web.xml feature files, of course a project can have only one web.xml file, can have multiple web- Fragment.xml files, the server will look for web-fragment.xml files from web-inf/classes and web-inf/lib directories, web-inf/ The Web-fragment.xml file under Lib must be placed in the META-INFA directory of the jar package. Finally, these web-frament.xml files can specify the order.
3. Improve the meta programming capabilities of the servlet, that is, dynamic registration Servlet,filter,listener. The main performance is the Javax.servlet.ServletContext interface has added many methods, such as: Addservlet, addfilter, AddListener, these methods can dynamically add Servlet,filter, Listener, etc.
4. Added direct support for file uploads, Add the Getpart and GetParts method to Javax.servlet.http.HttpServletRequest, and add the Javax.servlet.http.Part interface, which should have provided this feature earlier, the unified file upload interface.
5. The JSP file is packaged into a jar package as a resource file and deployed directly to the Web-inf/lib directory, which has many benefits for the product development project. The JSP file must be placed in a specific directory in the JAR package: Jar/meta-inf/resources. This directory is specified by the servlet specification and cannot be changed.
6. Added Javax.servlet.SessionCookieConfig interface, support session tracking customization, we all know cookies are used to implement the session mechanism of one of the methods, and most of the time is the server's default preferred method, before servlet3.0 to The default name of the cookie that implements the session is that the Jsessionid,servlet specification does not provide an interface to customize the property. I don't see the benefit of this customization for a while.
7. The most important new feature: support for asynchronous operations, which is tantamount to raising server-side AJAX support to the normative level, the previous servlet to Ajax support is simulated, because the servlet synchronization operation, must have a return value, even if the browser side do not return any results, The thread also waits for the servlet to finish executing.
8.ServletContainerInitializer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.