使用 Netty 的 Servlet API 实现 [英] Servlet API implementation using Netty

查看:40
本文介绍了使用 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.

基本上我希望支持足以让 jersey 工作(希望 jersey 没有做任何线程本地的东西).

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 项目做出贡献,那就太好了.现在,让您失望的是,Jersey 确实使用了 ThreadLocals.我们一直在计划引入对非阻塞异步调用的支持,但这需要大量的重构,所以只有 2.0 版本(一旦最终版本实现 JAX-RS 2.0).不管怎样,除了非阻塞的东西,在类似 Grizzly 的框架上运行它还是很有用的,比如 Netty,因为它的轻量级".

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 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