OSGi HTTP Bundle - 绑定到两个端口 [英] OSGi HTTP Bundle - Bind to two ports

查看:501
本文介绍了OSGi HTTP Bundle - 绑定到两个端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Apache Felix HTTP Jetty捆绑包。我可以启动servlet容器/ HttpService并使用系统属性将其分配给端口

I'm using the Apache Felix HTTP Jetty bundle. I can start the servlet container / HttpService and assign it to a port using the system property

org.osgi.service.http.port=8080

但是我希望有两个这样的服务,绑定到两个不同的端口,例如我的应该在8080上提供应用程序API,但是应该在端口80上提供一些静态网页。

But I would like to have two such services, bound to two different ports, eg my application API should be served on 8080, but some static web pages should be served on port 80.


  • 如何启动HTTP服务a第二次在不同的端口上?

  • 在注册servlet时,我怎么知道哪个服务绑定到哪个端口?

编辑:对于最后一个问题,该服务附带属性中设置的端口值
org.osgi.service.http.port:8080

for that last question, the service comes with the port value set in a property org.osgi.service.http.port: 8080

推荐答案

如果你切换到Pax-Web,你将能够做类似的事情。 Pax-Web支持虚拟主机,让您将某个应用程序绑定到单个连接。有关如何使用它的更多详细信息,您可以在我的两篇博文中找到:

将Web应用程序绑定到特定的http连接器 - 第1部分

将Web应用程序绑定到特定的http连接器 - 第2部分

If you switch over to Pax-Web you'll be able to do something like it. Pax-Web supports Virtual Hosts, and let's you bind a certain application to a single connection. Some more details on how to use it you'll find at my two blog posts:
Bind web applications to specific http connectors - part 1
Bind web applications to specific http connectors - part 2

这篇关于OSGi HTTP Bundle - 绑定到两个端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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