将Equinox OSGi集成到Apache Tomcat Web应用程序中 [英] Integrating Equinox OSGi into Apache Tomcat web app

查看:342
本文介绍了将Equinox OSGi集成到Apache Tomcat Web应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能将osgi-equinox引入现有的Java Apache Tomcat项目?
根据我的理解,OSGI必须在某种容器中运行。我如何整合它?

Is it possible to introduce osgi-equinox into existing java Apache Tomcat project? From my understanding OSGI must run inside some kind of "container". How would I integrate it?

我也在使用 Jersey 用于RESTful资源。

I am also using Jersey for RESTful resources.

推荐答案

你可能想看看这个问题:传统Java EE服务器内的OSGI运行时

You may want to look at this question: OSGI runtime inside traditional Java EE server.

在这个桥模型中,安装了一个特殊的servlet,Tomcat调用这个servlet来处理请求。 OSGi运行时是从这个servlet中生成的,但OSGi运行时本身(例如equinox)与HTTP之类的东西无关。还安装了OSGi HTTP服务包,您需要针对此OSGi HTTP服务注册您的Web应用程序(servlet,jsp,...)以处理传入的请求。因此,并不是说有一个单独的Web服务器可以说它在自己的端口上侦听并在Tomcat外部管理HTTP。您的里程可能会有所不同,但开销基本上限于OSGi HTTP服务在将请求从Tomcat连接器转发到您的servlet时可能添加的任何内容。

In this bridge model, a special servlet is installed and Tomcat invokes this servlet to handle the request. An OSGi runtime is spawned from within this servlet, but the OSGi runtime itself (e.g. equinox) is agnostic of things like HTTP. An OSGi HTTP service bundle is also installed, and you'll need to register your web app (servlet, jsp, ...) against this OSGi HTTP service to handle the incoming requests. Therefore, it is not like there is a separate "web server" to speak of that listens on its own port and manages HTTP on its own outside Tomcat. Your mileage may vary, but the overhead is basically limited to whatever the OSGi HTTP service might add when it forwards the request from the Tomcat connector to your servlet.

此桥模型如果您无法更改现有部署模型,则需要。从长远来看,更好的模型是首先拥有OSGi运行时,并将Tomcat(或任何其他符合OSGi标准的容器)作为bundle插入OSGi运行时。

This bridge model is needed if you cannot change the existing deployment model. In the long run, a better model is to have the OSGi runtime first and have Tomcat (or any other OSGi-compliant container) plug into the OSGi runtime as bundles.

这篇关于将Equinox OSGi集成到Apache Tomcat Web应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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