You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Bob Paulin <bo...@bobpaulin.com> on 2014/04/11 04:35:54 UTC

Wicket and Felix Jetty osgi-bundlecontext Servlet Context

Hi,

I was working on building a distribution of Felix 4.4.0 and the Wicket 
6.14.0 OSGi example.  I noticed that the Wicket OSGi Test Project has an 
init-param that looks up the osgi-bundlecontext servlet context 
attribute.  This does not work because of the order things are 
initialized in the  JettyService#doExecute method:

1) Get Bundle
2) Start WebAppBundleContext
3) Create Service Properties
4) Register Service
5) Set osgi-bundlecontext Servlet Context

Since Wicket is trying to use the bundle context within the init of a 
servlet init class (in step 2) it's NULL at this point in the execution.

I wanted to know if there's a reason we could not execute it in the 
following order:

1) Get Bundle
*2) Set osgi-bundlecontext Servlet Context*
3) Start WebAppBundleContext
4) Create Service Properties
5) Register Service

Is there a reason the bundle context could not be available earlier?  
Happy to submit a patch and JIRA but I wanted to see if the list had any 
insights into the significance of the original ordering.

Thanks,

- Bob Paulin

Re: Wicket and Felix Jetty osgi-bundlecontext Servlet Context

Posted by Bob Paulin <bo...@bobpaulin.com>.
Jan,

I've created https://issues.apache.org/jira/browse/FELIX-4483.  I've 
attached a patch and an Integration Test.  Thanks for your quick response!

- Bob Paulin
On 4/11/2014 11:15 AM, Jan Willem Janssen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Bob,
>
> On 10/04/14 20:35, Bob Paulin wrote:
>> I wanted to know if there's a reason we could not execute it in
>> the following order:
>>
>> 1) Get Bundle *2) Set osgi-bundlecontext Servlet Context* 3) Start
>> WebAppBundleContext 4) Create Service Properties 5) Register
>> Service
> This seems to me as a more logical choice.
>
>> Is there a reason the bundle context could not be available
>> earlier? Happy to submit a patch and JIRA but I wanted to see if
>> the list had any insights into the significance of the original
>> ordering.
> I could not find anything in the WAB specification that prevents us
> from publishing the bundle context before starting the
> WebAppBundleContext. If you've a patch for this, I'd be more than
> willing to apply it...
>
> - -- 
> Met vriendelijke groeten | Kind regards
>
> Jan Willem Janssen | Software Architect
> +31 631 765 814
>
> /My world is revolving around PulseOn and Amdatu/
>
> Luminis Technologies B.V.
> J.C. Wilslaan 29
> 7313 HK   Apeldoorn
> +31 88 586 46 30
>
> http://www.luminis-technologies.com
> http://www.luminis.eu
>
> KvK (CoC) 09 16 28 93
> BTW (VAT) NL8169.78.566.B.01
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJTSBUOAAoJEKF/mP2eHDc4iRkP/RTQwasB+w2/28oijJzZWE2o
> +Qb6K9AFryM4wbo+owLDDbbx6LAPzHDFVbw5PoA7e2vvYvVE+gLLYftsDZh1h00p
> oGe/XnkVThjaOWjyCjIV5qMqfFJYvXoKcn7cx6O6BYQ6aLNQm00gE3DevhTc4r/R
> erjg1b952QppsRW8+0BQolKmLxJqBCR3ykfK8+6s8NkxBeHVu0nqYKsDUfpwOZVy
> iI7ZhYKZ83gJUmthSuZGsL1uGtTUpx5K72foJ+kvd1PZtf+qBs/TcAvK7YYUH1G0
> WZYPvgTp6ppBhi9E9xossXqOYkfbQEkJZtGdOi5qRDSDbmBnUSU4Ewga8QbVYUYP
> mqB8eKwbTPJlRl0WvTkcgu1tj/iA6i6vk57/dX9zsHnj8D9QPlniNAOIzqVAxr4O
> hKAwCXxEZL1FFPZPkSzbydejSKH7rHZJ176yvc2k4ufyvvs2Sn0mcnEoLRxHx2lW
> hoPmqON2sh8bkxGkWKFzedemdpp80OeMzteWs8hCk3zu3PdZTE9km9euQCdpag5t
> qOpcivfN5sKUegyzXYhKxj5s1zCNFvTU2pJQhnnYNsTArpBP/RPPSfuFbwRqFE36
> oyhvId5ztUHOY75Og5xIeNznBwV7xhzFMsBF4fS6xjVOPjrQUGSoGThr9Qb2GTKs
> fbeaFwROBIwe/gtAAqGy
> =NXDD
> -----END PGP SIGNATURE-----
>


