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).
Netty Servlet Bridge allows integration of existing Servlet API based web-applications into the Netty-backed infrastructure.
Netty is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients. It greatly simplifies and streamlines network programming such as TCP and UDP socket server.
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".
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.
If you want to get Jersey working with Netty you can use the bindings available at https://github.com/cgbystrom/jersey-netty
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With