The Jetty 6.1.0 release is now available via http://jetty.mortbay.org. It represents both a stabilization of the features already released in 6.0.x, plus a raft of new features. For a full description of
Jetty 6.1, see http://docs.codehaus.org/display/JETTY/.
The core protocol engine of Jetty 6 has been further optimized and refined in 6.1, plus it has been extended to support asynchronous SSL and a future HTTP client API. Compliance testing and exposure on live deployments has allowed many minor and several major issues to be exposed and fixed.
Web Application Static Deployer
The WebApp Deployer is for static deployment standard WAR files and webapps with little or no Jetty specific customization.
Context Hot Deployer
The ContextDeployer may be used to (hot)deploy an arbitrary Context or Web Application with Jetty specific configuration. The ContextDeployer will scan the configuration directory for xml descriptors that define contexts. Any context descriptors found are used to configure and deploy a context and then the descriptor is monitored for changes to redeploy or undeploy the context.
Arbitrary contexts may be configured deployed including simple static contexts and standard webapplications. The web.xml of a war file may be extended or replaced and additional configuration applied, thus allowing configuration to be customized during deployment without modification to the WAR file itself.
Jetty 6.1 includes a servlet implementation of the bayuex protocol of http://cometd.com from the dojo foundation.
Cometd is a message bus for Ajax web applications that allows multi channel messaging between client and server – and more importantly – between server and client. The paradigm is publish/subscribe to named channels.
The Jetty implementation uses continuations and will thus scale to many connected clients. It also supports declarative filters for security and validation of channel content.
The jetty infrastructure can be use to test servlets with an embedded server using the ServletTester and HttpTester classes.
The embedded server uses a special local connector, and thus avoids the need to open sockets in order to test the servlet and is thus ideal for unit testing:
ServletTester tester=new ServletTester(); tester.setContextPath("/context"); tester.addServlet(HelloServlet.class, "/hello/*"); tester.start(); HttpTester request = new HttpTester(); HttpTester response = new HttpTester(); request.setMethod("GET"); request.setURI("/context/hello/info"); response.parse(tester.getResponses(request.generate())); assertEquals(200,response.getStatus()); assertEquals("<h1>Hello Servlet</h1>", response.getContent());
SSL Engine connector
A new SSL connector has been added to jetty 6.1 that is based on the javax.net.ssl.SSLEngine class. This allows the asynchronous mechanisms of jetty to be applied to SSL connections, specifically Continuations.
Jetty 6.1 now includes an implementation of the apache AJP protocol for forwarding requests from an apache httpd to Jetty. This connector is a significant rewrite from the Jetty 5 connector so more advance IO features can be used.
A Grizzly HTTP connector has been added which uses the Grizzly NIO library from Sun’s Glassfish JEE server. This connector provides an integration path into Glassfish server and an alternative HTTP connector.
Jetty 6.1 is integrated with Apache Geronimo. The flexibility of Jetty allows for a very close integration with the core geronimo infrastructure.
WADI is a clustering system that is integrated with both Jetty 6 standalone and as Jetty 6 within Geronimo.
Jetty 6 has been integrated with JBoss 4 and is an alternative webtier that will provide Servlet 2.5 and asynchronous servlets within this popular J2EE server.
The Google Widget Toolkit needs some small extentions in order to be able to be used with Jetty Continuations. This has been done to great effect on the aployr.com games sites, with gpokr.com and kdice.com games both being run from a single Jetty server capable of handling many more simultaneous users than the previous dual apache+tomcat configuration.
A windows service wrapper module is included in jetty 6.1.
Works in Progress
Annotations, Resource Injection and LifeCycle Callbacks
The release of Jetty 6.1 includes support for web.xml based resource injections and lifecycle callbacks as defined in the 2.5 Servlet Specification.
Resource injection removes the need for certain servlet-related classes to perform explicit JNDI lookups to obtain resources.
Instead, a resource from JNDI is automatically injected into
designated fields and/or methods of the class instance at runtimeby Jetty.
Lifecycle callbacks allow certain servlet-related class instances
to nominate a method to be called just before the instance goes
into service and another to be called just before the instance
goes out of service.
This release supports these features when defined in the web.xml
descriptor. For example:
<resource-ref> <res-ref-name>jdbc/mydatasource</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <injection-target> <injection-target-class>com.acme.JNDITest</injection-target-class> <injection-target-name>myDatasource</injection-target-name> </injection-target> </resource-ref> <post-construct> <lifecycle-callback-class>com.acme.JNDITest</lifecycle-callback-class> <lifecycle-callback-method>postConstruct</lifecycle-callback-method> </post-construct> <pre-destroy> <lifecycle-callback-class>com.acme.JNDITest</lifecycle-callback-class> <lifecycle-callback-method>preDestroy</lifecycle-callback-method> </pre-destroy>
Resource injection is supported for env-entry, resource-ref and resource-env-ref
elements. Both post-construct and pre-destroy callbacks are also supported.
The 2.5 Servlet Specification also allows for these features to be defined
directly in the source code of servlet-related classes via java annotations.
A forthcoming release of Jetty 6.1.x will implement @Resource, @Resources, @PostConstruct,
@PreDestroy, @DeclaresRoles and @RunAs annotations.
The protocol engines of Jetty have been refactored so that as well as request parsing and response generation, they now support request generation and response parsing. This will allow a HTTP client API to be developed within Jetty to efficiently implement non-blocking proxies.
The extensive features of Jetty 6.1 are further enhanced and
extended in the Jetty Hightide release from Webtide
Hightide is a versioned and supported distribution of Jetty providing:
- Jetty 6.1 scalable HTTP server, servlet container and Ajax support, patched with performance enhancements available with a targeted distribution.
- JettyPlus JNDI framework and JEE services.
- Access to Webtide’s premium support services.
- Atomikos XA transaction manager.
- AMQ with AJAX support configured and integrated into the XA transaction manager.