Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to package web application as bundles ?
How to package web application as bundles ? [message #106697] Thu, 20 March 2008 09:13 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi,

I want to package an Ajax framework as an Equinox bundle, this application
contains jars,css,javascript and taglibs. In plain web application we
usually define this taglib URI in web.xml, but how do you do so in bundle ?

Also, once you have package it as bundle, how do you access it from jsp
pages defined in other bundles ?

Any help would be greatly appreciated.

Best Regards,

Setya
Re: How to package web application as bundles ? [message #106832 is a reply to message #106697] Wed, 26 March 2008 11:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Boyan.Yurukov.softwareag.com

Hi Setya,

I am trying to do the same thing with Axis2, so here are some tips that my
help.

Put the whole application as it is in a bundle project. Add all packages as
imported and exported in the Manifest. Also import these three packages:
org.osgi.framework, org.osgi.service.http, org.osgi.util.tracker

Skip the web.xml. In it you basically have a mapping of different paths to
servlets. What you need to do is a ServiceTracker class that provides an
HttpService. In that HttpService you need to register all those resources
and servlets as they are mapped in the web.xml. It would be cool to have a
tool that reads and parses that information from a web.xml automatically,
but I don't know of such.

Then you have to make an Activator that starts the service tracker. Get the
server-side Equinox and check the example bundles to see how the activator
and the service tracker are implemented.

I hope this helped.

Greetings,
Boyan.


"Setya" <jsetya@gmail.com> wrote in message
news:9896d210367ae76d253230efaf984fa2$1@www.eclipse.org...
> Hi,
>
> I want to package an Ajax framework as an Equinox bundle, this application
> contains jars,css,javascript and taglibs. In plain web application we
> usually define this taglib URI in web.xml, but how do you do so in bundle
> ?
>
> Also, once you have package it as bundle, how do you access it from jsp
> pages defined in other bundles ?
>
> Any help would be greatly appreciated.
>
> Best Regards,
>
> Setya
>
Re: How to package web application as bundles ? [message #106899 is a reply to message #106832] Thu, 27 March 2008 03:25 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi Boyan,

> I am trying to do the same thing with Axis2, so here are some tips that my
> help.

> Put the whole application as it is in a bundle project. Add all packages as
> imported and exported in the Manifest. Also import these three packages:
> org.osgi.framework, org.osgi.service.http, org.osgi.util.tracker

> Skip the web.xml. In it you basically have a mapping of different paths to
> servlets. What you need to do is a ServiceTracker class that provides an
> HttpService. In that HttpService you need to register all those resources
> and servlets as they are mapped in the web.xml. It would be cool to have a
> tool that reads and parses that information from a web.xml automatically,
> but I don't know of such.

> Then you have to make an Activator that starts the service tracker. Get the
> server-side Equinox and check the example bundles to see how the activator
> and the service tracker are implemented.

Thank you for your lengthy explanation.

Let's say I have bundle A that registers its resources either via service
tracker or declaratively in plugin.xml, is it possible for jsp pages in
bundle B to use javascripts, css etc of bundle A ?

Regards,

Setya
Re: How to package web application as bundles ? [message #106912 is a reply to message #106899] Thu, 27 March 2008 17:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Boyan.Yurukov.softwareag.com

Well, when they are registered, they get their own path, so you can
access them through that URL. For example the html that a jsp generates
can import any css that another bundle has registered as a resource. To
the outside world the insides of the system are transparent. Which
bundle regs which resource/servlet is irrelevant, as long as it is
available to an outside user.

On the other hand, if you want to access them internally, you need to
treat them as regular resources and get them through the classloader. I
am not sure what restrictions there are for such cases.

Greetings,
Boyan.



Setya wrote:
> Hi Boyan,
>
>> I am trying to do the same thing with Axis2, so here are some tips
>> that my help.
>
>> Put the whole application as it is in a bundle project. Add all
>> packages as imported and exported in the Manifest. Also import these
>> three packages: org.osgi.framework, org.osgi.service.http,
>> org.osgi.util.tracker
>
>> Skip the web.xml. In it you basically have a mapping of different
>> paths to servlets. What you need to do is a ServiceTracker class that
>> provides an HttpService. In that HttpService you need to register all
>> those resources and servlets as they are mapped in the web.xml. It
>> would be cool to have a tool that reads and parses that information
>> from a web.xml automatically, but I don't know of such.
>
>> Then you have to make an Activator that starts the service tracker.
>> Get the server-side Equinox and check the example bundles to see how
>> the activator and the service tracker are implemented.
>
> Thank you for your lengthy explanation.
>
> Let's say I have bundle A that registers its resources either via
> service tracker or declaratively in plugin.xml, is it possible for jsp
> pages in bundle B to use javascripts, css etc of bundle A ?
>
> Regards,
>
> Setya
>
Re: How to package web application as bundles ? [message #108167 is a reply to message #106912] Tue, 15 April 2008 13:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Boyan.Yurukov.softwareag.com

Hi all,

See this tutorial regarding providing jsps inside an osgi bundle:
http://dev.nepomuk.semanticdesktop.org/wiki/JspPagesInOsgi

Boyan.


"Boyan Yurukov" <Boyan.Yurukov@softwareag.com> wrote in message
news:fsgl0i$el2$1@build.eclipse.org...
> Well, when they are registered, they get their own path, so you can access
> them through that URL. For example the html that a jsp generates can
> import any css that another bundle has registered as a resource. To the
> outside world the insides of the system are transparent. Which bundle regs
> which resource/servlet is irrelevant, as long as it is available to an
> outside user.
>
> On the other hand, if you want to access them internally, you need to
> treat them as regular resources and get them through the classloader. I am
> not sure what restrictions there are for such cases.
>
> Greetings,
> Boyan.
>
>
>
> Setya wrote:
>> Hi Boyan,
>>
>>> I am trying to do the same thing with Axis2, so here are some tips that
>>> my help.
>>
>>> Put the whole application as it is in a bundle project. Add all packages
>>> as imported and exported in the Manifest. Also import these three
>>> packages: org.osgi.framework, org.osgi.service.http,
>>> org.osgi.util.tracker
>>
>>> Skip the web.xml. In it you basically have a mapping of different paths
>>> to servlets. What you need to do is a ServiceTracker class that provides
>>> an HttpService. In that HttpService you need to register all those
>>> resources and servlets as they are mapped in the web.xml. It would be
>>> cool to have a tool that reads and parses that information from a
>>> web.xml automatically, but I don't know of such.
>>
>>> Then you have to make an Activator that starts the service tracker. Get
>>> the server-side Equinox and check the example bundles to see how the
>>> activator and the service tracker are implemented.
>>
>> Thank you for your lengthy explanation.
>>
>> Let's say I have bundle A that registers its resources either via service
>> tracker or declaratively in plugin.xml, is it possible for jsp pages in
>> bundle B to use javascripts, css etc of bundle A ?
>>
>> Regards,
>>
>> Setya
>>
Re: How to package web application as bundles ? [message #108981 is a reply to message #106832] Wed, 30 April 2008 12:22 Go to previous message
Alin Dreghiciu is currently offline Alin DreghiciuFriend
Messages: 2
Registered: July 2009
Junior Member
Boyan Yurukov wrote:

> Skip the web.xml. In it you basically have a mapping of different paths to
> servlets. What you need to do is a ServiceTracker class that provides an
> HttpService. In that HttpService you need to register all those resources
> and servlets as they are mapped in the web.xml. It would be cool to have a
> tool that reads and parses that information from a web.xml automatically,
> but I don't know of such.

Take a look at Pax Web: http://wiki.ops4j.org/confluence/x/AYAz and Pax
Web Extender: http://wiki.ops4j.org/confluence/x/eYA6
With Pax Web Extender - WAR will take any active bundle, parse the web.xml
and registr the found elements (servlets, filters, listeners, ...) with
Pax Web. If you just use servletes it should work with any Http Service
implementation not only Pax Web. here is a list of what is supported:
http://wiki.ops4j.org/confluence/x/RwJN

Regarding the JSP support and taglibs you can use Pax Web JSP support:
http://wiki.ops4j.org/confluence/x/CgNN

Alin Dreghiciu
Previous Topic:How to use RMI with Equinox
Next Topic:Tomcat based implementation of OSGI HTTP Service
Goto Forum:
  


Current Time: Mon Oct 25 11:41:21 GMT 2021

Powered by FUDForum. Page generated in 0.02086 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top