用Java创建Web服务器/servlet容器——站在巨人的肩膀上
首先也是最重要的:我想说这主要是个人练习。有大量的容器和服务器(Tomcat、Jetty、Winstone)可以满足市场的需求。
有一天,我遇到了 Akka 项目,并且在 Erlang 中获得了很多乐趣过去,我认为使用它来构建一个功能性的 Web 服务器真的很酷。
然后我就开始做白日梦。如果我可以使用现代框架并以代码高尔夫的方式构建一个几乎完全“站在巨人的肩膀上”的 Web 服务器怎么办?也就是说:我可以设法使用多少其他人的工作。
理想情况下,需求类似于:
- 容错、可集群、分布式
- 易于配置
- 支持可配置的 HTTP、HTTPS 和 AJP ports
- 支持接口绑定和多个域
- 通过可插拔接口支持 JSP、Jython 等
- 支持允许实现 WebDAV、代理和 URL 重写等功能的模块
目前我最大的障碍是你到底如何使用Jasper、Jetty、GlassFish 或任何其他工具来解释 JSP,而无需担心它们带来的所有其他内容(例如网络)?
任何其他关于功能的建议都会非常棒。我还在研究非传统配置方法,看看是否有比 XML 或属性文件更令我喜欢的方法。对于那些熟悉 Apache 的人来说,有时您需要一些脚本,有时您只需要键/值对。
所以,无论如何,请向我提出你的建议。
First and foremost: I want to state that this is mostly a personal exercise. There are plenty of containers and servers out there (Tomcat, Jetty, Winstone) that satisfy the needs of the market.
The other day I came across the Akka project and, having had a lot of fun with Erlang in the past, decided that it would be really cool to use it to build a functional web server.
Then I started daydreaming. What if I could use modern frameworks and build, in a code golf way, a web server that almost completely "stood on the shoulders of giants"? That is to say: how much of other people's work could I manage to use.
Ideally the requirements would resemble something like:
- Fault tolerant, clusterable, distributed
- Easy to configure
- Supports HTTP, HTTPS, and AJP on configurable ports
- Supports interface binding and multiple domains
- Supports JSP, Jython, etc. through a pluggable interface
- Supports modules that allow implementation of things like WebDAV, proxy, and URL rewrite
My biggest stumbling block at this juncture is how on earth do you use Jasper, Jetty, GlassFish or anything to interpret JSPs without worrying about all the other stuff, like networking, that they bring?
Any other suggestions for features would be highly awesome. I'm also investigating non-traditional configuration methods to see if there's anything out there that I like more than XML or properties files. For those of you who are familiar with Apache, sometimes you need a little scripting and sometimes you just need key/value pairs.
So, in any case, hit me up with your suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
至少Tomcat已经将其JSP引擎实现为一个模块。它没有单独发布,可能需要一些工作才能将其与 Tomcat 代码的其余部分完全分离。
它有一个单独的名称 (Jasper) 和自己的 Howto。它可以在
org.apache.jasper
包(及下面)中找到。At least Tomcat has implemented its JSP engine as a module. It's not released separately and it might require some work to fully dis-couple it from the rest of the Tomcat code.
It's got a separate name (Jasper) and its own Howto. It's found in the
org.apache.jasper
package (and below).