本文介绍了使用Netty的Servlet API实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 是否有人在Netty之上构建了Servlet API实现? 我很想建立自己的,因为我不能谷歌实施。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 http://www.jboss.org/netty/community#nabble-td4752485http://markmail.org/message/4qmvuaacxqzevqhc基本上我想支持足够让球衣工作(希望球衣没有做任何线程本地的东西)。Basically I'm looking to support just enough to get jersey working (hopefully jersey is not doing any threadlocal stuff).推荐答案 Jersey不需要servlet - 即使使用JDK中包含的轻量级http服务器也可以正常运行,甚至可以运行Grizzly NIO框架(类似于Netty - 请参阅grizzly.java.net)。要了解如何使其与Netty一起运行,您可能需要查看Jersey工作区中的jersey-grizzly2模块 - 如果您愿意开发并为Jersey项目做出贡献,那将会很不错。 现在,为了让你失望,泽西确实使用了ThreadLocals。我们一直计划引入对非阻塞异步调用的支持,但这需要相当多的重构,因此只有2.0版本(一旦最终实现JAX-RS 2.0)。无论如何,除了非阻塞的东西之外,在Netty的类似Grizzly的框架上运行它的轻量级仍然是有用的。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". 这篇关于使用Netty的Servlet API实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-10 18:38