0

if i deploy a war-file into a gemini container (e.g. virgo has one) it will be transformed on-the-fly into an osgi bundle by adding some package imports (besides other things). Is it possible to somehow extend these default package imports using for example a bundle-listener or something like this? regards

wrm
  • 1,898
  • 13
  • 24

1 Answers1

0

I would strongly recommend that you do the transformation yourself before deploying into the Gemini container, rather than forcing Gemini to do the transformation on-the-fly. First it is very easy to do; second it will be much faster to deploy; third you will be able to add the specific imports that you want.

In order to turn a standard WAR file into a WAB (Web Application Bundle) that remains compatible with traditional WAR deployment, you just need to add the following headers to the MANIFEST.MF of the WAR:

  • Web-ContextPath to define the context path under which the web application will be served
  • Set Bundle-ClassPath to WEB-INF/classes plus any JARs under WEB-INF/lib. You will have to name these explicitly e.g.: Bundle-ClassPath: WEB-INF/classes,WEB-INF/lib/a.jar,WEB-INF/lib/b.jar...
  • Import-Package: javax.servlet,javax.servlet.http plus anything else you want to import.
Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
  • i know how to transform a war and so on, but i want to know how to change the default behavior because i want to write kind of an extension to a gemini environment... so i want to change deployed wars in a genereic way... – wrm Jul 25 '12 at 10:20
  • Sorry I don't understand why you would want to do that instead of transforming in advance. – Neil Bartlett Jul 25 '12 at 10:21
  • because i dont develop or deploy these wars and i am injecting some code during compile time in these wars and i want it to be transparent so i dont want that the developer has to change anything in his bundle.... – wrm Jul 25 '12 at 11:40
  • If you're injecting code into the WARs then why not inject a couple of MANIFEST.MF headers as well? – Neil Bartlett Jul 25 '12 at 15:38
  • i don't wanted to do that because wars generally don't need a manifest.mf and i want to be as transparent as possible... meaning i did not want to presume anything (e.g. WABs have a header, WARs dont really have a header, can i even assume that OSGI-Header information will be regarded in a WAR-manifest?) Though after researching i found a possible solution using equinox hooks (yes, it obviously depends on equinox ;D). EclEmma does this with the same intend. – wrm Jul 26 '12 at 08:16