Author on TomcatExpert.com • Senior Technical Support Engineer at Pivotal ◦ Tomcat / tc Server ◦ Spring Framework ◦ CloudFoundry • Stuart Williams • Active on [email protected] • A committer on open source projects at Apache, Eclipse and elsewhere • Software Engineer at Pivotal ◦ Tomcat / tc Server ◦ Architect ◦ Pivotal RT project
JSP 2.3 ◦ Expression Language 3.0 ◦ Web Sockets 1.0 ◦ Little / no demand for other Java EE 7 components in Tomcat • Web Profile Container - Apache TomEE • J2EE Container - Apache Geronimo
HttpServletRequest.changeSessionId() • To listen for session id changes with HttpSessionIdListener • Register HttpSessionIdListener with: ◦ ServletContext.addListener(..) ◦ @WebListener public class CustomHttpSessionIdListener implements HttpSessionIdListener { public void sessionIdChanged(HttpSessionEvent event, String oldSessionId) { …. } }
to list specific HTTP methods covered by the security constraint ◦ <http-method> ◦ <http-method-omission> • A method is “uncovered” when… ◦ One or more methods are listed with <http-method>, any method not listed is “uncovered” ◦ One or more methods are listed with <http-method-omission>, every method list is “uncovered” • If no methods are specifically listed then all methods are protected
"GET", rolesAllowed = "R1"), @HttpMethodConstraint(value = "POST", rolesAllowed = "R1", transportGuarantee = TransportGuarantee.CONFIDENTIAL) }) public class Example5 extends HttpServlet { …. } Only GET & POST are covered
no JSP Expert Group • JSP 2.3 is a maintenance release • Changes ◦ Requires Servlet 3.1, EL 3.0 & Java 7 ◦ JSP must render identical response for GET, POST & HEAD; all other methods are undefined
has supported WebSockets for a while (different API) • Tomcat 8 implements new API • Tomcat 7 has been upgraded to support new API (as of Tomcat 7.0.43) • Both implement client & server APIs
of debate here) ◦ Annotations • Differences ◦ Tomcat 7’s implementation is blocking within a Frame ◦ WebSocket 1.0 is non-blocking although some writes do block • Non-blocking ◦ Works with the BIO connector but obviously is not really non-blocking ◦ Fundamentally changes the API
Upgrade ... HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade ... Initiate close (close control frame) Respond to close (close control frame)
VirtualWebappLoader ◦ External repositories for the WebappClassLoader ◦ Servlet 3.0 resource JARS • Tomcat 7 implements each of these slightly differently ◦ Very fragile ◦ Servlet 3.1 overlays would have been difficult • New resources implementation ◦ Much cleaner implementation ◦ Overlays now simpler to implement (but have been dropped from Servlet 3.1)
the docBase for a context) ◦ Jar Resources ◦ Post Resources • Types ◦ DirResourceSet - a directory ◦ FileResourceSet - a single file ◦ JarResourceSet - a JAR file • General recommendation is avoid using directly as this is Tomcat specific
way that is very similar to mod_rewrite from Apache HTTPD Server • Valve can be added in two locations o added in <Host> block. Configuration is in conf/Catalina/localhost/ rewrite.config. o added in Web App’s Context. Configuration is in WEB-INF/ rewrite.config. • Configuration Syntax: RewriteCond TestString CondPattern • Examples: o RewriteCond %{REMOTE_HOST} ^host1.* [OR] o RewriteCond %{REMOTE_HOST} ^host2.* [OR] o RewriteCond %{REMOTE_HOST} ^host3.* o RewriteRule ...some special stuff for any of these hosts...
• NIO connector is now the default • Additional diagnostic information in the Manager ◦ SSL ciphers ◦ May be back-ported to Tomcat 7 • DBCP2 is now the default (supports JDBC 4.1) ◦ DBCP & Tomcat jdbc-pool still included as well • Unclosed InputStream Tracking ◦ logs InputStreams from WebResources that haven’t been closed ◦ removes need for anti-jar locking and extracting files to work directory
8.0 ◦ 8.0.1 (beta) is available ◦ 8.0.3 (beta) is being voted on as of 2/9/2014 ◦ Implementations of Servlet 3.1, JSP 2.3, EL 3.0 & WebSocket 1.0 is complete ◦ Code is not ready for production usage, currently deemed beta quality ◦ This release has been quick. Past experience shows an alpha release will hit six to nine months after initial alpha release (Feb - May 2014). Beta release is already available. This is due to great community usage and feedback.