java Tomcat 是中间件吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1213006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 15:39:26  来源:igfitidea点击:

Is Tomcat middleware?

javaweb-servicestomcatsolrmiddleware

提问by aarona

So I have a client that needs to be running tomcat for various things (Solr and a webservice as well) and after having a meeting with him and another programmer on the project, I got a little confused. The other programmer was throwing around buzzwords and saying things like "We need to have middleware for tomcat." In response to this, my client asks me to look for middleware for tomcat which confused me because I thought that writing a webservice would be specific to the project at hand and so the "middleware" would be developed by us. If this is the case, why not just say "Web service"?

所以我有一个客户端需要为各种事情运行 tomcat(Solr 和 web 服务也是如此),在与他和另一个项目程序员会面后,我有点困惑。另一位程序员则到处乱说流行语,并说“我们需要为 tomcat 提供中间件”。对此,我的客户要求我为 tomcat 寻找中间件,这让我感到困惑,因为我认为编写 Web 服务将特定于手头的项目,因此“中间件”将由我们开发。如果是这样,为什么不直接说“Web 服务”呢?

My question is this: Is there an open source servlet or plug-in for tomcat that makes it middleware (maybe something from apache's site?) or does it make sense that I should be writing my own middleware for tomcat? Or... is tomcat considered middleware? I am a total n00b when it comes to Java and tomcat, but I have a lot of experience with C#, so I'm trying to figure out how this relates to C#. I have never used the term "middleware" before and I'm pretty sure "webservice" is pretty much the same thing.

我的问题是:是否有开源 servlet 或 tomcat 插件使其成为中间件(也许来自 apache 的站点?)或者我应该为 tomcat 编写自己的中间件是否有意义?或者…… tomcat 被认为是中间件吗?在谈到 Java 和 tomcat 时,我完全是 n00b,但我对 C# 有很多经验,所以我试图弄清楚这与 C# 有何关系。我以前从未使用过“中间件”这个词,而且我很确定“网络服务”几乎是同一个东西。

Any ideas?

有任何想法吗?

回答by MattC

All of these answers are too verbose. Yes, Tomcat is middleware. it sits between the HTML/Javascript layer on the client's browser and the database layer on your server. It's not as full featured as a J2EE server but it's still "middleware" as far as the generally accepted buzzword-term goes.

所有这些答案都过于冗长。是的,Tomcat 是中间件。它位于客户端浏览器上的 HTML/Javascript 层和服务器上的数据库层之间。它不像 J2EE 服务器那样功能齐全,但就普遍接受的流行语术语而言,它仍然是“中间件”。

回答by Sindri Traustason

The term middleware is usually used to describe software who's purpose is to connect together two different systems.

术语中间件通常用于描述旨在将两个不同系统连接在一起的软件。

If you are writing web services on top of another application and the third application will talk to the web services. Then yes, you are writing middleware.

如果您在另一个应用程序之上编写 Web 服务,并且第三个应用程序将与 Web 服务通信。那么是的,您正在编写中间件。

If you are generally working in a .NET environment and some systems are on Tomcat. Then it's likely that the other programmer was claiming that to connect the .NET apps to the Java apps on Tomcat, some middleware would have to be written. (He's probably right.)

如果您通常在 .NET 环境中工作并且某些系统在 Tomcat 上。那么很可能另一个程序员声称要将 .NET 应用程序连接到 Tomcat 上的 Java 应用程序,必须编写一些中间件。(他可能是对的。)

回答by lsiu

Middleware is literally just a software that sits in the middle of 2 systems. It does things like if one system talk XML over HTTP, the other system talks COBOL. Middleware can do the translation between the two system.

中间件实际上只是一个位于两个系统中间的软件。它的作用是,如果一个系统通过 HTTP 传输 XML,另一个系统传输 COBOL。中间件可以做两个系统之间的翻译。