Re: Wicket and Felix Jetty osgi-bundlecontext Servlet Context

Posted by Jan Willem Janssen <ja...@luminis.eu>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bob,

On 10/04/14 20:35, Bob Paulin wrote:
> I wanted to know if there's a reason we could not execute it in
> the following order:
> 
> 1) Get Bundle *2) Set osgi-bundlecontext Servlet Context* 3) Start
> WebAppBundleContext 4) Create Service Properties 5) Register
> Service

This seems to me as a more logical choice.

> Is there a reason the bundle context could not be available
> earlier? Happy to submit a patch and JIRA but I wanted to see if
> the list had any insights into the significance of the original
> ordering.

I could not find anything in the WAB specification that prevents us
from publishing the bundle context before starting the
WebAppBundleContext. If you've a patch for this, I'd be more than
willing to apply it...

- -- 
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

/My world is revolving around PulseOn and Amdatu/

Luminis Technologies B.V.
J.C. Wilslaan 29
7313 HK   Apeldoorn
+31 88 586 46 30

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTSBUOAAoJEKF/mP2eHDc4iRkP/RTQwasB+w2/28oijJzZWE2o
+Qb6K9AFryM4wbo+owLDDbbx6LAPzHDFVbw5PoA7e2vvYvVE+gLLYftsDZh1h00p
oGe/XnkVThjaOWjyCjIV5qMqfFJYvXoKcn7cx6O6BYQ6aLNQm00gE3DevhTc4r/R
erjg1b952QppsRW8+0BQolKmLxJqBCR3ykfK8+6s8NkxBeHVu0nqYKsDUfpwOZVy
iI7ZhYKZ83gJUmthSuZGsL1uGtTUpx5K72foJ+kvd1PZtf+qBs/TcAvK7YYUH1G0
WZYPvgTp6ppBhi9E9xossXqOYkfbQEkJZtGdOi5qRDSDbmBnUSU4Ewga8QbVYUYP
mqB8eKwbTPJlRl0WvTkcgu1tj/iA6i6vk57/dX9zsHnj8D9QPlniNAOIzqVAxr4O
hKAwCXxEZL1FFPZPkSzbydejSKH7rHZJ176yvc2k4ufyvvs2Sn0mcnEoLRxHx2lW
hoPmqON2sh8bkxGkWKFzedemdpp80OeMzteWs8hCk3zu3PdZTE9km9euQCdpag5t
qOpcivfN5sKUegyzXYhKxj5s1zCNFvTU2pJQhnnYNsTArpBP/RPPSfuFbwRqFE36
oyhvId5ztUHOY75Og5xIeNznBwV7xhzFMsBF4fS6xjVOPjrQUGSoGThr9Qb2GTKs
fbeaFwROBIwe/gtAAqGy
=NXDD
-----END PGP SIGNATURE-----

Re: Wicket and Felix Jetty osgi-bundlecontext Servlet Context

Posted by Bob Paulin <bo...@bobpaulin.com>.
Achim,

I have not used Pax Wicket before.  I'm a bit more familiar with Felix 
but I'll certainly check it out.  I was able to get the examples working 
once I moved the addition of the osgi-bundlecontext earlier in the 
doExecute sequence so I was hoping to understand if it had to occur 
following the WebAppBundleContext#start.  If this is possible other 
Felix users might benefit.  It seems like this could impact anyone that 
would require the osgi-bundlecontext with an init event (Filter or Servlet).

