Adam Gent
Adam Gent

Reputation: 49075

Servlet API implementation using Netty

Has anyone made a Servlet API implementation built on top of Netty? I'm tempted to build my own as I can't google an implementation.

Basically I'm looking to support just enough to get jersey working (hopefully jersey is not doing any threadlocal stuff).

Upvotes: 17

Views: 17911

Answers (4)

Anton Bessonov
Anton Bessonov

Reputation: 9803

Do you looking for Netty-Servlet-bridge?

This project provides a Servlet API implementation for Netty.IO framework (http://netty.io/).

Netty Servlet Bridge allows integration of existing Servlet API based web-applications into the Netty-backed infrastructure.

Upvotes: 1

Bob Stiles
Bob Stiles

Reputation: 41

If you want use Jersey with Netty, you probably need to be safe and use org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory

not,

org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory

This will allow the ThreadLocal stuff work correctly under load.

Of course, when Jersey upgrades to not use ThreadLocal, but ChannelLocal, this will not longer be needed.

Upvotes: 4

cgbystrom
cgbystrom

Reputation: 1987

If you want to get Jersey working with Netty you can use the bindings available at https://github.com/cgbystrom/jersey-netty

Upvotes: 2

Martin Matula
Martin Matula

Reputation: 7979

Jersey does not require servlet - runs fine even with the lightweight http server included in JDK or even runs with Grizzly NIO framework (which is similar to Netty - see grizzly.java.net). To see what it takes to make it run with Netty, you may want to look at jersey-grizzly2 module in Jersey workspace - would be nice if you would be willing to develop that and contribute to the Jersey project. Now, to disappoint you, Jersey does use ThreadLocals. We have been planning to introduce support for non-blocking async calls, but that requires a fair amount of refactoring, so will only come with 2.0 version (implementing JAX-RS 2.0 once that's final). Anyway, apart from the non-blocking stuff, it is still useful to run it on Grizzly-like framework such as Netty for its "light-weightness".

Upvotes: 18

Related Questions