A lot of the "middleware" out there in the J2EE space are just software build on top of a J2EE container. Unfortunately, tomcat is not a full-fledge J2EE container, it just implements the Servlet specification. Therefore, there are no support for other J2EE facilities such as JMS, EJB, SMTP, etc which limits its off-the-self ability to connect to other system.

J2EE 空间中的许多“中间件”只是构建在 J2EE 容器之上的软件。不幸的是,tomcat 不是一个成熟的 J2EE 容器,它只是实现了 Servlet 规范。因此,不支持其他 J2EE 工具,例如 JMS、EJB、SMTP 等,这限制了其独立连接到其他系统的能力。

However, if you are working with modern systems, a lot of software can run on tomcat which allows you to connect to other system using SOAP-based web-service. In this case, you don't really need a separate middleware system.

但是,如果您使用的是现代系统,很多软件都可以在 tomcat 上运行,这允许您使用基于 SOAP 的 Web 服务连接到其他系统。在这种情况下,您实际上并不需要单独的中间件系统。

All-in-all, identify what systems you need to connect to now, what systems you need to connect to the near future, and Keep It Stupid and Simple (KISS). Don't just blindly trust vendors who will claim their middleware will make coffee and delivery it to the CEO daily if that is what they need to say to make the sale.

总而言之,确定您现在需要连接到哪些系统,在不久的将来需要连接哪些系统,并保持简单和简单 (KISS)。不要盲目相信那些声称他们的中间件会每天制作咖啡并将其交付给 CEO 的供应商,如果他们需要这样说才能进行销售的话。

Regarding "web-service", web service really means anything service you can call from the web. So it once again depends on your audience, if you are communication to external vendors familiar with SOAP based web-service, you have lots of choices. However, if you audience want to call you service by tweeting against your tweeter account, it is also a web service.

关于“网络服务”,网络服务实际上意味着您可以从网络调用的任何服务。因此,这再次取决于您的受众,如果您要与熟悉基于 SOAP 的 Web 服务的外部供应商进行交流,那么您有很多选择。但是,如果您的听众想通过针对您的推特帐户发送推文来呼叫您的服务,那么它也是一项网络服务。

回答by ShabbyDoo

You can justifiably slap the "Middleware" label on about anything that has separate clients and back-ends. The issue to me isn't what you call it, but whether or not the "it" is the right architecture/technology for the situation.

您可以合理地将“中间件”标签贴在具有独立客户端和后端的任何东西上。对我来说,问题不在于你怎么称呼它,而在于“它”是否是适合这种情况的架构/技术。

回答by Jay

I think the obvious reply would be, "Middleware for Tomcat to do what?"

我认为显而易见的答复是,“Tomcat 的中间件是做什么的?”

If the person's answer is, "To stand between the database and the browser", then the right answer is "Tomcat is middleware".

如果这个人的答案是“站在数据库和浏览器之间”,那么正确的答案是“Tomcat 是中间件”。

If the answer is, "To stand between our security server and Tomcat", then the answer is probably "Okay, we'll have to check if we already have such software in house or if we need to acquire or build it."

如果答案是“站在我们的安全服务器和 Tomcat 之间”,那么答案可能是“好吧,我们必须检查我们内部是否已经拥有这样的软件,或者我们是否需要获取或构建它。”

In real life when this sort of thing comes up the answer I often get is more like, "Because I read in a magazine that Web middleware is the latest cutting edge technology and so we should be using it" or "Umm, because, like, I heard somewhere that you always need middleware or metal ware or something like that", then the correct answer is, "When you have identified the problem, we can discuss solutions. Let's not decide on a solution and then search for a problem that it might solve."

在现实生活中,当这类事情出现时,我经常得到的答案更像是,“因为我在杂志上读到 Web 中间件是最新的尖端技术,所以我们应该使用它”或“嗯,因为,就像,我听说你总是需要中间件或金属件或类似的东西”,那么正确的答案是,“当你确定问题时,我们可以讨论解决方案。我们不要决定一个解决方案,然后搜索一个问题它可能会解决。”