- Bob Paulin
On 4/10/2014 11:49 PM, Achim Nierbeck wrote:
> Have you tried to use Pax Wicket it  keeps the pain away in these
> scenarios.
>
> Regards, Achim
>
> sent from mobile device
> Am 11.04.2014 05:04 schrieb "Bob Paulin" <bo...@bobpaulin.com>:
>
>> For clarity the init-param exists inside of a filter defined in the
>> web.xml.  Sorry for any confusion.
>>
>> - Bob Paulin
>> On 4/10/2014 9:35 PM, Bob Paulin wrote:
>>
>>> Hi,
>>>
>>> I was working on building a distribution of Felix 4.4.0 and the Wicket
>>> 6.14.0 OSGi example.  I noticed that the Wicket OSGi Test Project has an
>>> init-param that looks up the osgi-bundlecontext servlet context attribute.
>>>   This does not work because of the order things are initialized in the
>>>   JettyService#doExecute method:
>>>
>>> 1) Get Bundle
>>> 2) Start WebAppBundleContext
>>> 3) Create Service Properties
>>> 4) Register Service
>>> 5) Set osgi-bundlecontext Servlet Context
>>>
>>> Since Wicket is trying to use the bundle context within the init of a
>>> servlet init class (in step 2) it's NULL at this point in the execution.
>>>
>>> I wanted to know if there's a reason we could not execute it in the
>>> following order:
>>>
>>> 1) Get Bundle
>>> *2) Set osgi-bundlecontext Servlet Context*
>>> 3) Start WebAppBundleContext
>>> 4) Create Service Properties
>>> 5) Register Service
>>>
>>> Is there a reason the bundle context could not be available earlier?
>>>   Happy to submit a patch and JIRA but I wanted to see if the list had any
>>> insights into the significance of the original ordering.
>>>
>>> Thanks,
>>>
>>> - Bob Paulin
>>>
>>


Re: Wicket and Felix Jetty osgi-bundlecontext Servlet Context

Posted by Achim Nierbeck <bc...@googlemail.com>.
Have you tried to use Pax Wicket it  keeps the pain away in these
scenarios.

Regards, Achim

sent from mobile device
Am 11.04.2014 05:04 schrieb "Bob Paulin" <bo...@bobpaulin.com>:

> For clarity the init-param exists inside of a filter defined in the
> web.xml.  Sorry for any confusion.
>
> - Bob Paulin
> On 4/10/2014 9:35 PM, Bob Paulin wrote:
>
>> Hi,
>>
>> I was working on building a distribution of Felix 4.4.0 and the Wicket
>> 6.14.0 OSGi example.  I noticed that the Wicket OSGi Test Project has an
>> init-param that looks up the osgi-bundlecontext servlet context attribute.
>>  This does not work because of the order things are initialized in the
>>  JettyService#doExecute method:
>>
>> 1) Get Bundle
>> 2) Start WebAppBundleContext
>> 3) Create Service Properties
>> 4) Register Service
>> 5) Set osgi-bundlecontext Servlet Context
>>
>> Since Wicket is trying to use the bundle context within the init of a
>> servlet init class (in step 2) it's NULL at this point in the execution.
>>
>> I wanted to know if there's a reason we could not execute it in the
>> following order:
>>
>> 1) Get Bundle
>> *2) Set osgi-bundlecontext Servlet Context*
>> 3) Start WebAppBundleContext
>> 4) Create Service Properties
>> 5) Register Service
>>
>> Is there a reason the bundle context could not be available earlier?
>>  Happy to submit a patch and JIRA but I wanted to see if the list had any
>> insights into the significance of the original ordering.
>>
>> Thanks,
>>
>> - Bob Paulin
>>
>
>

Re: Wicket and Felix Jetty osgi-bundlecontext Servlet Context

Posted by Bob Paulin <bo...@bobpaulin.com>.
For clarity the init-param exists inside of a filter defined in the 
web.xml.  Sorry for any confusion.

- Bob Paulin
On 4/10/2014 9:35 PM, Bob Paulin wrote:
> Hi,
>
> I was working on building a distribution of Felix 4.4.0 and the Wicket 
> 6.14.0 OSGi example.  I noticed that the Wicket OSGi Test Project has 
> an init-param that looks up the osgi-bundlecontext servlet context 
> attribute.  This does not work because of the order things are 
> initialized in the  JettyService#doExecute method:
>
> 1) Get Bundle
> 2) Start WebAppBundleContext
> 3) Create Service Properties
> 4) Register Service
> 5) Set osgi-bundlecontext Servlet Context
>
> Since Wicket is trying to use the bundle context within the init of a 
> servlet init class (in step 2) it's NULL at this point in the execution.
>
> I wanted to know if there's a reason we could not execute it in the 
> following order:
>
> 1) Get Bundle
> *2) Set osgi-bundlecontext Servlet Context*
> 3) Start WebAppBundleContext
> 4) Create Service Properties
> 5) Register Service
>
> Is there a reason the bundle context could not be available earlier?  
> Happy to submit a patch and JIRA but I wanted to see if the list had 
> any insights into the significance of the original ordering.
>
> Thanks,
>
> - Bob Paulin