Bug 327015 - Use WAR product for ServletBridge in dev-mode
Summary: Use WAR product for ServletBridge in dev-mode
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Libra (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-05 10:38 EDT by Angelo ZERR CLA
Modified: 2022-02-24 11:24 EST (History)
5 users (show)

See Also:


Attachments
Patchs for dev-mode + docs + sample explained (1.39 MB, application/zip)
2010-10-12 03:27 EDT, Angelo ZERR CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Angelo ZERR CLA 2010-10-05 10:38:47 EDT
I have tried to improve Servletbridge in the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=323707  to support dev-mode with ServletBridge: I would like use bundles from the workspace directly to avoid creating a JAR and copy/paste in the WEB-INF/plugins folder of the WEB Application. My patch works, I have written several articles about that at http://angelozerr.wordpress.com/about/osgi-equinox-in-a-servlet-container/

BUT if you read https://bugs.eclipse.org/bugs/show_bug.cgi?id=323707 you can see that Simon Kaegi prefer having a tool which manage ServletBridge dev-mode, on other words using a product to manage dev-mode (and after distribution). 

Simon Kaegi suggest me to see  [WAR Product] and I知 not disappointed! I知 modifying your Plug-In to manage this feature : when you modify + save the product (ex : add new bundles) it generate you the well WEB-INF\configuration\config.ini with real path of bundles. After when you deploy your WEB Application only the config.ini (and dev.properties that I must manage) is used to use ServletBridge. Generate config.ini automaticly when product changes should be optionnal (I must manage that). 

When I will finish my work I will send you a patch to see in action my idea.

Regards Angelo
Comment 1 Holger Staudacher CLA 2010-10-05 11:29:43 EDT
Hi Angelo,
sounds interesting. It would be good if you can provide tests with your patch. That makes it easier for me to apply it.
Comment 2 Angelo ZERR CLA 2010-10-06 03:24:07 EDT
(In reply to comment #1)
> Hi Angelo,
> sounds interesting. It would be good if you can provide tests with your patch.
> That makes it easier for me to apply it.

Hi Holger,

Thank a lot for your interesment. I will see your test to see which test I will able to. For the moment I'm trying some code to manage my idea. Now I can generate a well config.ini in the Eclipse Project as soon as warproduct is generated. Now I must generated a dev.properties file (like the OSGi launch) to set the bin folder as sources for bundles coming from workspace. ServletBridge should be modified too to support dev.properties (osgi.dev parameter).

But I have some troubles with your validation (Validate WAR Product) : 

* it requires "org.eclipse.equinox.servletbridge.extensionbundle".
* "org.eclipse.update.configurator" is banned.

I don't know if you know that but ServletBridge generate the org.eclipse.equinox.servletbridge.extensionbundle fragment to export javax.servlet packages (coming from the System Library wich comes from the Server). When your server support javax.servlet.http (2.5) it export package like this "javax.servlet.http; version=2.5". Here the generated MANIFEST.MF : 

-----------------------------
Manifest-Version: 1.0
Export-Package: org.eclipse.equinox.servletbridge; version=1.1, javax.
 servlet; version=2.5, javax.servlet.http; version=2.5, javax.servlet.
 resources; version=2.5
Fragment-Host: system.bundle; extension:=framework
Bundle-Version: 1.2.0
Bundle-Name: Servletbridge Extension Bundle
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.equinox.servletbridge.extensionbundle
-----------------------------

When your server support javax.servlet.http (3.0), it generate "javax.servlet.http; version=3.0". 

org.eclipse.equinox.servletbridge.extensionbundle fragment is used too use teh extendedFrameworkExports declaration in the BridgeServlet. For instance if you write this in the web.xml : 

<init-param>
<param-name>extendedFrameworkExports</param-name>
<param-value>com.mycompany.exports; version=1.0.0</param-value>			
</init-param>

Export-Package: will contains com.mycompany.exports; version=1.0.0

If you wish use generated  org.eclipse.equinox.servletbridge.extensionbundle (generated when BridgeServlet start) you must add "org.eclipse.update.configurator" bundle (I don't why, but my test tell me that).

So I think we should support 2 modes : 

* use a static "org.eclipse.equinox.servletbridge.extensionbundle" bundle like you have validated. In this case "org.eclipse.equinox.servletbridge.extensionbundle" is required in the product 
and "org.eclipse.update.configurator" is banned.
* use generated "org.eclipse.equinox.servletbridge.extensionbundle". In this case "org.eclipse.equinox.servletbridge.extensionbundle" is banned in the product and "org.eclipse.update.configurator" is required.

I think it should be cool if we have a new Tab Page called for instance "BridgeServlet") which is the configuration of the BridgeServlet : 

* support static/generated "org.eclipse.equinox.servletbridge.extensionbundle". Switch the option, validation must be different :
* manage servlet-mapping (/*....)
* manage init-param : 
 * enableFrameworkControls : true/false
 * commandline : text field.
 * extendedFrameworkExports : with a help with available packages 
 * frameworkLauncherClass : by default with blank value.

I think it should be cool too if we can manage start+level bundles. I have seen that https://bugs.eclipse.org/bugs/show_bug.cgi?id=322281 Indead, for the moment I generate a config.ini with @start for the whole bundles. IMHO I think "Configuration" tab should be renamed with "Dependencies" and new tab called "Configuration" should be created to manage start level. Those name follow the same than Eclipse product.

I have another idea too like import JAR org.eclipse.osgi.... coming from the Eclipse Home to the Eclipse project. But before managing that, I must finish this bug.
Comment 3 Angelo ZERR CLA 2010-10-12 03:27:29 EDT
Created attachment 180642 [details]
Patchs for dev-mode + docs + sample explained

This zip contains : 

* 3 patchs wich manage dev-mode :
** org.eclipse.rap.warproducts.core_devMode.patch
** org.eclipse.rap.warproducts.core.test_devMode.patch
** org.eclipse.rap.warproducts.ui_devMode.patch

* /sample folder which contains the bridge WTP WEB Applcation explained in this documentation which use warproduct dev-mode.

* ODT and RTF documentation (org.eclipse.rap.warproducts.core - DevMode)

Please read org.eclipse.rap.warproducts.core - DevMode.odt (or rtf) to see in action how dev-mode works. My sample is based on WTP Web Dynamic Web Project. I have explained step by step how create a WTP Web Dynamic Web Project and how transform it to support ServletBridge by using warproduct patched for dev-mode. 

In this documentation you will see a lot of comments I have written (marked with BUG[xxx]). We could discuss together and create new bug if you are OK.

Hope you will like my (little) work. It's just a first step for dev-mode.