products springone_2gx tc_server tomcat

Apache Tomcat 8: What It Is, What You Need To Know

tomcat-8-icon_200x200Yesterday, Pivotal’s own Mark Thomas had an exciting announcement on the Apache Tomcat mailing lists: the first release candidate of Tomcat 8 is now available!

After 2 years of development, this release has been made available as an alpha and while it is not recommended for production use, it certainly contains many features developers will be keen to try out.

As with all major releases of Tomcat, each of the Java specifications it supports have also been updated. This release aligns Tomcat to the Java EE 7 specification, including Java Servlet 3.1, JavaServer Pages (JSP) 2.3, and Java Unified Expression Language (EL) 3.0. This work actually occurs in parallel, working to solidify the specifications as well as the build in tandem with key contributors working on both the Java specification as well as Apache projects. Thomas, who served as release manager for this project, had previously clarified, “As the work on the specifications proceeds, and, as the changes firm up, then those changes will be implemented in the Tomcat 8 branch.”

Tomcat 8.0 is designed to run on Java 7. For reference, the following specifications have been supported:

  • Tomcat 6: Servlet 2.5, JSP 2.1, and EL 2.1.
  • Tomcat 7: Servlet 3.0, JSP 2.2, and EL 2.2.
  • Tomcat 8: Servlet 3.1, JSP 2.3, and EL 3.0. In addition, there is support for a new specification, Java WebSocket 1.0.

—————————————————————————————-

Interested in hearing more? Come to SpringOne2GX in Santa Clara, CA from Sept 9-12 and attend the Apache Tomcat 8 Preview session given by Pivotal’s own Daniel Mikusa and Stuart Williams. Click here to register today. Early bird registration ends August 9th!

—————————————————————————————-

Highlighted Features:

The Servlet 3.1 is an incremental update that includes a couple new features and further clarifications to the specification. One of those new features is non-blocking I/O. This is a performance improvement and allows data to be managed asynchronously through a ReadListener and a WriteListener interface. This also applies to the new Websockets capabilities. The other big addition an HTTP protocol upgrade that allows the client to specify switching protocols. Under the hood, this is the same capability that is used by WebSockets to upgrade the HTTP connection, although this allows for a broader range of protocols. See this example of the protocol upgrade in the Servlet 3.1 for sample code of this feature in action.

For JSP 2.3, there was not much in the way of new capabilities or features. This release was more focused on maintenance and clarifications.

For E.L 3.0, there were some significant enhancements, and Tomcat 8 takes these into account.

  • First of all, EL can now run on it’s own in standalone mode, outside of servlets and JSP pages. In a nutshell, the enhancement allows you to call an ELProcessor class directly within your application without a servlet container.
  • In addition, there is now support for lambda expressions, similar to what will be in Java 8. These expressions can simplify code and are comprised of a set of parameters, a lambda operator, and a function body. See the following examples and overview for more information.
  • Collection operators will allow for the construction of Sets, Lists, and Maps.
  • The Java EL stream API includes filters like forEach, reduce, filter, and map. Here, you can take a collection or list, invoke a string method, and run additional filtering or aggregate functions on the list. For example, you could sum a string.
  • Developers will be able to directly access static fields and methods of any classes imported to the EL context.

Websockets 1.0 as a standard API is now supported. Tomcat 7 had support, but it was Tomcat-specific support because the specification wasn’t finalized. Most websites today run HTTP in half-duplex mode—this means that communications can happen in both directions, but only one at a time, like a walkie-talkie. The Websockets protocol is full duplex—this means that bidirectional data can flow at the same time. It was originally proposed with HTML5.

Apache Tomcat-specific Changes

The biggest Tomcat-specific change is with resources. Resources have been refactored to better support the inclusion of external resources. The implementation replaces Aliases, VirtualLoader, VirtualDirContext, JAR resources and external repositories with a single, consistent approach for configuring additional web application resources. The new resources implementation can also be used to implement overlays using a master WAR as the basis for multiple web applications that each have their own customizations.

SPDY, the protocol that caused some buzz at this year’s ApacheCon in Portland, has been implemented for experimental use. Demonstrated by Google at ApacheCon, this protocol is designed to make the web much faster. While it is introducing exciting possibilities to the HTTP 2.0 project, SPDY does have one significant drawback in that it is limited to HTTPS connections.

Additionally, there are some security enhancements—primarily there is additional diagnostic information for SSL ciphers.

When Will Tomcat 8 Be Ready For Production?

The Java EE specification implementations are all complete, but there is some internal refactoring remaining on the TODO list (such as switch to UTF-8 be default) hence the alpha label. Once this is done, the alpha label should be removed and the project will go to beta. While it is impossible to tell exactly when this release will be voted stable, previous major versions of Tomcat have generally taken 6-9 months to stabilize and be formally recommended for production environments by the Apache Software Foundation.

For more information: