Introducing the spray-can HTTP server/client

Posted by Mathias in [spray]

27 Sep 2011

While continuing our work on spray (the lightweight framework for building RESTful web services with Scala and Akka) as well as our own commercial application built on top of it, we have come to more and more succumb to the “Scala way” of writing software. Our code has become more functional, our data models more immutable and everything just somehow more “granular” and easier to manage than ever before. While all this feels great and puts a lot of fun back into where it had sometimes started to dwindle there is also a downside to it: Working with “old-school” Java libraries and APIs, with their mutable state, their PluggableVisitorAdapterManagerFactoryProviders, their XML configuration abominations and legacy compatibility layers simply becomes painful. Everything just seems to scream “case class!”, “default parameter!”, “Option!” or “function composition!”.

Working on spray one of these legacy pain points is the Servlet API. Having been the standard interface between Java web servers and Java web applications for more than 14 years it certainly cannot be called a failure. Almost all of the mature and proven Java web servers more or less exclusively rely on this API for connecting with the applications on top them. Up to now spray too did not have another way of talking to the world.
Still, from todays point of view, the Servlet API sucks! It’s mutable, stateful, convoluted, loquacious and full of weird quirks. And even though support for asynchronous request handling has been bolted on in its 3.0 incarnation the whole things still feels very much like something from the last millennium. A shame that nowadays Scala applications have to jump through this grey cast iron hoop to display their shine!

No more!

The spray team would like to present spray-can, a low-overhead, high-performance, fully asynchronous HTTP 1.1 server and client implemented entirely in Scala on top of Akka. It is fully pipeline- and streaming-enabled and, through it’s actor-esque genome, plays perfectly with your Akka-based application, whether it also relies on the rest of the spray suite or not.

You are invited to learn more about it on its github page!
Happy spraying!


View Comments