问题描述
我有一个服务器应用程序,包含多个OSGi包,一些是我的,一些是第三方。其中一个bundle使用Struts提供Web前端。必要的Struts库位于Web前端包中。
I have a server application that consists of multiple OSGi bundles, some mine, some third-party. One of the bundles provides a web frontend using Struts. The necessary Struts libraries live inside the web front-end bundle.
现在我想添加第二个包,它提供另一个Web前端,具有不同的依赖关系和非常不同的用例。我也希望将Struts用于该捆绑包,但我不想将相同的库放入两个捆绑包中。
Now I want to add a second bundle that provides another web front-end, with different dependencies and a very different use case. I want to use Struts for that bundle, too, but I don't want to put the same libraries into two bundles.
使用OSGi,应该没问题将Struts库分离为自己的捆绑包,并使用我的捆绑包中的那些。但是,我找不到这样打包的Struts。
With OSGi, it should be no problem to separate the Struts libs in a bundle of their own and use that from both my bundles. However, I couldn't find Struts packaged that way.
一些快速的Google搜索并查看没有产生任何结果。我可以找到一个Struts插件来在Struts中运行一个OSGi容器,但这不是我想要的。
Some quick googling and a look at the Struts homepage didn't yield anything. I could find a plugin for Struts to run an OSGi container inside Struts, but that's not what I want.
推荐答案
看一看在。
如果你下载struts2-core-2.1。 6.jar例如,解压缩并查看META-INF / MANIFEST.MF你会看到它确实包含OSGI头文件(Import-Package,Export-Package,Bundle - *):
If you download struts2-core-2.1.6.jar for example, extract it and take a look at META-INF/MANIFEST.MF you'll see that it does contain OSGI headers (Import-Package, Export-Package, Bundle-*):
C:\TMP\META-INF>more MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 1.5.0_10 (Sun Microsystems Inc.)
Built-By: musachyb
Build-Jdk: 1.5.0_10
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Import-Package: com.opensymphony.xwork2;version="2.1",com.opensymphon
<SNIP>
Bnd-LastModified: 1231185746365
Export-Package: org.apache.struts2.views.xslt;uses:="javax.servlet.ht
Bundle-Version: 2.1.6
<SNIP>
Bundle-Description: Apache Struts 2
Bundle-Name: Struts 2 Core
Bundle-DocURL: http://www.apache.org
Bundle-ManifestVersion: 2
Bundle-Vendor: Apache Software Foundation
Bundle-SymbolicName: org.apache.struts.struts2-core
Tool: Bnd-0.0.255
不知道如何在OSGi应用程序中使用它们 - 但理论上你至少可以参考它们并做东西!!: )
No idea how you go about using them within an OSGi app - but in theory you can atleast reference them and do "stuff"!! :)
这篇关于Struts 2是否可用作OSGi捆绑包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!