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.
- http://www.jboss.org/netty/community#nabble-td4752485
- http://markmail.org/message/4qmvuaacxqzevqhc
Basically I'm looking to support just enough to get jersey w开发者_如何学Pythonorking (hopefully jersey is not doing any threadlocal stuff).
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.
精彩评论